/e2e-api-automation-test

Primary LanguageHTMLGNU General Public License v3.0GPL-3.0

QA Automation Challenge

This project is a web test automation framework using Cypress version 13, written in JavaScript. It incorporates GitHub Actions for CI/CD and utilizes Mochawesome for generating stylish and informative test reports. It tests the webpage DemoBlaze for UI.

UI testing

These were the scenerios were automated:

1. Add 2 Items to cart.

2. Visualize the cart.

3. Complete checkout formulary.

4. Finish buying process.

API testing

For API Testing, 3 scenarios where automated:

1. Create an User.

2. Search for created user.

3. Update the name and email and assert.

API Reference

This project automates different API responses from https://petstore.swagger.io/ using the Cypress framework and the cypress-plugin-api. created by Filip Hric, generating reports and running into github actions as CI.

List User Details

  GET /users/{username}
Request type Endpoints Expected Response Code
GET /users/{username} 200

Create user

  POST /users/{username}
Request type Endpoints Request Body Expected Response Code
POST /users/{username} "id": 0, "username": "string", "firstName": "string", "lastName": "string", "email": "string", "password": "string", "phone": "string", "userStatus": 0 200

Modify Users

  PUT /users/{username}
Request type Endpoints Request Body Expected Response Code
PUT /users/{username} "id": 0, "username": "string", "firstName": "string", "lastName": "string", "email": "string", "password": "string", "phone": "string", "userStatus": 0 200

DELETE

  DELETE /users/{username}
Request type Endpoints Expected Response Code
DELETE /users/{username} 200

Tech Stack

Run Locally

Required to run project

  • Clone repository:
  git clone https://github.com/edgarysabel/e2e-api-automation-test.git
  • Install dependencies:
  npm install
  • Run project in headless mode:
  npm run cy:run
  • Run project in headed mode:
  npm run cy:open

This will run all the tests and generate a report at the end of the execution.

Run CI

CI has been configured with Github Actions for ease of use and integration since project is already hosted on Github. To run it just go to actions and run the workflow Run QA Integration Tests under your preferred Branch. Aditionally, pipeline always run whenever there is a new commit.

Note: To be able to do commits or run workflows please reach me at edgarysabel@gmail.com.

Test Reports

Mochawesome is configured to generate a standalone HTML report after the test execution. You can find the report in the cypress/reports/mochawesome-report directory. Open mochawesome.html in your browser to view the report.

To customize Mochawesome's configuration, you can modify the mochawesomeReporterOptions in the cypress.json or cypress.config.js file.

Test report have been done with Allure Report and stored with GitHub Pages, so pipeline is run, the reports are generated along it. To access reports go to https://edgarysabel.github.io/e2e-api-automation-test/.

Project Structure

UI testing configuration

The file cypress.env.json under root directory contains needed credentails for UI testing. Working credentials are currently included with the project.

  {
  "FRONTEND_URL": "https://demoblaze.com/",
  "API_ENDPOINT": "https://petstore.swagger.io/v2"
  }

Must Know

  • For API invalid scenarios was used failOnStatusCode: false, so it continues and do the assertions.

  • A custom POM Pattern with Javascript and Cypress was used.

  • The static data is stored on fixture for each test case.