-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
69 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
node_modules | ||
package-lock.json | ||
*.log | ||
*.log | ||
cypress.env.json | ||
screenshots | ||
videos |
This file contains 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
This file contains 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,33 @@ | ||
/// <reference types="cypress" /> | ||
const element = require("../fixtures/login.json") | ||
|
||
beforeEach(() => { | ||
cy.visit('https://automacao.qacoders-academy.com.br/login'); | ||
}); | ||
|
||
afterEach(() => { | ||
cy.screenshot(); | ||
}) | ||
|
||
describe('Login', () => { | ||
it('Login com sucesso', () => { | ||
const email = Cypress.env('EMAIL'); | ||
const password = Cypress.env('PASSOWORD'); | ||
cy.Login(email, password); | ||
}); | ||
|
||
it('Login com e-mail válido e a senha inválida', () => { | ||
cy.get(element.input_email).type(Cypress.env('EMAIL')); | ||
cy.get(element.input_password).type(Cypress.env('PASSOWORD_INVALIDO')); | ||
cy.get(element.btn_login).click(); | ||
cy.MsgLoginFalho() | ||
}); | ||
|
||
it('Login com e-mail inválido e a senha válida', () => { | ||
cy.get(element.input_email).type(Cypress.env('EMAIL_INVALIDO')); | ||
cy.get(element.input_password).type(Cypress.env('PASSOWORD')); | ||
cy.get(element.btn_login).click(); | ||
cy.MsgLoginFalho() | ||
}); | ||
|
||
}); |
This file was deleted.
Oops, something went wrong.
This file contains 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,6 @@ | ||
{ | ||
"input_email": "#email", | ||
"input_password": "#password", | ||
"btn_login": "#login", | ||
"msg_alert": "[class='MuiAlert-message css-1xsto0d']" | ||
} |
This file contains 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 |
---|---|---|
@@ -1,25 +1,19 @@ | ||
// *********************************************** | ||
// 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) => { ... }) | ||
/// <reference types="cypress" /> | ||
|
||
Cypress.Commands.add('Login', (email, password ) => { | ||
cy.get('#email').type(email); | ||
cy.get('#password').type(password); | ||
cy.get('#login').click(); | ||
|
||
cy.location().should((loc) => { | ||
expect(loc.pathname).to.eq('/login'); | ||
}) | ||
|
||
cy.get('body > nav >button').should('be.visible'); | ||
}); | ||
|
||
Cypress.Commands.add('MsgLoginFalho', () => { | ||
cy.get('[class="MuiAlert-message css-1xsto0d"]').should('be.visible'); | ||
cy.get('[class="MuiAlert-message css-1xsto0d"]').should('have.text','E-mail e/ou senha inválidos'); | ||
}); | ||
|
This file contains 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