cypress: Incorrect redirect to malformed url within AUT - adding `_/` in url
Current behavior:
When I instruct cypress to login to an Oracle APEX application, the authentication re-directs cypress to a ‘404 not found’ page because the authenticated URL is malformed. The malformed URL is the only issue and can simply corrected programmatically (with a find and replace command).

However - it is very important to note that the cypress login correctly returns:
- a valid cookie
- a valid session
which is everything you need for authentication.
Desired behavior:
Cypress, ideally, should be able to follow the same authentication redirect that a user would in a regular browser.
Steps to reproduce: (app code and test code)
I created a dummy application with dummy credentials hosted by apex.oracle.com to demonstrate:
it('Login demo', function() {
cy.visit('https://apex.oracle.com/pls/apex/f?p=54707:LOGIN_DESKTOP')
cy.get('#P9999_USERNAME').type('ApexUser')
cy.get('#P9999_PASSWORD').type('Oradoc_db1')
cy.get('.t-Button').click()
})
The above code (which should work until the application expires in many months) will redirect to a 404 not found page with a url in the format: https://apex.oracle.com/__/f?p=54707:1:[session_id]::::: Outside of cypress the url will have the format: https://apex.oracle.com/pls/apex/f?p=54707:1:[session_id]:::::
Versions
I have tested this across 4 instances of Oracle APEX (APEX 5.0, 5.1, 18.1 and 19) and this behavior is consistent.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 53 (25 by maintainers)
Commits related to this issue
- try to reproduce #3975 — committed to cypress-io/cypress by flotwig 5 years ago
- add repro for #3975 — committed to cypress-io/cypress by flotwig 4 years ago
- fix #3975, #3994 — committed to cypress-io/cypress by flotwig 4 years ago
- Rewrite JS/HTML using AST-based approach (#5273) * Add winPropAccessor to security.js, remove other replacers * Add start of Cypress.resolveWindowReference * Add regexes for dot and bracket acc... — committed to cypress-io/cypress by flotwig 4 years ago
- Add failing test for #3975 — committed to cypress-io/cypress by tgriesser 3 years ago
- Proposed fix for #3975 — committed to cypress-io/cypress by tgriesser 3 years ago
- Add failing test for #3975 — committed to cypress-io/cypress by tgriesser 3 years ago
- Proposed fix for #3975 — committed to cypress-io/cypress by tgriesser 3 years ago
I am also facing this issue with all browsers including Electron :
Cypress 4.7.0 Node v8.11.3
Same after upgrading to latest versions: Cypress 5.1.0 Node v12.18.3
I’m redirected to https://tstapex.myhost.ch/__/f?p=119:1:28275213605974:::::
Then of course get:
Setting
experimentalSourceRewritingtotruedoes not help.There is an open PR meant to fix this here: https://github.com/cypress-io/cypress/pull/5273 It’s complicated and is still a work in progress.
This fix is available starting in
4.6.0as an experiment which you can access by setting this config option in yourcypress.jsonor elsewhere:Please use a new issue if you are still running into issues that are not solved by this change.
Another example from https://github.com/cypress-io/cypress/issues/5878
The url reroutes to the incorrect
__/url, visiting the Test Runner within the Test Runner as shown below. This behavior changed slightly over the versions, but never worked.3.4.1 w/ Chrome 78
This one reroutes to https://rahulshettyacademy.com/seleniumPractise/__/#/cart
3.4.1 w/ Electron 61
This one reroutes to https://rahulshettyacademy.com/seleniumPractise/#/cart
3.5.0 w/ Chrome 78 or Electron 73
This one reroutes to https://rahulshettyacademy.com/seleniumPractise/__/#/cart
3.7.0 w/ Chrome 78 or Electron 73
This one reroutes to https://rahulshettyacademy.com/seleniumPractise/__/#/cart
The code for this is done in cypress-io/cypress#5273, but has yet to be released. We’ll update this issue and reference the changelog when it’s released.
I use the following code as workaround. Replace ‘xxx’ as needed.
I just used edit the url and redirect like so
An example context : https://github.com/hhudson/bypass_login_w_cypress/blob/master/cypress/integration/method1.login.js
I searched for both. Could see
window.location.hrefbeing referenced, but not set.Re-opening since others are still running in to this: https://github.com/cypress-io/cypress/issues/5442
Please re-open this issue. It is apparent in Electron 73 that ships with Cypress 3.5.0.
Since this issue only exhibits itself within Chrome - we figure it is a change in Chrome that caused this issue to happen in Cypress. I also assume it is not a bug, as the issue still persists in version 77. It may be an intended change in behavior.
Narrowing down the version of Chrome that it was introduced, it was introduce in version 71.0.3572.0, specifically between commits 7e3da6dc3d7cd7eb8a55ef301026fe1ab737f814 and 56dd83c9005f68d55ddbf85c551759526b4e37cd:
⭐️ Changelog where issue was introduced
@flotwig good luck 😅
I face the same problem. But only when using chromium. If I use elektron, it works.