Skip to content

Calling Login() a second time does not work #74

@Mushoz

Description

@Mushoz

Whenever I call Login() a second time on a different user, it does not login as expected. Calling login() a second time on the same user works just as expected. Why is this small test case not logging in as expected?

describe('empty spec', () => {

  beforeEach(function () {

    cy.create({model: 'App\\Models\\User', state: {'representative':[],}}).as('regularUser1')
    cy.create({model: 'App\\Models\\User', state: {'representative':[],}}).as('regularUser2')

  });

  it('Example Test Case', function () {
    cy.visit('/')
    cy.login({id:this.regularUser1.id})
    cy.visit('/')
    cy.url().should('contain', '/dashboard') // this works
    cy.logout()
    cy.visit('/')
    cy.login({id:this.regularUser2.id})
    cy.visit('/')
    cy.url().should('contain', '/dashboard') // this fails, will be redirected to the login page instead
  })
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions