-
Notifications
You must be signed in to change notification settings - Fork 288
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 #244
base: main
Are you sure you want to change the base?
Solution #244
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,120 @@ | ||
/// <reference types='cypress' /> | ||
const { faker } = require('@faker-js/faker'); | ||
|
||
const username = faker.internet.userName(); | ||
const lastname = faker.name.lastName(); | ||
const email = faker.internet.email(); | ||
|
||
describe('Web Tables page', () => { | ||
it('', () => { | ||
beforeEach(() => { | ||
cy.visit('https://demoqa.com/webtables'); | ||
}); | ||
it('should check Pagination', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please consider that describe + test name should create summary together - in this case we have Better to write Check and fix everywhere There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
cy.get('.rt-tbody .rt-tr-group').should('have.length', 10); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try to use more descriptive selectors everywhere There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. сhange |
||
cy.get('.-next').should('be.visible').and('not.be.disabled'); | ||
cy.get('img[src="/images/Toolsqa.jpg"]').should('exist'); | ||
cy.url().should('eq', 'https://demoqa.com/webtables'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what this assert is doing here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change |
||
}); | ||
it('should check Rows count selection', () => { | ||
cy.get('select[aria-label="rows per page"]').should('exist'); | ||
cy.get('select[aria-label="rows per page"]').should('exist').select('20'); | ||
}); | ||
it('should Add a new worker', () => { | ||
cy.get('#addNewRecordButton').click(); | ||
cy.get('#firstName').type(username); | ||
cy.get('#lastName').type(lastname); | ||
cy.get('#userEmail').type(email); | ||
cy.get('#age').type('99'); | ||
cy.get('#salary').type('1000'); | ||
cy.get('#department').type('IT'); | ||
cy.get('#submit').click(); | ||
cy.get('.rt-tbody').contains(username).should('exist'); | ||
}); | ||
it('should Delete a worker', () => { | ||
cy.get('#addNewRecordButton').click(); | ||
cy.get('#firstName').type(username); | ||
cy.get('#lastName').type(lastname); | ||
cy.get('#userEmail').type(email); | ||
cy.get('#age').type('99'); | ||
cy.get('#salary').type('1000'); | ||
cy.get('#department').type('IT'); | ||
cy.get('#submit').click(); | ||
cy.get('.rt-tbody').contains(username).should('exist'); | ||
|
||
cy.get('.rt-tbody').contains(username) | ||
.parents('div.rt-tr') | ||
.find('span[title="Delete"]') | ||
.click(); | ||
|
||
cy.get('.rt-tbody').contains(username).should('not.exist'); | ||
}); | ||
it('should Delete all workers', () => { | ||
cy.get('.rt-tbody .rt-tr') | ||
.eq(0) | ||
.find('[id^="delete-record-"]') | ||
.click(); | ||
cy.get('.rt-tbody .rt-tr') | ||
.eq(1) | ||
.find('[id^="delete-record-"]') | ||
.click(); | ||
cy.get('.rt-tbody .rt-tr') | ||
.eq(0) | ||
.find('[id^="delete-record-"]') | ||
.click(); | ||
cy.get(`.rt-noData`).should('contain', 'No rows found'); | ||
}); | ||
it('should Find a worker in the search field and edit it.', () => { | ||
cy.get('input#searchBox').type('Cierra'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add search keyword to const There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add |
||
cy.get('input#searchBox').clear(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where do we have asserts to check search results? |
||
|
||
cy.get('.rt-tr').should('exist'); | ||
cy.get('#addNewRecordButton').click(); | ||
cy.get('#firstName').clear(); | ||
cy.get('#firstName').type(username); | ||
cy.get('#lastName').clear(); | ||
cy.get('#lastName').type(lastname); | ||
cy.get('#userEmail').type(email); | ||
cy.get('#age').type('40'); | ||
cy.get('#salary').type('10000'); | ||
cy.get('#department').type('IT'); | ||
cy.get('#submit').click(); | ||
}); | ||
it('should Validate data in the worker row after editing the worker', () => { | ||
cy.get('#searchBox').type('[email protected]'); | ||
|
||
cy.get('.rt-tr').should('exist'); | ||
cy.get('.action-buttons [title="Edit"]').click(); | ||
cy.get('#firstName').clear(); | ||
cy.get('#firstName').type(username); | ||
cy.get('#lastName').clear(); | ||
cy.get('#lastName').type(lastname); | ||
cy.get('#submit').click(); | ||
|
||
cy.get('.rt-tr').should('contain', username); | ||
cy.get('.rt-tr').should('contain', lastname); | ||
}); | ||
it('should Check the search by all column values', () => { | ||
cy.get('#searchBox').type('Cierra'); | ||
cy.get('.rt-tbody').should('contain', 'Cierra'); | ||
cy.get('#searchBox').clear(); | ||
|
||
cy.get('#searchBox').type('Vega'); | ||
cy.get('.rt-tbody').should('contain', 'Vega'); | ||
cy.get('#searchBox').clear(); | ||
|
||
cy.get('#searchBox').type(39); | ||
cy.get('.rt-tbody').should('contain', 39); | ||
cy.get('#searchBox').clear(); | ||
|
||
cy.get('#searchBox').type('[email protected]'); | ||
cy.get('.rt-tbody').should('contain', '[email protected]'); | ||
cy.get('#searchBox').clear(); | ||
|
||
cy.get('#searchBox').type(10000); | ||
cy.get('.rt-tbody').should('contain', 10000); | ||
cy.get('#searchBox').clear(); | ||
|
||
cy.get('#searchBox').type('Insurance'); | ||
cy.get('.rt-tbody').should('contain', 'Insurance'); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add empty lines between beforeEach and all tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.