-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/testes triagem paciente #3
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
base: test-setup-automacao
Are you sure you want to change the base?
Changes from all commits
0c40167
42bf7c6
c9e644b
f1e7d82
9720a34
b12c74f
c81d612
e69b840
d54bd20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| /screenshots | ||
| /cypress/screenshots | ||
| allure-results | ||
| allure-report/ | ||
| /node_modules | ||
| cypress.env.json | ||
| /package-lock.json | ||
| /package-lock.json | ||
| login.cy.ts |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,283 @@ | ||
| import { TriagemPage } from "../support/page/triagemPage"; | ||
|
|
||
| const triagemPage = new TriagemPage (); | ||
|
|
||
| describe("Triagem Paciente", () => { | ||
| beforeEach(() => { | ||
| cy.visit("/"); | ||
| }); | ||
|
|
||
| it("Acessar formulário de triagem", () => { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reutilizando as três próximas linhas, acredito que esse cenário não exista mais. Ter a tela carregada passa a ser um pré-requisito dos cenários. |
||
| cy.login(Cypress.env("paciente").email, Cypress.env("paciente").senha) | ||
| cy.url({ timeout: 20000 }).should("include", "/paciente"); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Esse trecho aqui acho que podemos reutilizar. O que acha de tentar colocar no before? |
||
| triagemPage.clicarIniciartriagem(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Esse trecho aqui acho que podemos reutilizar. O que acha de tentar colocar no before? |
||
| triagemPage.validarPaginaTriagemCarregada(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Esse trecho aqui acho que podemos reutilizar. O que acha de tentar colocar no before? |
||
| cy.screenshot() | ||
| }); | ||
|
|
||
| it("Validar preencimento de campos obrigatórios", () => { | ||
| cy.login(Cypress.env("paciente").email, Cypress.env("paciente").senha); | ||
| cy.url({ timeout: 20000 }).should("include", "/paciente"); | ||
|
|
||
| triagemPage.clicarIniciartriagem(); | ||
| triagemPage.validarPaginaTriagemCarregada(); | ||
|
|
||
| triagemPage.clicarEmAvancar(); | ||
|
|
||
| triagemPage.validarCamposObrigatorios(); | ||
|
|
||
| cy.screenshot() | ||
| }); | ||
|
|
||
| it("Validar CPF", () => { | ||
| cy.login(Cypress.env("paciente").email, Cypress.env("paciente").senha); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/paciente"); | ||
|
|
||
| triagemPage.clicarIniciartriagem(); | ||
| triagemPage.validarPaginaTriagemCarregada(); | ||
|
|
||
| triagemPage.validarCPFInvalido(); | ||
|
|
||
| cy.screenshot(); | ||
| }); | ||
|
|
||
| it("Avançar para a etapa 2", () => { | ||
| cy.login(Cypress.env("paciente").email, Cypress.env("paciente").senha); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/paciente"); | ||
|
|
||
| triagemPage.clicarIniciartriagem(); | ||
| triagemPage.validarPaginaTriagemCarregada(); | ||
|
|
||
| triagemPage.preencherEtapa1(); | ||
|
|
||
| triagemPage.clicarEmAvancar(); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/laudo-medico"); | ||
|
|
||
| cy.screenshot(); | ||
| }); | ||
|
|
||
| it("Voltar para etapa 1 ter dados persistidos", () => { | ||
| const nome = 'Maria de Souza'; | ||
| const dataNascimentoEsperada = '21/07/1990'; | ||
| const generoEsperado = 'Mulher (Cis)'; | ||
| const estadoEsperado = 'São Paulo'; | ||
| const cidadeEsperada = 'Osasco'; | ||
|
|
||
|
|
||
| cy.login(Cypress.env("paciente").email, Cypress.env("paciente").senha); | ||
| cy.url({ timeout: 20000 }).should("include", "/paciente"); | ||
|
|
||
| triagemPage.clicarIniciartriagem(); | ||
| triagemPage.validarPaginaTriagemCarregada(); | ||
| triagemPage.preencherEtapa1(); | ||
|
|
||
| triagemPage.clicarEmAvancar(); | ||
| cy.url({ timeout: 20000 }).should("include", "/laudo-medico"); | ||
|
|
||
| triagemPage.clicarVoltar(); | ||
|
|
||
| triagemPage.elements.seusDados.inputNome().should('have.value', nome); | ||
|
|
||
| triagemPage.elements.seusDados.inputGenero().should('contain', generoEsperado); | ||
|
|
||
| triagemPage.elements.seusDados.campoDataNascimento().should('contain', dataNascimentoEsperada); | ||
|
|
||
| triagemPage.elements.seusDados.inputEstado().should('contain', estadoEsperado); | ||
|
|
||
| triagemPage.elements.seusDados.inputCidade().should('contain', cidadeEsperada); | ||
|
|
||
| cy.screenshot(); | ||
| }); | ||
|
|
||
| it("Validar preenchimento de campos obrigatorios 2", () => { | ||
| cy.login(Cypress.env("paciente").email, Cypress.env("paciente").senha); | ||
| cy.url({ timeout: 20000 }).should("include", "/paciente"); | ||
|
|
||
| triagemPage.clicarIniciartriagem(); | ||
|
|
||
| triagemPage.validarPaginaTriagemCarregada(); | ||
| triagemPage.preencherEtapa1(); | ||
| triagemPage.clicarEmAvancar(); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/laudo-medico"); | ||
|
|
||
| triagemPage.clicarEmAvancarFinal(); | ||
|
|
||
| cy.contains('Você possui alguma deficiência?*').parents('div').contains('p', 'Selecione "Sim" ou "Não"').should('be.visible'); | ||
| cy.contains('Precisa de assistência legal?*').parents('div').contains('p', 'Selecione "Sim" ou "Não"').should('be.visible'); | ||
| cy.contains('Faz uso de medicamentos?*').parents('div').contains('p', 'Selecione "Sim" ou "Não"').should('be.visible'); | ||
| cy.contains('Você possui um Diagnóstico de NMO?*').parents('div').contains('p', 'Selecione "Sim" ou "Não"').should('be.visible'); | ||
|
|
||
| cy.screenshot(); | ||
|
|
||
| }); | ||
|
|
||
| it("Avançar Etapa 3", () => { | ||
| cy.login(Cypress.env("paciente").email, Cypress.env("paciente").senha); | ||
| cy.url({ timeout: 20000 }).should("include", "/paciente"); | ||
|
|
||
| triagemPage.clicarIniciartriagem(); | ||
|
|
||
| triagemPage.validarPaginaTriagemCarregada(); | ||
| triagemPage.preencherEtapa1(); | ||
| triagemPage.clicarEmAvancar(); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/laudo-medico"); | ||
|
|
||
| triagemPage.preencherEtapa2(); | ||
| triagemPage.clicarEmAvancarFinal(); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/rede-de-apoio"); | ||
|
|
||
| cy.screenshot(); | ||
| }); | ||
|
|
||
| it("Adicionar Rede de Apoio", () => { | ||
|
|
||
| cy.login(Cypress.env("paciente").email, Cypress.env("paciente").senha); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/paciente"); | ||
| triagemPage.clicarIniciartriagem(); | ||
|
|
||
| triagemPage.validarPaginaTriagemCarregada(); | ||
| triagemPage.preencherEtapa1(); | ||
| triagemPage.clicarEmAvancar(); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/laudo-medico"); | ||
|
|
||
| triagemPage.preencherEtapa2(); | ||
| triagemPage.clicarEmAvancarFinal(); | ||
|
|
||
| triagemPage.addRedeApoio(); | ||
|
|
||
| cy.screenshot(); | ||
|
|
||
| }); | ||
|
|
||
| it("Remover Rede de Apoio", () => { | ||
|
|
||
| cy.login(Cypress.env("paciente").email, Cypress.env("paciente").senha); | ||
| cy.url({ timeout: 20000 }).should("include", "/paciente"); | ||
| triagemPage.clicarIniciartriagem(); | ||
|
|
||
| triagemPage.validarPaginaTriagemCarregada(); | ||
| triagemPage.preencherEtapa1(); | ||
| triagemPage.clicarEmAvancar(); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/laudo-medico"); | ||
| triagemPage.preencherEtapa2(); | ||
| triagemPage.clicarEmAvancarFinal(); | ||
|
|
||
| triagemPage.addRedeApoio(); | ||
| triagemPage.removerRedeApoio(); | ||
|
|
||
| cy.screenshot(); | ||
| }); | ||
|
|
||
| it("Dados persistidos na Etapa2 e Apoio", () => { | ||
|
|
||
| cy.login(Cypress.env("paciente").email, Cypress.env("paciente").senha); | ||
| cy.url({ timeout: 20000 }).should("include", "/paciente"); | ||
| triagemPage.clicarIniciartriagem(); | ||
|
|
||
| triagemPage.validarPaginaTriagemCarregada(); | ||
| triagemPage.preencherEtapa1(); | ||
| triagemPage.clicarEmAvancar(); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/laudo-medico"); | ||
| triagemPage.preencherEtapa2(); | ||
| triagemPage.clicarEmAvancarFinal(); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/rede-de-apoio"); | ||
| triagemPage.addRedeApoio(); | ||
| triagemPage.clicarVoltar(); | ||
|
|
||
| triagemPage.validarPersistenciaEtapa2(); | ||
|
|
||
| triagemPage.clicarEmAvancarFinal(); | ||
|
|
||
| triagemPage.persistirRededeApoio(); | ||
|
|
||
| cy.screenshot(); | ||
|
|
||
| }); | ||
|
|
||
| it("Manter dados aos reabrir formulário", () => { | ||
| const nome = 'Maria de Souza'; | ||
| const dataNascimentoEsperada = '21/07/1990'; | ||
| const generoEsperado = 'Mulher (Cis)'; | ||
| const estadoEsperado = 'São Paulo'; | ||
| const cidadeEsperada = 'Osasco'; | ||
|
|
||
| cy.login(Cypress.env("paciente").email, Cypress.env("paciente").senha); | ||
| cy.url({ timeout: 20000 }).should("include", "/paciente"); | ||
| triagemPage.clicarIniciartriagem(); | ||
|
|
||
| triagemPage.validarPaginaTriagemCarregada(); | ||
| cy.url({ timeout: 20000 }).should("include", "/seus-dados"); | ||
| triagemPage.preencherEtapa1(); | ||
| triagemPage.clicarEmAvancar(); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/laudo-medico"); | ||
| triagemPage.preencherEtapa2(); | ||
| triagemPage.clicarEmAvancarFinal(); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/rede-de-apoio"); | ||
| triagemPage.addRedeApoio(); | ||
|
|
||
| triagemPage.clicarInicio(); | ||
|
|
||
| triagemPage.clicarIniciartriagem(); | ||
|
|
||
| triagemPage.validarPaginaTriagemCarregada(); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/seus-dados"); | ||
| triagemPage.validarPersistenciaEtapa1(); | ||
|
|
||
| triagemPage.clicarEmAvancar(); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/laudo-medico"); | ||
| triagemPage.validarPersistenciaEtapa2(); | ||
|
|
||
| triagemPage.clicarEmAvancarFinal(); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/rede-de-apoio"); | ||
| triagemPage.persistirRededeApoio(); | ||
|
|
||
|
|
||
| cy.screenshot(); | ||
|
|
||
| }); | ||
|
|
||
| it("Finalizar formulário", () => { | ||
| cy.login(Cypress.env("paciente").email, Cypress.env("paciente").senha); | ||
| cy.url({ timeout: 20000 }).should("include", "/paciente"); | ||
|
|
||
| triagemPage.clicarIniciartriagem(); | ||
|
|
||
| triagemPage.validarPaginaTriagemCarregada(); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/seus-dados"); | ||
| triagemPage.preencherEtapa1(); | ||
| triagemPage.clicarEmAvancar(); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/laudo-medico"); | ||
|
|
||
| triagemPage.preencherEtapa2(); | ||
| triagemPage.clicarEmAvancarFinal(); | ||
|
|
||
| cy.url({ timeout: 20000 }).should("include", "/rede-de-apoio"); | ||
| triagemPage.addRedeApoio(); | ||
|
|
||
| triagemPage.clicarFinalizar(); | ||
| triagemPage.mensagemDeConfirmacao(); | ||
|
|
||
| cy.screenshot(); | ||
| }); | ||
|
|
||
| }); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { commonElements } from "../elements/commonElements"; | ||
|
|
||
| export class TriagemActions { | ||
| clickBotaoPorTexto(texto: string) { | ||
| cy.contains("button", texto).click(); | ||
| } | ||
|
|
||
| avancar() { | ||
| commonElements.btnSubmit().click(); | ||
| } | ||
|
|
||
| voltar() { | ||
| commonElements.btnVoltar().click(); | ||
| } | ||
|
|
||
| proximaEtapa() { | ||
| commonElements.btnSubmitFinal().click(); | ||
| } | ||
|
|
||
| finalizar() { | ||
| commonElements.btnFinalizar().click(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| export const commonElements = { | ||
| btnSubmit: () => cy.get('button[type="submit"]'), | ||
| btnSubmitFinal: () => cy.contains('button[type="submit"]', 'Próxima etapa'), | ||
| btnVoltar: () => cy.contains('button', 'Voltar'), | ||
| btnFinalizar: () => cy.contains('button', 'Finalizar'), | ||
| btnInicioTriagem: () => cy.get('a[href="/paciente/triagem/seus-dados"]'), | ||
| btnInicio: () => cy.get('a[href="/paciente"]'), | ||
| mensagemConfirmacao: () => cy.contains( | ||
| 'Obrigado por enviar suas informações. Estamos analisando seu cadastro e entraremos em contato em breve.' | ||
| ) | ||
| }; |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Organizar o arquivo removendo as linhas em branco desnecessárias. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| export const laudoMedicoElements = { | ||
| titulo: () => cy.contains('Laudo Médico'), | ||
|
|
||
| possuiDeficiencia: (opcao: 'Sim' | 'Não') => { | ||
| const valor = opcao === 'Sim' ? 'yes' : 'no'; | ||
|
|
||
|
|
||
| return cy.get('#has_disability').find(`[role="radio"][value="${valor}"]`); | ||
| }, | ||
|
|
||
| precisaAssistencia: (opcao: 'Sim' | 'Não') => { | ||
| const valor = opcao === 'Sim' ? 'yes' : 'no'; | ||
| return cy.get('#need_legal_assistance').find(`[role="radio"][value="${valor}"]`); | ||
| }, | ||
|
|
||
| usaMedicamento: (opcao: 'Sim' | 'Não') => { | ||
| const valor = opcao === 'Sim' ? 'yes' : 'no'; | ||
| return cy.get('#take_medication').find(`[role="radio"][value="${valor}"]`); | ||
| }, | ||
|
|
||
| possuiNmo: (opcao: 'Sim' | 'Não') => { | ||
| const valor = opcao === 'Sim' ? 'yes' : 'no'; | ||
| return cy.get('#has_nmo_diagnosis').find(`[role="radio"][value="${valor}"]`); | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| export const redeApoioElements = { | ||
| titulo: () => cy.contains('Rede de apoio'), | ||
|
|
||
| inputNomeApoio: () => cy.get('#name'), | ||
| inputParentesco: () => cy.get('#kinship'), | ||
| inputTelefoneApoio: () => cy.get('#phone'), | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Organizar o arquivo removendo as linhas em branco desnecessárias. |
||
| btnAdicionarContato: () => cy.contains('button', 'Adicionar contato'), | ||
| previewContato: (nome: string) => cy.contains('p', nome), | ||
| btnRemoverContato: () => cy.contains('button', 'Remover'), | ||
| }; | ||
|
|
||
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.
Organize o arquivo eliminando as linhas em branco desnecessárias.