question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting navigated back to previous url instead of remaining on new one.

See original GitHub issue

Hi 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:closed
  • Created 5 years ago
  • Comments:20 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
jenchekcommented, May 6, 2019

Здравствуйте, извините, что на русском, английским не сильно владею. Так же я новичок и в Cypress!)

Проблема, как я понял выше, одна и та же, но простым ожиданием завершения всех xhr все не заканчивается.

После того как я добавляю юзера в нашу базу POST запросом, меня вместо того, чтоб перекинуть на страницу всех пользователей, кидает на страницу авторизации, и я не знаю, что с этим делать. image

такое же повторяется и на cy.reload() и cy.go(back)

Но самое интересное, что сейчас у меня этот тест большой размещен внутри context() и разделен на много it() , и если все тесты it() объединить, т.е. чтобы они не разделялись, то в конечном результате у меня не появляется этого злосчастного  (NEW URL).

Заранее спасибо!)

1reaction
salty-blue-mangocommented, Jul 13, 2018

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found