diff --git a/README.md b/README.md index 97aebb07..23115c5b 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,7 @@ - -# qa-challenge +-Caso de teste escrito > [Caso de teste Buildbox.pdf](https://github.com/user-attachments/files/16228841/Caso.de.teste.Buildbox.pdf) -Olá! +Testes exploratórios: -Este desafio consiste em avaliar seu conhecimento e habilidades em testes automatizados, portanto esperamos que você tente resolve-lo usando toda a sua capacidade e compreensão da tecnologia aplicada. +1> O campo "NOME", ao digitar um nome curto "Exemplos>Ana/Iam/Tom", o campo fica invádlidado com uma mensagem de erro (Nome necessário). -O Desafio é o seguinte: - -Acesse esse link https://qastage.buildbox.one/18/cadastro - -Desenvolva casos de teste automatizados para validar o processo de cadastro em uma Aplicação Web. Os testes devem cobrir diferentes cenários, incluindo entradas válidas e inválidas, verificação de campos obrigatórios, validação de formatos de dados, entre outros aspectos relevantes para garantir a funcionalidade da tela de cadastro. - -Projetos que demonstrarem uso eficiente do Cypress, bem como a implementação de comandos personalizados, serão valorizados e receberão pontos adicionais. - -Certifique-se de que seu pull request está sendo enviado no link do formulário de submissão para a vaga. - -Estou ansioso para ver sua abordagem criativa e eficiente para este desafio de testes automatizados. -Boa sorte! +2> Campo "CPF" as vezes nao valida o cpf digitado. diff --git a/cypress.config.js b/cypress.config.js new file mode 100644 index 00000000..97f47c41 --- /dev/null +++ b/cypress.config.js @@ -0,0 +1,9 @@ +const { defineConfig } = require("cypress"); + +module.exports = defineConfig({ + e2e: { + setupNodeEvents(on, config) { + // implement node event listeners here + }, + }, +}); diff --git a/cypress/e2e/TesteBuildbox.cy.js b/cypress/e2e/TesteBuildbox.cy.js new file mode 100644 index 00000000..1c120230 --- /dev/null +++ b/cypress/e2e/TesteBuildbox.cy.js @@ -0,0 +1,133 @@ +import faker from 'faker-br'; +import Faker from 'faker-br/lib'; + + +context('Teste qastage/VAGA QA (BuildBox)', () => { + beforeEach(() => { + cy.visit('https://qastage.buildbox.one/18/cadastro/') + cy.clearCookies() + cy.get('[data-cy="button-btn-enroll"]').click() + }); + + let email = faker.internet.email() + let email2 = faker.internet.email() + let password = faker.internet.password() + + it('Deve efetuar cadastro com sucesso', () => { + + //Primeira página de cadastro + cy.get('[data-cy="input-signup-personal-data-firstName"]').type(faker.name.firstName()) + cy.get('[data-cy="input-signup-personal-data-lastName"]').type(faker.name.lastName()) + cy.get('[data-cy="input-signup-personal-data-birthDate"]').type('30111995') + cy.get('[data-cy="input-signup-personal-data-cpf"]').type(faker.br.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(password) + cy.get('[data-cy="input-signup-personal-data-password-confirm"]').type(password) + cy.contains('button', 'Selecione a proficiência') + .click() + cy.get('#dropdown-button-1 > .overflow-y-scroll > :nth-child(4)').click() + cy.get('[data-cy="input-signup-personal-data-lgpd"]').check() + cy.contains('button', 'Próximo') + .click() + + //Segunda página de cadastro (Após clicar em "Próximo") + + cy.get('[data-cy="input-signup-address-cep"]').type('30750340') + cy.get('[data-cy="input-signup-address-neighborhood"]').type('Caiçaras') + cy.get('[data-cy="input-signup-address-number"]').type('23') + .wait(1000) + cy.get('[data-cy="button-signup_submit_button_3"]') + .click() + + cy.get('.w-full > .flex-col') + .should('exist') + .should('include.text', "Thank you for joining us!") + }); + + it('Deve preencher CPF inválido', () => { + cy.get('[data-cy="input-signup-personal-data-cpf"]').type('654.848.484-525') + cy.get('[data-cy="input-signup-personal-data-email"]').click() + cy.get('.input-error') + .should('exist') + .should('include.text', 'CPF inválido.') + }); + + it('Deve preencher CPF com formato inválido', () => { + cy.get('[data-cy="input-signup-personal-data-cpf"]').type('654.848.484') + cy.get('.input-error') + .should('exist') + .should('include.text', 'Precisa corresponder ao formato esperado') + }); + + it('Deve preencher a data de nascimento com formato errado', () => { + cy.get('[data-cy="input-signup-personal-data-birthDate"]').type('04302020') + cy.get('.input-error') + .should('exist') + .should('include.text', 'Data de nascimento inválida.') + }); + + it('', () => { + cy.get('[data-cy="input-signup-personal-data-birthDate"]').type('04022032') + cy.get('.input-error') + .should('exist') + .should('include.text', 'Data de nascimento inválida.') + }); + + it('Deve preencher o email em formato errado', () => { + cy.get('[data-cy="input-signup-personal-data-email"]').type('testmail.com') + cy.get(':nth-child(1) > .form-container > .input-error') + .should('exist') + .should('have.text', 'Precisa ser email') + }); + + + it('Deve preencher o campo "CEP" de forma errada', () => { + cy.get('[data-cy="input-signup-personal-data-firstName"]').type(faker.name.firstName()) + cy.get('[data-cy="input-signup-personal-data-lastName"]').type(faker.name.lastName()) + cy.get('[data-cy="input-signup-personal-data-birthDate"]').type('30111995') + cy.get('[data-cy="input-signup-personal-data-cpf"]').type(faker.br.cpf()) + cy.get('[data-cy="input-signup-personal-data-email"]').type(email2) + cy.get('[data-cy="input-signup-personal-data-email-confirm"]').type(email2) + cy.get('[data-cy="input-signup-personal-data-password"]').type(password) + cy.get('[data-cy="input-signup-personal-data-password-confirm"]').type(password) + cy.contains('button', 'Selecione a proficiência') + .click() + cy.get('#dropdown-button-1 > .overflow-y-scroll > :nth-child(4)').click() + cy.get('[data-cy="input-signup-personal-data-lgpd"]').check() + cy.contains('button', 'Próximo') + .click() + + cy.get('[data-cy="input-signup-address-cep"]').type('307503') + cy.get('[data-cy="input-signup-address-neighborhood"]').type('Caiçaras') + cy.get('.toast') + .should('exist') + .should('have.text', 'CEP não encontrado.') + }); +}); + + +context('Testes de responsividade mobile', () => { + beforeEach(() => { + cy.visit('https://qastage.buildbox.one/18/cadastro/') + cy.clearCookies() + cy.get('[data-cy="button-btn-enroll"]').click() + }); + + it('Iphone 7', () => { + cy.viewport('iphone-7') + cy.contains("Dados Pessoais e de acesso") + .should('exist') + }); + + it('Ipad Mini', () => { + cy.viewport('ipad-mini') + cy.contains("Dados Pessoais e de acesso") + .should('exist') + }); + it('Samsung S10', () => { + cy.viewport('samsung-s10') + cy.contains("Dados Pessoais e de acesso") + .should('exist') + }); +}) \ No newline at end of file diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json new file mode 100644 index 00000000..02e42543 --- /dev/null +++ b/cypress/fixtures/example.json @@ -0,0 +1,5 @@ +{ + "name": "Using fixtures to represent data", + "email": "hello@cypress.io", + "body": "Fixtures are a great way to mock data for responses to routes" +} diff --git a/cypress/support/commands.js b/cypress/support/commands.js new file mode 100644 index 00000000..66ea16ef --- /dev/null +++ b/cypress/support/commands.js @@ -0,0 +1,25 @@ +// *********************************************** +// This example commands.js shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** +// +// +// -- This is a parent command -- +// Cypress.Commands.add('login', (email, password) => { ... }) +// +// +// -- This is a child command -- +// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This will overwrite an existing command -- +// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) \ No newline at end of file diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js new file mode 100644 index 00000000..0e7290a1 --- /dev/null +++ b/cypress/support/e2e.js @@ -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') \ No newline at end of file