Skip to content

Commit

Permalink
cypress: wait for introspect some before moving on (#388)
Browse files Browse the repository at this point in the history
See if this helps the compliance cypress test to stop timing out.
Signed-off-by: Victoria Jeffrey <[email protected]>
  • Loading branch information
lancewf authored May 20, 2019
1 parent 0721894 commit 959e6a9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions e2e/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Cypress.Commands.add("restoreStorage", () => {
localStorage.setItem(key, LOCAL_STORAGE_MEMORY[key]);
});
Object.keys(SESSION_MEMORY).forEach(key => {
sessionStorage.setItem(key, SESSION_MEMORY[key]);
sessionStorage.setItem(key, SESSION_MEMORY[key]);
});

cy.server()
// mock refresh token call in case it fails
let user = JSON.parse(localStorage.getItem('chef-automate-user'))
Expand All @@ -41,6 +41,8 @@ Cypress.Commands.add("login", (url, username) => {
cy.visit(url)
cy.get('button').contains('Log in with Username').click().then(() => {
cy.url().should('include', '/dex/auth/')
cy.server()
cy.route('POST', '/api/v0/auth/introspect_some').as('getAuth')

// login
cy.get('#login')
Expand All @@ -51,10 +53,12 @@ Cypress.Commands.add("login", (url, username) => {

cy.get('[type=submit]').click().then(() => {
expect(localStorage.getItem('chef-automate-user')).to.contain(username)

// close welcome modal if present
cy.get('app-welcome-modal').invoke('hide')
cy.saveStorage()

cy.wait('@getAuth')
})
})
})
Expand Down

0 comments on commit 959e6a9

Please sign in to comment.