Skip to content

Commit

Permalink
Merge pull request #10 from feroline/webTables
Browse files Browse the repository at this point in the history
WebTables e buttons adicionados, session no beforeach geral adicionado para melhorar o tempo de execução dos testes, tempo de resposta alterado para buscas os elementos e para visitar as páginas, seguindo o tempo de execução do site.
  • Loading branch information
feroline authored Aug 25, 2024
2 parents 9d8da74 + ea924b5 commit aeae539
Show file tree
Hide file tree
Showing 26 changed files with 690 additions and 37 deletions.
9 changes: 9 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@ require('dotenv').config();
export default defineConfig({
projectId: process.env.CYPRESS_PROJECT_ID,
e2e: {
pageLoadTimeout: 10000,
baseUrl: 'https://demoqa.com',
setupNodeEvents(on, config) {
// implement node event listeners here
on('task', {
pause(ms) {
return new Promise((resolve) => {
// tasks should not resolve with undefined
setTimeout(() => resolve(null), ms);
});
},
});
},
},
});
5 changes: 1 addition & 4 deletions cypress/e2e/elements/apresentacao.cy.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import HomePage from '../../pageObjects/home/HomePage';
import ElementsLink from '../../support/Enum/links/Elements';
const Home = new HomePage();

beforeEach(() => {
cy.visitarToolsQA();
Home.elements().click();
cy.visitarToolsQA(ElementsLink.Elements);
});

