rafaabc / teste-cypress

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Framework of automated GUI tests with Cypress

Quality Gate Status teste-cypress Cypress Tests using Cypress Docker Image

After attending a test automation course with Cypress (https://www.udemy.com/course/testes-cypress/) in different layers, here is an example of a framework to test functionally, in the API layer and in the frontend component.

The test website was used to simulate the balance validation, financial transaction creation, update and removal scenarios, among others.

In the frontend scenario, the tool allows simulating the backend calls by route deviation with cy.route. However, the function is deprecated and I adapted the calls via cy.intercept. Some scenarios in this suite were impacted as the new function still has limitations such as override as of version 6.0.0. So it was just to study what the tests are like in this layer. The most assertive and fastest validations still focus on the backend.

Requirements

Tools:

Dependencies:

Additional:

Directory Structure

./project
├─ cypress/
    ├─ fixtures
    └─ integration/
        └─ barriga/
            ├─ backend.spec.js
            ├─ frontend.spec.js
            └─ functional.spec.js
    └─ plugins/
    └─ support/
       ├─ commands.js
       ├─ commandsContas.js
       ├─ index.js
       └─ locators.js
  • cypress: main directory
  • fixtures: directory where the initial test script will be built
  • plugins: directory where it will be possible to extend some tool behaviors
  • support: directory with custom command files and elements mapped to the functional tests

Running via command line

Scripts were built that can be found in the package.json file:

Open the tool

npm run cypress:open


Run the tests in headless mode depending on the browser of choice

npm run cypress:run_electron npm run cypress:run_chrome npm run cypress:run_firefox


Run tests via Cypress Dashboard*

npm run cypress:dashboard

*Need to configure Dashboard locally for code integration


Run tests with Allure Report

npm run test

The script cleans the previous tests, creates 2 folders "allure-report" and "allure-results" with the new result and automatically opens the report in the browser.

About


Languages

Language:JavaScript 100.0%