Skip to content

danielhndz/devsu-qa-e2e-api

Repository files navigation

🛠️ Devsu - QA Practical Exercises

⛏️ Daniel Hernández


This project is the solution implemented for the Devsu QA practical exercises.

Getting Started

Prerequisites

Run

First, you need to clone this repo:

git clone git@github.com:danielhndz/devsu-qa-e2e-api.git

Then, you need to go to the project folder:

cd devsu-qa-e2e-api

Then, you need to install the dependencies, if you haven't already done so:

npm i -D

Then, you can run it with the Cypress GUI (the Allure reports will not be generated):

# both have the same result
npx cypress open
npm run cy:open

running

E2E testing

After running it, select E2E Testing:

selecting e2e testing

Then select the browser and click on Start E2E Testing in <browser>:

selecting browser

Then select the e2e feature file:

selecting e2e feature file and running scenario

API testing

After running it, select E2E Testing:

selecting e2e testing

Then select the browser and click on Start E2E Testing in <browser>:

selecting browser

Then select the api feature file:

selecting api feature file and running scenario

Report

You must already have Allure installed to generate the testing report:

# both have the same result
npx cypress run
npm run cy:run

running finished

Then, you can generate Allure reports based on the allure-results folder generated in the previous step:

allure generate

allure generate

Then, you can open the reports generated on the allure-report folder in the previous step:

allure open

allure open

Final findings and thoughts

  • Cypress can successfully automate E2E and API test flows for e-commerce sites such as saucedemo.com and petstore.swagger.io, I find it seems to produce flake-resistant tests as opposed to Selenium.
  • Cypress ca be easily integrated with plugins, allowing Cucumber and POM for instance, to be implemented on a Cypress-based framework.
  • I found an interesting and valuable opinion by Filip Hric, he says that keeping in mind that Cypress tests are executed inside the browser, the use of Cucumber (whose benefits are well known and so well appreciated from my point of view) implies using a black-box approach that "throws away all the power of Cypress", I agree with him, but I also think that the benefits that come with Cucumber are important and valuable enough to keep it, he also "still" believes that we can be successful even with this abstraction model.
  • I also found that the saucedemo.com page has some HTML elements whose properties have values that seem a bit strange, with function calls in the middle of the value.
  • Finally, I would also like to highlight the versatility that Cypress offers in the sense that we can develope and execute both types of tests, E2E and API, using the same automation framework.

Built With

  • Cypress - JavaScript testing framework
  • cypress-esbuild-preprocessor (plugin) - Bundle Cypress specs using esbuild
  • cypress-cucumber-preprocessor (plugin) - This preprocessor aims to provide a developer experience and behavior similar to that of Cucumber, to Cypress.
  • Allure - Simple. Fun. Language and Framework agnostic.
  • allure-cypress - Generate beautiful HTML reports using Allure Report and your Cypress tests.
  • Git - Version Management

Authors

  • Daniel Hernández - Initial work - danielhndz
  • Last update: 07/06/2024

License

This project is licensed under the GPLv3 License - see the LICENSE.md file for details

About

Solution implemented for the two Devsu's practical exercises

Topics

Resources

License

Stars

Watchers

Forks