Skip to content

Commit

Permalink
Merge pull request #9 from feroline/radio-button
Browse files Browse the repository at this point in the history
Radio button
  • Loading branch information
feroline authored Jul 10, 2024
2 parents d1c437c + 37cd73f commit a4735d1
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
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');
});
});
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;

0 comments on commit a4735d1

Please sign in to comment.