Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
9 changes: 9 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { defineConfig } = require("cypress");

module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
41 changes: 41 additions & 0 deletions cypress/e2e/cadastro.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/// <reference types="cypress" />

const faker = require('faker-br');

context('Desafio técnico QA - Buildbox', () => {
context('Processo de cadastro', () => {
beforeEach(() => {
cy.visit('https://qastage.buildbox.one/18/cadastro/');
cy.get('[data-cy="button-btn-enroll"]').click();
})
it('Validar cadastro com sucesso', () => {
// Preenchendo dados pessoais
cy.fillPersonalData(faker.name.firstName(), faker.name.lastName(), faker.br.cpf(), faker.internet.email());
cy.contains('Dados Pessoais e de acesso').should('exist')
cy.contains('Já possui uma conta?').should('exist')

// Preenchendo endereço
cy.fillAdress()
cy.get(`[x-show="steps[currentStep] === 'address'"] > .mb-11 > .text-neutral-900`).should('be.visible')
cy.apiCep()
cy.get('[data-cy="button-previous_item"]').should('be.visible');

cy.get('[data-cy="button-signup_submit_button_3"]').click()

// Validando tela de sucesso
cy.contains('Thank you for joining us!').should('exist')
cy.contains(' Agora você tem o passe para descobrir como o inglês pode te levar longe ').should('exist')

cy.get('[data-cy="button-wide_window_button"]')
.should('exist').should('be.visible')
})
it('Preenchendo CPF com formato inválido', () => {
cy.fillPersonalData(faker.name.firstName(), faker.name.lastName(), 78945613203, faker.internet.email());
cy.get(':nth-child(2) > .form-container > .input-error').should('contain.text', 'CPF inválido')
})
it('Preenchendo CPF que já está em uso', () => {
cy.fillPersonalData(faker.name.firstName(), faker.name.lastName(), 12345678909, faker.internet.email());
cy.get('.input-error').should('contain.text', 'Este CPF já está em uso')
})
})
})
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
28 changes: 28 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Cypress.Commands.add('fillPersonalData', (name, lastName, cpf, email) => {
cy.get('[data-cy="input-signup-personal-data-firstName"]').type(name);
cy.get('[data-cy="input-signup-personal-data-lastName"]').type(lastName);
cy.get('[data-cy="input-signup-personal-data-birthDate"]').type('19051998');
cy.get('[data-cy="input-signup-personal-data-cpf"]').type(cpf);
cy.get('[data-cy="input-signup-personal-data-email"]').type(email)
cy.get('[data-cy="input-signup-personal-data-email-confirm"]').type(email)

cy.get('[data-cy="input-signup-personal-data-password"]').type('123456789')
cy.get('[data-cy="input-signup-personal-data-password-confirm"]').type('123456789')

cy.contains('Selecione a proficiência').click();
cy.get('#dropdown-button-1 > .overflow-y-scroll > :nth-child(3)').click()

cy.get('[data-cy="input-signup-personal-data-lgpd"]').click()
cy.get('[data-cy="button-signup_submit_button_1"]').click();
})

Cypress.Commands.add('fillAdress', () => {
cy.get('[data-cy="input-signup-address-cep"]').type('14407480')
cy.get('[data-cy="input-signup-address-number"]').type('785')
})

Cypress.Commands.add('apiCep', () => {
cy.intercept('**https://brasilapi.com.br/api/cep/v1/**').as('cep')
cy.wait('@cep');
})

20 changes: 20 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
Loading