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 #511

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
40 changes: 38 additions & 2 deletions cypress/e2e/registration.cy.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,47 @@
/// <reference types='cypress' />

const user = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you know how to generate random user data - create generateUser function and reuse it in the test

firstName: 'George',
lastName: 'Gus',
email: '[email protected]',
numberPhone: '1234567890',
addres: 'Shevchenko 12'
};

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

cy.visit('https://demoqa.com/automation-practice-form');
});

it('', () => {
it('Should register a new student', () => {
cy.get('#firstName').type(user.firstName);
cy.get('#lastName').type(user.lastName);
cy.get('#userEmail').type(user.email);
cy.get('label[for="gender-radio-1"]').click();
cy.get('#userNumber').type(user.numberPhone);
cy.get('#dateOfBirthInput').click();
cy.get('.react-datepicker__month-select').select('February');
cy.get('.react-datepicker__year-select').select('2007');
cy.get('.react-datepicker__day').contains('5').click();
cy.get('.subjects-auto-complete__value-container').type(`en{enter}`);
cy.get('label[for="hobbies-checkbox-1"]').click();
cy.get('#currentAddress').type(user.addres);
cy.get('#state').type(`{downarrow}{enter}`);
cy.get('#city').type(`{downarrow}{enter}`);

cy.get('#submit').click();

cy.contains('tr', 'Student Name').should('contain', user.firstName);
cy.contains('tr', 'Student Name').should('contain', user.lastName);
cy.contains('tr', 'Student Email').should('contain', user.email);
cy.contains('tr', 'Gender').should('contain', 'Male');
cy.contains('tr', 'Mobile').should('contain', user.numberPhone);
cy.contains('tr', 'Date of Birth').should('contain', '05 February,2007');
cy.contains('tr', 'Subjects').should('contain', 'English');
cy.contains('tr', 'Hobbies').should('contain', 'Sports');
cy.contains('tr', 'Date of Birth').should('contain', '05 February,2007');
cy.contains('tr', 'Address').should('contain', user.addres);
cy.contains('tr', 'State and City')
.should('contain', 'Uttar Pradesh Lucknow');
});
});