Getting navigated back to previous url instead of remaining on new one.
See original GitHub issueHi All, I am having trouble in understanding, what can I use to stay on the same page. Instead, I am navigated back to the previous URL, rather than remaining on a new one.
below are both URL’s console specifications.
Event: new url
New Url: https://app.staging.blockport.tech/settings
Url Updated By: pushState
Args: (3) [null, "", "/settings"]
New Url: https://app.staging.blockport.tech/
Url Updated By: replaceState
Args: (3) [null, "", "/"]
selectSettings: () => {
cy.viewport(viewportSize).then(() => {
cy.get(settingsButton).click({force: true });
})
},
verifySettingsPage: () => {
cy.viewport(viewportSize).then(() => {
cy.get(settingsPageVerification).should('be.visible');
//cy.url().should('eq', `${Cypress.env('host')}/settings`); ---> doesn't work
})
},
Please have a look and suggest me what can be done here.
Issue Analytics
- State:
- Created 5 years ago
- Comments:20 (8 by maintainers)
Top Results From Across the Web
How to get the previous URL in JavaScript? - Stack Overflow
If you want to go to the previous page without knowing the url, you could use the new History api.
Read more >How do I go back to a previous page when I am surfing the web
In Internet Explorer, I have BACK and FORWARD arrows when searching the internet, such as in checking out a site like Walmart.com for...
Read more >Adding navigation - Angular
Type a URL in the address bar to navigate to a corresponding product page · Click links on the page to navigate within...
Read more >History back() Method - W3Schools
The history.back() method loads the previous URL (page) in the history list. The history.back() method ... history.back() is the same as history.go(-1) ....
Read more >View / Router | Framework7 Documentation
reloadPrevious (boolean) - replace the previous page in history with the new one from route; reloadAll (boolean) - load new page and remove...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Здравствуйте, извините, что на русском, английским не сильно владею. Так же я новичок и в Cypress!)
Проблема, как я понял выше, одна и та же, но простым ожиданием завершения всех xhr все не заканчивается.
После того как я добавляю юзера в нашу базу POST запросом, меня вместо того, чтоб перекинуть на страницу всех пользователей, кидает на страницу авторизации, и я не знаю, что с этим делать.
такое же повторяется и на cy.reload() и cy.go(back)
Но самое интересное, что сейчас у меня этот тест большой размещен внутри context() и разделен на много it() , и если все тесты it() объединить, т.е. чтобы они не разделялись, то в конечном результате у меня не появляется этого злосчастного (NEW URL).
Заранее спасибо!)
@jennifer-shehane I have actually discovered the solution to this issue. The problem is that I wasn’t waiting for all of the XHR requests to finish. Not sure why, but I’m always taken to the app’s landing page. Once I wait for all the requests to be made then I am able to visit other endpoints without being rerouted.