Skip to content

Commit

Permalink
fix: try and reduce cookie flakyness
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Oct 24, 2021
1 parent 4c5677f commit e7ae8d6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ describe('Basic email profile with failing login flows', () => {
})

describe('shows validation errors when invalid signup data is used', () => {
beforeEach(() => {
cy.clearAllCookies()
cy.visit(route)
})

it('should show an error when the identifier is missing', () => {
cy.submitPasswordForm()
cy.get('*[data-testid="ui/message/4000002"]').should(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('Basic email profile with succeeding login flows', () => {
cy.get(`${appPrefix(app)}input[name="password_identifier"]`).type(email)
cy.get('input[name="password"]').type(password)
cy.submitPasswordForm()
cy.location('pathname').should('not.contain', '/login')

cy.getSession().should((session) => {
const { identity } = session
Expand All @@ -51,6 +52,7 @@ describe('Basic email profile with succeeding login flows', () => {
cy.get('input[name="password_identifier"]').type(email.toUpperCase())
cy.get('input[name="password"]').type(password)
cy.submitPasswordForm()
cy.location('pathname').should('not.contain', '/login')

cy.getSession().should((session) => {
const { identity } = session
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,26 @@ const updateConfigFile = (cb: (arg: any) => any) => {
config = cb(config)
cy.writeFile(configFile, YAML.stringify(config))
})
cy.wait(100)
cy.wait(200)
}

Cypress.Commands.add('useConfigProfile', (profile: string) => {
console.log('Switching config profile to:', profile)
cy.readFile(`kratos.${profile}.yml`).then((contents) =>
cy.writeFile(configFile, contents)
)
cy.wait(100)
cy.wait(200)
})

Cypress.Commands.add('proxy', (app: string) => {
console.log('Switching proxy profile to:', app)
cy.writeFile(`proxy.json`, `"${app}"`)
cy.readFile(`proxy.json`).should('eq', app)
cy.wait(100)
cy.clearAllCookies()
cy.wait(200)
cy.visit(APP_URL + '/')
cy.get(`[data-testid="app-${app}"]`).should('exist')
cy.clearAllCookies()
cy.visit(APP_URL + '/')
})

Cypress.Commands.add('shortPrivilegedSessionTime', ({} = {}) => {
Expand Down

0 comments on commit e7ae8d6

Please sign in to comment.