How to clear search from location after/before each test? #17645
Answered
by
JessicaSachs
mufasa71
asked this question in
Component Testing
-
Hello, I couldn't find a way to clear
|
Beta Was this translation helpful? Give feedback.
Answered by
JessicaSachs
Aug 19, 2021
Replies: 1 comment 1 reply
-
A few things:
Cypress Component Testing executes in the same
You need to use a
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
mufasa71
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A few things:
cy.window()
orcy.location()
like E2E does.Cypress Component Testing executes in the same
window
instance as the spec, which means that you can do everything you'd usually do in a webpage inside of Cypress.document.location.search
programmatically to reset it between tests, it will trigger a full-page refresh and you will lose your spec page.You need to use a
<MemoryRouter>
instead of the realdocument.location
orwindow.history
.