Skip to content

Commit

Permalink
feat(me): add e2e test for url pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoinier committed Sep 6, 2023
1 parent e3fc6af commit 59d9c16
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
describe('dashboard', () => {
let originalList
let newList
let pageOne
describe('pagination', () => {
it('should display different results on click on arrow', () => {
cy.visit('/')
it('should display different results on click on arrow and change url', () => {
cy.visit('/records/all')
cy.wait('@setPageSizeRequest')
cy.get('gn-ui-record-table')
.find('.record-table-col')
.first()
.as('pageOne')

cy.get('@pageOne')
.invoke('text')
.then((list) => {
originalList = list.trim()
cy.get('gn-ui-pagination-buttons').find('gn-ui-button').last().click()
cy.get('gn-ui-record-table')
.find('.record-table-col')
.first()
.invoke('text')
.then((list) => {
newList = list.trim()
expect(newList).not.to.be(originalList)
})
.then((text) => {
pageOne = text
})
cy.get('gn-ui-pagination-buttons').find('gn-ui-button').last().click()
cy.get('gn-ui-record-table')
.find('.record-table-col')
.first()
.invoke('text')
.then((text) => {
expect(text).not.to.equal(pageOne)
cy.url().should('include', 'page=2')
})
})
it('should display different results on click on specific page', () => {
it('should display different results on click on specific page and change url', () => {
cy.visit('/records/all')
cy.get('gn-ui-pagination-buttons').find('gn-ui-button').eq(1).click()
cy.get('gn-ui-record-table')
.find('.record-table-col')
.first()
.invoke('text')
.then((list) => {
newList = list.trim()
expect(newList).to.be(originalList)
.then((text) => {
expect(text).to.equal(pageOne)
cy.url().should('include', 'page=1')
})
})
})
Expand Down

0 comments on commit 59d9c16

Please sign in to comment.