diff --git a/cypress/e2e/elements/checkBox.cy.ts b/cypress/e2e/elements/checkBox.cy.ts index be45770..28a2ced 100644 --- a/cypress/e2e/elements/checkBox.cy.ts +++ b/cypress/e2e/elements/checkBox.cy.ts @@ -1,7 +1,7 @@ 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(); @@ -9,7 +9,7 @@ const CheckBox = new CheckBoxPage(); beforeEach(() => { cy.visitarToolsQA(); Home.elements().click(); - cy.getItemMenu('Check Box').click(); + CheckBox.checkBoxMenu(); }); describe('Testes da tela com Check Box', () => { @@ -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); }); }); @@ -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); }); }); @@ -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); }); }); @@ -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); }); }); diff --git a/cypress/e2e/elements/radioButton.cy.ts b/cypress/e2e/elements/radioButton.cy.ts new file mode 100644 index 0000000..8f6645d --- /dev/null +++ b/cypress/e2e/elements/radioButton.cy.ts @@ -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'); + }); +}); diff --git a/cypress/pages/Elements/CheckBoxPage.ts b/cypress/pages/Elements/CheckBoxPage.ts index e50b672..05d359d 100644 --- a/cypress/pages/Elements/CheckBoxPage.ts +++ b/cypress/pages/Elements/CheckBoxPage.ts @@ -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 diff --git a/cypress/pages/Elements/RadioButtonPage.ts b/cypress/pages/Elements/RadioButtonPage.ts new file mode 100644 index 0000000..5c1039f --- /dev/null +++ b/cypress/pages/Elements/RadioButtonPage.ts @@ -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; diff --git a/cypress/support/Enum/CheckBoxText.ts b/cypress/support/Enum/CheckBoxText.ts new file mode 100644 index 0000000..3c3eaad --- /dev/null +++ b/cypress/support/Enum/CheckBoxText.ts @@ -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;