Exercising Web automation testing with API backend.
The project was created to exercise and learn automation testing using catAPI's backend, using Playwright and JavaScript.
The testcases in "testsuite_catapi.spec.js" are using the "ApiFunctions.js" file to access all the requests.
Input certain values to testcases to vary the test coverage (Search based on query parameters, Create negative tests with expected "bad" response, Extract/Write data, Assert with status code and response text ..)
Current available Requests: GET, POST, DELETE
- Use a terminal to download the following packages to the projects root:
npm init playwright@latest
- Choose JavaScript
- end-to-end tests folder: tests
- Leave everything else on default (Don't override config!)
- Playwright will create an example test file called: "example.spec.js" you can delete it if you wish.
npm install dotenv
- Cat api requires a unique api key which can be obtained from this website after registration: https://thecatapi.com/signup
- Create a .env file in the project's root folder with the following lines:
API_KEY=
BASE_URL=
- Input the base API url found at the documentation. (Make sure that it ends with a /)
- Input your unique API key requested from the website.
Open a terminal inside your IDE
- Use the following command to run all the tests:
npx playwright test - Use the following command to open the Playwright UI:
npx playwright test --ui - Use the following command to run test based on "Projects" declared in Playwright config:
npx playwright test --project=chromium