fix(tests): wait until namespaces are loaded before checking if the history is present

This commit is contained in:
kolaente 2022-01-30 13:07:08 +01:00
parent 423195155e
commit e6eb48b5af
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -4,6 +4,8 @@ import '../../support/authenticateUser'
describe('List History', () => { describe('List History', () => {
it('should show a list history on the home page', () => { it('should show a list history on the home page', () => {
cy.intercept(Cypress.env('API_URL') + '/namespaces*').as('loadNamespaces')
const lists = ListFactory.create(6) const lists = ListFactory.create(6)
cy.visit('/') cy.visit('/')
@ -12,13 +14,21 @@ describe('List History', () => {
.should('not.exist') .should('not.exist')
cy.visit(`/lists/${lists[0].id}`) cy.visit(`/lists/${lists[0].id}`)
cy.wait('@loadNamespaces')
cy.visit(`/lists/${lists[1].id}`) cy.visit(`/lists/${lists[1].id}`)
cy.wait('@loadNamespaces')
cy.visit(`/lists/${lists[2].id}`) cy.visit(`/lists/${lists[2].id}`)
cy.wait('@loadNamespaces')
cy.visit(`/lists/${lists[3].id}`) cy.visit(`/lists/${lists[3].id}`)
cy.wait('@loadNamespaces')
cy.visit(`/lists/${lists[4].id}`) cy.visit(`/lists/${lists[4].id}`)
cy.wait('@loadNamespaces')
cy.visit(`/lists/${lists[5].id}`) cy.visit(`/lists/${lists[5].id}`)
cy.wait('@loadNamespaces')
cy.visit('/') cy.visit('/')
cy.wait('@loadNamespaces')
cy.get('h3') cy.get('h3')
.contains('Last viewed') .contains('Last viewed')
.should('exist') .should('exist')