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

[editor] Change URL query for pagination #607

Merged
merged 1 commit into from
Sep 11, 2023
Merged
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
56 changes: 24 additions & 32 deletions apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts
Original file line number Diff line number Diff line change
@@ -1,66 +1,58 @@
describe('dashboard', () => {
let pageOne
describe('pagination', () => {
let originalList
let newList
it('should display different results on click on arrow', () => {
cy.visit('/')
cy.visit('/records/all')
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/search?_page=2')
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')
})
})
})

// NEEDS TO WAIT UNTIL STYLE IS DONE
describe('sorting', () => {
let originalList
let newList
let originalFirstItem
let newFirstItem
it('should order the result list on click', () => {
cy.visit('/')
cy.visit('/records/all')
cy.get('gn-ui-record-table')
.find('.record-table-col')
.first()
.as('pageOne')

cy.get('@pageOne')
.invoke('text')
.then((list) => {
originalList = list.trim()
originalFirstItem = list.trim()
cy.get('.record-table-header').first().click()
cy.get('gn-ui-sort').find('gn-ui-button').first().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)
newFirstItem = list.trim()
expect(newFirstItem).not.to.equal(originalFirstItem)
})
})
})
Expand Down