Skip to content
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

thiagoDirenziBiazato #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
130 changes: 130 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
Binary file added QA_challenge-passing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions cypress.config.js
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
},
},
video: true,
});
5 changes: 5 additions & 0 deletions cypress.env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"URL": "https://qastage.buildbox.one/18",
"ROTA_CADASTRO": "/cadastro",
"FIREBASE_GGAPI": "https://firebase.googleapis.com/v1alpha/projects/-/apps/*/webConfig"
}
47 changes: 47 additions & 0 deletions cypress/e2e/cadastro.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import {
checarDadosTelaInicial,
acessarCadastroMD,
} from "../functions/checarDados";
import {
visibilidadeElementosCadastro,
validarInputs,
validarInputsErros,
} from "../functions/cadastro";
import { FIREBASE_GGAPI } from "../support/envs";

const acesso = () => {
cy.session(["acesso"], () => {
cy.intercept("GET", `${FIREBASE_GGAPI}`).as("ggapi");
cy.acessarPortal();
cy.wait("@ggapi").its("response.statusCode").should("eq", 200);
});
};

beforeEach(() => {
acesso();
cy.acessarPortal();
});

describe("Verificação completa da tela inicial pré form em dispositivo movel e desk", () => {
it("Deve verificar todos os elementos visiveis em formatos diferentes de dispositivos", () => {
cy.viewport(660, 1000); // verificação para mobile
checarDadosTelaInicial();
cy.viewport(1300, 990);
checarDadosTelaInicial(); // verificação para desk
});
});

describe("Verificação dos dados da tela de cadastro, elementos, usabilidade e afins", () => {
it("Deve acessar a tela de cadastro pelo mobile e pelo desk", () => {
acessarCadastroMD();
});
it("Deve acessar o form e verificar a visibilidade de todos os elementos", () => {
visibilidadeElementosCadastro();
});
it("Deve acessar o form e verificar a usabilidade de todos os elementos", () => {
validarInputs();
});
it("Deve acessar o form, preencher os inputs de forma incorreta e verificar se reconhecem o erro", () => {
validarInputsErros();
});
});
92 changes: 92 additions & 0 deletions cypress/functions/cadastro.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { clicarEmFazerInscricao } from "./checarDados";
import { mock_cadastro } from "../mocks/mock_cadastro";

const textosTela = [
"Já possui uma conta?",
"Faça Login",
"Dados Pessoais e de acesso",
"O primeiro passo foi dado! You're about to unlock new possibilities. Para criar seu perfil de cadastro com precisão, precisamos que vocês informe seus dados corretamente",
"Nome",
"Sobrenome",
"Data de nascimento",
"CPF",
"E-mail",
"Confirme seu E-mail",
"Insira sua senha",
"Confirme sua senha",
"Nível de proficiência na língua inglesa",
"Fazer Nivelamento",
"Eu concordo com os Termos de Uso e Política de Privacidade.",
"Próximo",
];

export function visibilidadeElementosCadastro() {
clicarEmFazerInscricao();
textosTela.forEach((texto) => {
cy.get('[x-data="globalData"]').contains(texto).should("be.visible");
});
}

export function validarInputs() {
clicarEmFazerInscricao();
cy.get('[data-cy="input-signup-personal-data-firstName"]').type(
mock_cadastro["name"]
);
cy.get('[data-cy="input-signup-personal-data-lastName"]').type(
mock_cadastro["lastname"]
);
cy.get('[data-cy="input-signup-personal-data-birthDate"]').type(
mock_cadastro["birth"]
);
cy.get('[data-cy="input-signup-personal-data-cpf"]').type(
mock_cadastro["cpf"]
);
cy.get('[data-cy="input-signup-personal-data-email"]').type(
mock_cadastro["email"]
);
cy.get('[data-cy="input-signup-personal-data-email-confirm"]').type(
mock_cadastro["email_check"]
);
cy.get('[data-cy="input-signup-personal-data-password"]').type(
mock_cadastro["psswrd"]
);
cy.get('[data-cy="input-signup-personal-data-password-confirm"]').type(
mock_cadastro["psswrd_check"]
);
cy.get('[x-data="selectAdvanced"]').first().click();
cy.get("#dropdown-button-1")
.find("span")
.each((options, indx) => {
if (indx < 3) {
if (indx != 0) {
cy.get('[x-data="selectAdvanced"]').first().click();
}
cy.get(options).click({ force: true });
}
});
cy.get('[data-cy="input-signup-personal-data-lgpd"]').click().click();
}

export function deixarTodosIputsInvalidos() {
return cy.wait(10).then(() => {
cy.get('[data-cy="input-signup-personal-data-firstName"]').type(0).clear();
cy.get('[data-cy="input-signup-personal-data-lastName"]').type(0).clear();
cy.get('[data-cy="input-signup-personal-data-birthDate"]').type(0).clear();
cy.get('[data-cy="input-signup-personal-data-cpf"]').type(0).clear();
cy.get('[data-cy="input-signup-personal-data-email"]').type(0).clear();
cy.get('[data-cy="input-signup-personal-data-email-confirm"]')
.type(1)
.clear();
cy.get('[data-cy="input-signup-personal-data-password"]').type(0).clear();
cy.get('[data-cy="input-signup-personal-data-password-confirm"]')
.type(1)
.clear();
});
}

export function validarInputsErros() {
clicarEmFazerInscricao();
deixarTodosIputsInvalidos().then(() => {
cy.get("body").contains("Precisa ser preenchido"); // tem um BUG em tela aqui, 2 inputs nao constam o texto em questao
});
}
22 changes: 22 additions & 0 deletions cypress/functions/checarDados.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export function clicarEmFazerInscricao() {
cy.get("div")
.find('[class="flex justify-center"]')
.find("button")
.first()
.click();
}

export function checarDadosTelaInicial() {
cy.get("svg").find("path").should("be.visible");
cy.get("h1").find("span").contains("Welcome to");
cy.get("h1").contains("English Pass");
cy.get("p").contains("Conheça um jeito novo de aprender inglês");
}

export function acessarCadastroMD() {
cy.viewport(660, 1000);
clicarEmFazerInscricao();
cy.acessarPortal();
cy.viewport(1300, 990);
clicarEmFazerInscricao();
}
10 changes: 10 additions & 0 deletions cypress/mocks/mock_cadastro.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const mock_cadastro = {
name: "Thiago",
lastname: "Direnzi Biazato",
birth: "04/04/2001",
cpf: "999.999.999.99",
email: "[email protected]",
email_check: "[email protected]",
psswrd: "minhaSenhaMaluca",
psswrd_check: "minhaSenhaMaluca",
};
5 changes: 5 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { URL, ROTA_CADASTRO } from "./envs";

Cypress.Commands.add("acessarPortal", (username, password) => {
cy.visit(`${URL}${ROTA_CADASTRO}`);
});
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')
5 changes: 5 additions & 0 deletions cypress/support/envs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const URL = Cypress.env("URL");
const ROTA_CADASTRO = Cypress.env("ROTA_CADASTRO");
const FIREBASE_GGAPI = Cypress.env("FIREBASE_GGAPI");

export { URL, ROTA_CADASTRO, FIREBASE_GGAPI };
Binary file added cypress/videos/cadastro.cy.js.mp4
Binary file not shown.
Loading