-
Notifications
You must be signed in to change notification settings - Fork 14
Entrega do desafio técnico #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
raffael-azevedo
wants to merge
9
commits into
Buildbox-IT-Solutions:main
Choose a base branch
from
raffael-azevedo:raffael
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d9f8694
added info to gitignore
raffael-azevedo dc6a277
added the base URL to the config file
raffael-azevedo 950ce3c
last info about the project dependencies
raffael-azevedo 642c985
created custom commands; created registering tests
raffael-azevedo 5c0ef3d
added failing test: previously registered emails
raffael-azevedo 186665d
added static data for validations
raffael-azevedo 75a8fb2
added more test cases
raffael-azevedo 4898161
just changed the name of a file
raffael-azevedo 35c2197
minor changes
raffael-azevedo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| node_modules | ||
|
|
||
| ### CypressIO ### | ||
| # gitignore template for the CypressIO, browser test framework | ||
| # website: https://www.cypress.io/ | ||
|
|
||
| cypress/results/* | ||
| cypress/reports/* | ||
| cypress/screenshots/* | ||
| cypress/videos/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| const { defineConfig } = require("cypress"); | ||
|
|
||
| module.exports = defineConfig({ | ||
| e2e: { | ||
| setupNodeEvents(on, config) { | ||
| // implement node event listeners here | ||
| }, | ||
| baseUrl: "https://qastage.buildbox.one/18", | ||
| }, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| const { faker, fakerTH } = require("@faker-js/faker"); | ||
| const { generate } = require("gerador-validador-cpf"); | ||
| const staticData = require("../fixtures/staticData.json"); | ||
|
|
||
| const generateUser = () => { | ||
| let birthday = faker.date.between({ from: "1950-01-01", to: "2005-12-31" }); | ||
| const formattedBirthday = `${birthday | ||
| .getDate() | ||
| .toString() | ||
| .padStart(2, "0")}/${(birthday.getMonth() + 1) | ||
| .toString() | ||
| .padStart(2, "0")}/${birthday.getFullYear()}`; | ||
| return { | ||
| firstName: faker.person.firstName(), | ||
| lastName: faker.person.lastName(), | ||
| birthDate: formattedBirthday, | ||
| cpf: generate(), | ||
| email: faker.internet.exampleEmail(), | ||
| password: faker.internet.password(), | ||
| }; | ||
| }; | ||
| let newUser = generateUser(); | ||
|
|
||
| describe("Feature: Registering", () => { | ||
| beforeEach(() => { | ||
| newUser = generateUser(); | ||
| cy.visit("/cadastro"); | ||
| }); | ||
| it("should correctly open the register website", () => { | ||
| expect(cy.get('[data-cy="button-btn-enroll"]')).to.exist; | ||
| }); | ||
| it("should correctly open the register website", () => { | ||
| cy.get('[data-cy="button-btn-enroll"]').click(); | ||
| cy.personalData( | ||
| newUser.firstName, | ||
| newUser.lastName, | ||
| newUser.birthDate, | ||
| newUser.cpf, | ||
| newUser.email, | ||
| newUser.password, | ||
| "Advanced" | ||
| ); | ||
| expect(cy.get("span").contains("STEP 02/02").scrollIntoView()).to.exist; | ||
| cy.addressData(); | ||
| expect(cy.get('[data-cy="button-wide_window_button"]')).to.exist; | ||
| }); | ||
|
|
||
| it("should validate previously registered emails", () => { | ||
| cy.get('[data-cy="button-btn-enroll"]').click(); | ||
| cy.personalData( | ||
| newUser.firstName, | ||
| newUser.lastName, | ||
| newUser.birthDate, | ||
| newUser.cpf, | ||
| staticData.email, | ||
| newUser.password, | ||
| "Advanced" | ||
| ); | ||
| expect(cy.get("span.input-error").contains("Este email já está em uso.")).to | ||
| .exist; | ||
| }); | ||
|
|
||
| it("should validate the field: CPF already registered", () => { | ||
| cy.get('[data-cy="button-btn-enroll"]').click(); | ||
| cy.personalData( | ||
| newUser.firstName, | ||
| newUser.lastName, | ||
| newUser.birthDate, | ||
| staticData.cpf, | ||
| newUser.email, | ||
| newUser.password, | ||
| "Advanced" | ||
| ); | ||
| expect(cy.get("span.input-error").contains("Este CPF já está em uso.")).to | ||
| .exist; | ||
| }); | ||
| it("should validate the field: invalid email format", () => { | ||
| cy.get('[data-cy="button-btn-enroll"]').click(); | ||
| cy.personalData( | ||
| newUser.firstName, | ||
| newUser.lastName, | ||
| newUser.birthDate, | ||
| newUser.cpf, | ||
| "john@doe@@mailcom", | ||
| newUser.password, | ||
| "Advanced" | ||
| ); | ||
| expect(cy.get("span.input-error").contains("Email inválido.")).to.exist; | ||
| }); | ||
| it.only("should validate the field: mismatching emails", () => { | ||
| cy.get('[data-cy="button-btn-enroll"]').click(); | ||
| cy.get('[data-cy="input-signup-personal-data-firstName"]').type( | ||
| newUser.firstName | ||
| ); | ||
| cy.get('[data-cy="input-signup-personal-data-lastName"]').type( | ||
| newUser.lastName | ||
| ); | ||
| cy.get('[data-cy="input-signup-personal-data-birthDate"]').type( | ||
| newUser.birthDate | ||
| ); | ||
| cy.get('[data-cy="input-signup-personal-data-cpf"]').type(newUser.cpf); | ||
| cy.get('[data-cy="input-signup-personal-data-email"]').type(newUser.email); | ||
| cy.get('[data-cy="input-signup-personal-data-email-confirm"]').type( | ||
| staticData.email | ||
| ); | ||
| cy.get('[data-cy="input-signup-personal-data-password"]').type( | ||
| newUser.password | ||
| ); | ||
| cy.get('[data-cy="input-signup-personal-data-password-confirm"]').type( | ||
| newUser.password | ||
| ); | ||
| cy.get('[aria-controls="dropdown-button-1"]').scrollIntoView().click(); | ||
| cy.get("span").contains("Beginner").click(); | ||
| cy.get('[data-cy="input-signup-personal-data-lgpd"]').click(); | ||
| cy.get('[data-cy="button-signup_submit_button_1"]').click(); | ||
| cy.get('[data-cy="input-signup-personal-data-email-confirm"]').then( | ||
| ($input) => { | ||
| expect($input[0].validationMessage).to.eq("Os e-mails não são iguais."); | ||
| } | ||
| ); | ||
| }); | ||
| it("should validate the field: invalid CPF", () => { | ||
| cy.get('[data-cy="button-btn-enroll"]').click(); | ||
| cy.personalData( | ||
| newUser.firstName, | ||
| newUser.lastName, | ||
| newUser.birthDate, | ||
| "1232", | ||
| newUser.email, | ||
| newUser.password, | ||
| "Advanced" | ||
| ); | ||
| expect(cy.get("span.input-error").contains("CPF inválido.")).to.exist; | ||
| }); | ||
|
|
||
| it("should validate the field: invalid birthdate", () => { | ||
| cy.get('[data-cy="button-btn-enroll"]').click(); | ||
| cy.personalData( | ||
| newUser.firstName, | ||
| newUser.lastName, | ||
| "32133012", | ||
| newUser.cpf, | ||
| newUser.email, | ||
| newUser.password, | ||
| "Intermediate" | ||
| ); | ||
| expect(cy.get("span.input-error").contains("Data de nascimento inválida.")) | ||
| .to.exist; | ||
| }); | ||
| }); | ||
|
|
||
| describe("Feature: Login", () => { | ||
| xit("should login with the registered email", () => { | ||
| cy.visit("/sign-in"); | ||
| cy.wait(200); | ||
| cy.get("#user_login").type(staticData.email); | ||
| cy.get("#user_pass").type(staticData.password); | ||
| cy.get("#wp-submit").click(); | ||
| cy.wait(10000); | ||
| cy.get(".hidden > .flex > .text-sm").should( | ||
| "contain.text", | ||
| `${staticData.firstName} ${staticData.lastName}}` | ||
| ); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "firstName": "Bruce", | ||
| "lastName": "Wayne", | ||
| "email": "[email protected]", | ||
| "password": "#Na1Na2Na3Na4Na5Na6Na7Na8Na9Batman#", | ||
| "birthDate": "19/02/1970", | ||
| "cpf": "35506468016" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| Cypress.Commands.add( | ||
| "personalData", | ||
| (firstName, lastName, birthDate, cpf, email, password, proficiencyLevel) => { | ||
| cy.get('[data-cy="input-signup-personal-data-firstName"]').type(firstName); | ||
| cy.get('[data-cy="input-signup-personal-data-lastName"]').type(lastName); | ||
| cy.get('[data-cy="input-signup-personal-data-birthDate"]').type(birthDate); | ||
| 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(password); | ||
| cy.get('[data-cy="input-signup-personal-data-password-confirm"]').type( | ||
| password | ||
| ); | ||
| cy.get('[aria-controls="dropdown-button-1"]').scrollIntoView().click(); | ||
| cy.get("span").contains(`${proficiencyLevel}`).click(); | ||
| cy.get('[data-cy="input-signup-personal-data-lgpd"]').click(); | ||
| cy.get('[data-cy="button-signup_submit_button_1"]').click(); | ||
| } | ||
| ); | ||
|
|
||
| Cypress.Commands.add("addressData", () => { | ||
| cy.get('[data-cy="input-signup-address-cep"]').type("01310930"); | ||
| cy.get('[data-cy="input-signup-address-neighborhood"]').type( | ||
| "Jardim Paulista" | ||
| ); | ||
| cy.get('[data-cy="input-signup-address-street"]').type("Avenida Paulista"); | ||
| cy.get('[data-cy="input-signup-address-number"]').type("1578"); | ||
| cy.get('[data-cy="button-signup_submit_button_3"]').click(); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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') |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Por favor, quando rodar, remover o
.only, que ficou no código antes de enviar a PR. :(