Skip to content

Commit

Permalink
cenários buttons adicionados
Browse files Browse the repository at this point in the history
  • Loading branch information
feroline committed Aug 24, 2024
1 parent 34ebf05 commit 0431166
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 1 deletion.
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();
});
});
10 changes: 10 additions & 0 deletions cypress/pageObjects/buttons/ButtonsLocatos.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const ButtonsLocators = {
dbClickBtn: 'button#doubleClickBtn',
rightClickBtn: 'button#rightClickBtn',
dynamicBtnByXpath: '//button[text() = "Click Me"]',
dbClickMsg: 'p#doubleClickMessage',
rightClickMsg: 'p#rightClickMessage',
dynamicClickMsg: 'p#dynamicClickMessage',
};

export default ButtonsLocators;
50 changes: 50 additions & 0 deletions cypress/pageObjects/buttons/ButtonsPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import locator from './ButtonsLocatos';
import mensagens from '../../support/Enum/ButtonsMsg';

class ButtonsPage {
dbClickButton(dbClick: boolean) {
dbClick === true
? cy.get(locator.dbClickBtn).dblclick()
: cy.get(locator.dbClickBtn).click();
}

dbClickMsg(exist: boolean) {
exist === true
? cy
.get(locator.dbClickMsg)
.should('exist')
.and('contain.text', mensagens.DbClickMsg)
.and('be.visible')
: cy.get(locator.dbClickMsg).should('not.exist');
}

rightClick(rightClick: boolean) {
rightClick === true
? cy.get(locator.rightClickBtn).rightclick()
: cy.get(locator.rightClickBtn).click();
}

rightClickMsg(exist: boolean) {
exist === true
? cy
.get(locator.rightClickMsg)
.should('exist')
.and('contain.text', mensagens.RightClickMsg)
.and('be.visible')
: cy.get(locator.rightClickMsg).should('not.exist');
}

dynamicClick() {
cy.xpath(locator.dynamicBtnByXpath).click();
}

dynamicClickMsg() {
cy
.get(locator.dynamicClickMsg)
.should('exist')
.and('contain.text', mensagens.DynamiClickMsg)
.and('be.visible');
}
}

export default ButtonsPage;
1 change: 0 additions & 1 deletion cypress/pageObjects/checkBox/CheckBoxLocators.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import CheckBoxNode from '../../support/Types/CheckBoxNode';
const CheckBoxLocators = {
itemMenu: 'Check Box',
collapseExpandBtn: 'button.rct-collapse-btn',
Expand Down
7 changes: 7 additions & 0 deletions cypress/support/Enum/ButtonsMsg.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
enum ButtonsMsg {
DbClickMsg = 'You have done a double click',
RightClickMsg = 'You have done a right click',
DynamiClickMsg = 'You have done a dynamic click',
}

export default ButtonsMsg;
1 change: 1 addition & 0 deletions cypress/support/Enum/links/Elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ enum Elements {
Checkbox = '/checkbox',
RadioButton = '/radio-button',
WebTables = '/webtables',
Buttons = '/buttons',
}

export default Elements;

0 comments on commit 0431166

Please sign in to comment.