Home > OS >  How to assert a url in cypress
How to assert a url in cypress

Time:12-23

Hi i want to assert a url which increases on every save. Say a new job is created the url changes from job/1 to job/2. There is a increment on every newly created job.

CodePudding user response:

Verify URL like

cy.url().should('eq', 'http://localhost:8000/users/1/edit')

You can check official cypress documentation here

CodePudding user response:

or you can also assert specific URL search params like this:

cy.location().should(loc => {
   expect(loc.pathname).to.equal('/job/1')
})

read original docs

  • Related