Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #520

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { defineConfig } = require('cypress');

module.exports = defineConfig({
e2e: {
baseUrl: 'https://demoqa.com/automation-practice-form',
setupNodeEvents(on, config) {
}
}
Expand Down
42 changes: 39 additions & 3 deletions cypress/e2e/registration.cy.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,47 @@
/// <reference types='cypress' />

describe('Student Registration page', () => {
before(() => {

cy.visit('');
});

it('', () => {
it('should register a new student with valid data', () => {
cy.findByPlaceholder('First Name')
.type('Vasiliy');
cy.findByPlaceholder('Last Name')
.type('Petrov');
cy.findByPlaceholder('[email protected]')
.type('[email protected]');
cy.get('label[for="gender-radio-1"]').click();
cy.findByPlaceholder('Mobile Number')
.type('3548952632');
cy.get('#dateOfBirthInput').click();
cy.get('.react-datepicker__month-select').select('February');
cy.get('.react-datepicker__year-select').select('1977');
cy.get('.react-datepicker__day--020').click();
cy.get('#subjectsContainer').type('Arts{enter}');
cy.get('label[for="hobbies-checkbox-2"]').click();
cy.findByPlaceholder('Current Address')
.type('Saharova 85, Kyiv');
cy.get('#state').click();
cy.get('#react-select-3-option-1').click();
cy.get('#city').click();
cy.get('#react-select-4-option-2').click();
cy.get('#submit').click();

cy.get('.modal-header').contains('Thanks for submitting the form');

cy.contains('tr', 'Student Name').should('contain', 'Vasiliy Petrov');
cy.contains('tr', 'Student Email').should('contain', '[email protected]');
cy.contains('tr', 'Gender').should('contain', 'Male');
cy.contains('tr', 'Mobile').should('contain', '3548952632');
cy.contains('tr', 'Date of Birth').should('contain', 'February');
cy.contains('tr', 'Date of Birth').should('contain', '1977');
cy.contains('tr', 'Date of Birth').should('contain', '20');
cy.contains('tr', 'Subjects').should('contain', 'Arts');
cy.contains('tr', 'Hobbies').should('contain', 'Reading');
cy.contains('tr', 'Address').should('contain', 'Saharova 85, Kyiv');
cy.contains('tr', 'State and City').should('contain', 'Uttar Pradesh');
cy.contains('tr', 'State and City').should('contain', 'Merrut');
});
});
});
3 changes: 3 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
Cypress.Commands.add('findByPlaceholder', (placeholder) => {
cy.get(`[placeholder="${placeholder}"]`);
});