From the course: Playwright Python and Pytest for Web Automation Testing: Master Modern Web Testing with Playwright and Pytest in Python

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Writing tests

Writing tests

Now that we have written our API context fixture and created a test hook to create the test repo. We can go ahead and start with our test cases. So let's create a new test module named test GitHub issue. And here we can go ahead and write the test functions to test the creation of an issue and make sure that it's inside of the repo. So first of all let's import the necessary things. So from the credentials let's import everything. And from LayWrite.SyncAPI, we will require the API input, API request context. So the first test function is to test the creation of an issue. Will require our API context, which is of type API request context. So the first thing is to have the issue data. So I can go ahead and create a simple dictionary and the issue data can have multiple fields like title and body, which are required, but there are others as well, which you can add. So I will add the title of our issue. say it's a bug and that went wrong and then we can go ahead and add the body that is…

Contents