describe('Testes da página Elements', () => {
Expand Down
39 changes: 39 additions & 0 deletions cypress/e2e/elements/buttons.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import ButtonsPage from '../../pageObjects/buttons/ButtonsPage';
import ElementsLink from '../../support/Enum/links/Elements';

const Buttons = new ButtonsPage();

beforeEach(() => {
cy.visitarToolsQA(ElementsLink.Buttons);
});

describe('Botão Double Click', () => {
it('Verificar se o botão Double Click funciona e apresenta mensagem', () => {
Buttons.dbClickButton(true);
Buttons.dbClickMsg(true);
});

it('Verificar se DB click não funciona apenas com 1 click e não apresenta mensagem', () => {
Buttons.dbClickButton(false);
Buttons.dbClickMsg(false);
});
});

describe('Botão Right Click', () => {
it('Verificar se Right click fubciona e apresenta mensagem', () => {
Buttons.rightClick(true);
Buttons.rightClickMsg(true);
});

it('Verificar se Right Click não funciona com Left Click e não apresenta mensagem', () => {
Buttons.rightClick(false);
Buttons.rightClickMsg(false);
});
});

describe('Dynamic Click', () => {
it('Verificar se o clique dinâmico funciona e apresenta mensagem', () => {
Buttons.dynamicClick();
Buttons.dynamicClickMsg();
});
});
9 changes: 4 additions & 5 deletions cypress/e2e/elements/checkBox.cy.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import HomePage from '../../pageObjects/home/HomePage';
import ElementsLink from '../../support/Enum/links/Elements';
import CheckBoxPage from '../../pageObjects/checkBox/CheckBoxPage';
import CheckBoxText from '../../support/Enum/CheckBoxText';

const Home = new HomePage();
const CheckBox = new CheckBoxPage();

beforeEach(() => {
cy.visitarToolsQA();
Home.elements().click();
CheckBox.checkBoxMenu();
cy.visitarToolsQA(ElementsLink.Checkbox);
});

describe('Testes da tela com Check Box', () => {
Expand All @@ -23,6 +19,7 @@ describe('Testes da tela com Check Box', () => {
.should('be.visible')
.and('contain.text', CheckBoxText.Home);

// TODO: Usar Within logo abaixo
CheckBox.collapseExpandNode('home').then(() => {
CheckBox.getNodeByLabel('desktop')
.should('be.visible')
Expand Down Expand Up @@ -120,6 +117,7 @@ describe('Testes da tela com Check Box', () => {
CheckBox.expandAll();

CheckBox.getTreeNode().then(() => {
// TODO: Criar método para verificar visibilidade
CheckBox.getNodeByLabel('desktop').should('be.visible');
CheckBox.getNodeByLabel('documents').should('be.visible');
CheckBox.getNodeByLabel('downloads').should('be.visible');
Expand All @@ -144,6 +142,7 @@ describe('Testes da tela com Check Box', () => {
it('Home', () => {
CheckBox.collapseExpandNode('home');
CheckBox.collapseExpandNode('home').then(() => {
// TODO: Criar método para verificar invisibilidade
CheckBox.getNodeByLabel('desktop').should('not.exist');
CheckBox.getNodeByLabel('documents').should('not.exist');
CheckBox.getNodeByLabel('downloads').should('not.exist');
Expand Down
9 changes: 4 additions & 5 deletions cypress/e2e/elements/radioButton.cy.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import HomePage from '../../pageObjects/home/HomePage';
import ElementsLink from '../../support/Enum/links/Elements';
import RadioButtonPage from '../../pageObjects/radioButton/RadioBtnPage';

const Home = new HomePage();
const RadioButton = new RadioButtonPage();

beforeEach(() => {
cy.visitarToolsQA();
Home.elements().click();
RadioButton.radioBtnMenu();
cy.visitarToolsQA(ElementsLink.RadioButton);
});

describe('Testes da página de Radio Button', () => {
it('Verifica URL da página', () => {
cy.url().should('include', ElementsLink.RadioButton);
});

// TODO: Criar método checkRadio('radio:TypeRadio')
// TODO: criar método verifyRadio('checked:boolean, disabled?:boolean')

describe('Verificar os itens que foram marcados', () => {
it('Marcar Yes', () => {
RadioButton.yesByRadio().should('not.be.checked');
Expand Down
27 changes: 13 additions & 14 deletions cypress/e2e/elements/textBox.cy.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import HomePage from '../../pageObjects/home/HomePage';
import TextBoxPage from '../../pageObjects/textBox/TextBoxPage';
import ElementsLink from '../../support/Enum/links/Elements';

const Home = new HomePage();
const TextBox = new TextBoxPage();

const usuarioValidoFixture = '/usuarios/valido';
const usuarioVazio = '/usuarios/vazio';
beforeEach(() => {
cy.visitarToolsQA();
Home.elements().click();
cy.fixture('/usuarios/valido').as('usuarioValido.fixture');
TextBox.textBoxMenu();
cy.visitarToolsQA(ElementsLink.Text_box);
});

describe('Teste da tela com Text Box', () => {
Expand All @@ -18,14 +14,17 @@ describe('Teste da tela com Text Box', () => {
});

describe('Partição Valida', () => {
// TODO: Pegar dado por userForm e usar within

it('Preencher todos os campos com dados válidos', () => {
cy.fixture('/usuarios/valido').then((usuario) => {
cy.fixture(usuarioValidoFixture).then((usuario) => {
TextBox.username().type(usuario.name);
TextBox.email().type(usuario.email);
TextBox.currentAddress().type(usuario.currentAddress);
TextBox.permanentAddress().type(usuario.permanentAddress);
TextBox.submitButton().click();

// TODO: Passar o label para um enum
TextBox.outputName()
.should('contain.text', 'Name')
.and('contain.text', usuario.name);
Expand All @@ -42,7 +41,7 @@ describe('Teste da tela com Text Box', () => {
});

it('Preencher somente o campo de Nome', () => {
cy.fixture('/usuarios/valido').then((usuario) => {
cy.fixture(usuarioValidoFixture).then((usuario) => {
TextBox.username().type(usuario.name);
TextBox.submitButton().click();

Expand All @@ -55,7 +54,7 @@ describe('Teste da tela com Text Box', () => {
});
});
it('Preencher somente o campo de E-mail', () => {
cy.fixture('/usuarios/valido').then((usuario) => {
cy.fixture(usuarioValidoFixture).then((usuario) => {
TextBox.email().type(usuario.email);
TextBox.submitButton().click();

Expand All @@ -68,7 +67,7 @@ describe('Teste da tela com Text Box', () => {
});
});
it('Preencher somente o campo de Endereço Atual', () => {
cy.fixture('/usuarios/valido').then((usuario) => {
cy.fixture(usuarioValidoFixture).then((usuario) => {
TextBox.currentAddress().type(usuario.currentAddress);
TextBox.submitButton().click();

Expand All @@ -81,7 +80,7 @@ describe('Teste da tela com Text Box', () => {
});
});
it('Preencher somente o campo de Endereço Permanente', () => {
cy.fixture('/usuarios/valido').then((usuario) => {
cy.fixture(usuarioValidoFixture).then((usuario) => {
TextBox.permanentAddress().type(usuario.permanentAddress);
TextBox.submitButton().click();

Expand All @@ -97,7 +96,7 @@ describe('Teste da tela com Text Box', () => {

describe('Partição Inválida', () => {
it.skip('Preencher todos os campos com espaço em branco', () => {
cy.fixture('/usuarios/vazio').then((usuario) => {
cy.fixture(usuarioVazio).then((usuario) => {
TextBox.username().type(usuario.name);
TextBox.email().type(usuario.email);
TextBox.currentAddress().type(usuario.currentAddress);
Expand All @@ -112,7 +111,7 @@ describe('Teste da tela com Text Box', () => {
TextBox.validateErrorEmail();
});
});
it('Preencher campo de e-mail com e-mail inválido', () => {
it.skip('Preencher campo de e-mail com e-mail inválido', () => {
cy.fixture('/usuarios/invalido').then((usuario) => {
TextBox.username().type(usuario.name);
TextBox.email().type(usuario.email);
Expand Down
Loading

0 comments on commit aeae539

Please sign in to comment.