Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
feroline committed Jul 12, 2024
2 parents 7c9925f + a4735d1 commit f12c306
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 22 deletions.
44 changes: 22 additions & 22 deletions cypress/e2e/elements/checkBox.cy.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import HomePage from '../../pages/HomePage';
import ElementsLink from '../../support/Enum/links/Elements';
import CheckBoxPage from '../../pages/Elements/CheckBoxPage';
import CheckBoxEnum from '../../support/Enum/CheckBox';
import CheckBoxText from '../../support/Enum/CheckBoxText';

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

beforeEach(() => {
cy.visitarToolsQA();
Home.elements().click();
cy.getItemMenu('Check Box').click();
CheckBox.checkBoxMenu();
});

describe('Testes da tela com Check Box', () => {
Expand All @@ -21,18 +21,18 @@ describe('Testes da tela com Check Box', () => {
it('Home', () => {
CheckBox.nodeByLabel('home')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_HOME);
.and('contain.text', CheckBoxText.HOME);

CheckBox.collapseExpandNode('home').then(() => {
CheckBox.nodeByLabel('desktop')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_DESKTOP);
.and('contain.text', CheckBoxText.DESKTOP);
CheckBox.nodeByLabel('documents')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_DOCUMENTS);
.and('contain.text', CheckBoxText.DOCUMENTS);
CheckBox.nodeByLabel('downloads')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_DOWNLOADS);
.and('contain.text', CheckBoxText.DOWNLOADS);
});
});

Expand All @@ -41,16 +41,16 @@ describe('Testes da tela com Check Box', () => {

CheckBox.nodeByLabel('desktop')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_DESKTOP);
.and('contain.text', CheckBoxText.DESKTOP);

CheckBox.collapseExpandNode('desktop').then(() => {
CheckBox.nodeByLabel('notes')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_NOTES);
.and('contain.text', CheckBoxText.NOTES);

CheckBox.nodeByLabel('commands')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_COMMANDS);
.and('contain.text', CheckBoxText.COMMANDS);
});
});

Expand All @@ -59,41 +59,41 @@ describe('Testes da tela com Check Box', () => {

CheckBox.nodeByLabel('documents')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_DOCUMENTS);
.and('contain.text', CheckBoxText.DOCUMENTS);
CheckBox.collapseExpandNode('documents').then(() => {
CheckBox.nodeByLabel('workspace')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_WORKSPACE);
.and('contain.text', CheckBoxText.WORKSPACE);
CheckBox.nodeByLabel('office')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_OFFICE);
.and('contain.text', CheckBoxText.OFFICE);
});

CheckBox.collapseExpandNode('workspace').then(() => {
CheckBox.nodeByLabel('react')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_REACT);
.and('contain.text', CheckBoxText.REACT);
CheckBox.nodeByLabel('angular')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_ANGULAR);
.and('contain.text', CheckBoxText.ANGULAR);
CheckBox.nodeByLabel('veu')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_VEU);
.and('contain.text', CheckBoxText.VEU);
});

CheckBox.collapseExpandNode('office').then(() => {
CheckBox.nodeByLabel('public')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_PUBLIC);
.and('contain.text', CheckBoxText.PUBLIC);
CheckBox.nodeByLabel('private')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_PRIVATE);
.and('contain.text', CheckBoxText.PRIVATE);
CheckBox.nodeByLabel('classified')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_CLASSIFIED);
.and('contain.text', CheckBoxText.CLASSIFIED);
CheckBox.nodeByLabel('general')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_GENERAL);
.and('contain.text', CheckBoxText.GENERAL);
});
});

Expand All @@ -102,15 +102,15 @@ describe('Testes da tela com Check Box', () => {

CheckBox.nodeByLabel('downloads')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_DOWNLOADS);
.and('contain.text', CheckBoxText.DOWNLOADS);

CheckBox.collapseExpandNode('downloads').then(() => {
CheckBox.nodeByLabel('wordFile')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_WORD_FILE);
.and('contain.text', CheckBoxText.WORD_FILE);
CheckBox.nodeByLabel('excelFile')
.should('be.visible')
.and('contain.text', CheckBoxEnum.TEXT_EXCEL_FILE);
.and('contain.text', CheckBoxText.EXCEL_FILE);
});
});

Expand Down
51 changes: 51 additions & 0 deletions cypress/e2e/elements/radioButton.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import HomePage from '../../pages/HomePage';
import RadioButtonPage from '../../pages/Elements/RadioButtonPage';

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

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

describe('Partição Check - Validar os que foram checkados', () => {
it('Marcar Yes', () => {
RadioButton.yesByRadio().should('not.be.checked');
RadioButton.yesByLabel().click();
RadioButton.yesByRadio().should('be.checked');
});

it('Marcar Impressive', () => {
RadioButton.impressiveByRadio().should('not.be.checked');
RadioButton.impressiveByLabel().click();
RadioButton.impressiveByRadio().should('be.checked');
});

it('Marcar No', () => {
RadioButton.noByRadio().should('not.be.checked');
RadioButton.noByLabel().click();
RadioButton.noByRadio().should('not.be.checked').and('be.disabled');
});
});

describe('Partição Não Check - Validar os que não foram checkados', () => {
it('Marcar Yes', () => {
RadioButton.yesByLabel().click();
RadioButton.impressiveByRadio().should('not.be.checked');
RadioButton.noByRadio().should('not.be.checked');
});

it('Marcar Impressive', () => {
RadioButton.impressiveByLabel().click();
RadioButton.yesByLabel().should('not.be.checked');
RadioButton.noByRadio().should('not.be.checked');
});

it('Marcar No', () => {
RadioButton.noByLabel().click();
RadioButton.yesByLabel().should('not.be.checked');
RadioButton.impressiveByLabel().should('not.be.checked');
});
});
3 changes: 3 additions & 0 deletions cypress/pages/Elements/CheckBoxPage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import Node from '../../support/Types/Node';
class CheckBoxPage {
checkBoxMenu() {
return cy.getItemMenu('Check Box').click();
}
/**
* @param node é o elemento que deseja expandir e collapsar
* @type Node
Expand Down
31 changes: 31 additions & 0 deletions cypress/pages/Elements/RadioButtonPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class RadioButtonPage {
radioBtnMenu() {
return cy.getItemMenu('Radio Button').click();
}

yesByRadio() {
return cy.get('#yesRadio');
}

impressiveByRadio() {
return cy.get('#impressiveRadio');
}

noByRadio() {
return cy.get('#noRadio');
}

yesByLabel() {
return cy.get('label[for="yesRadio"]');
}

impressiveByLabel() {
return cy.get('label[for="impressiveRadio"]');
}

noByLabel() {
return cy.get('label[for="noRadio"]');
}
}

export default RadioButtonPage;
21 changes: 21 additions & 0 deletions cypress/support/Enum/CheckBoxText.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
enum CheckBoxText {
HOME = 'Home',
DESKTOP = 'Desktop',
DOCUMENTS = 'Documents',
DOWNLOADS = 'Downloads',
NOTES = 'Notes',
COMMANDS = 'Commands',
WORKSPACE = 'WorkSpace',
OFFICE = 'Office',
WORD_FILE = 'Word File.doc',
EXCEL_FILE = 'Excel File.doc',
REACT = 'React',
ANGULAR = 'Angular',
VEU = 'Veu',
PUBLIC = 'Public',
PRIVATE = 'Private',
CLASSIFIED = 'Classified',
GENERAL = 'General',
}

export default CheckBoxText;

0 comments on commit f12c306

Please sign in to comment.