Cypress broken by URL with special characters
See original GitHub issueCurrent behavior
Our Phoenix app will redirect /vida
to /vida/información-basica/empleo
(notice the special character “ó”). That page then opens a websocket (same URL).
A test with cy.visit("/vida")
in Cypress breaks. Same test after the route is changed to remove the accent on the “o” works.
With the accent “ó”, our server logs:
23:50:27.501 request_id=FsCF2BaXBlhl5zcAAAgJ [info] POST /end-to-end/login
%{account_id: 121}
23:50:27.513 request_id=FsCF2BaXBlhl5zcAAAgJ [info] Sent 200 in 11ms
23:50:27.765 request_id=FsCF2CZaEwCBqVMAAAhJ [info] GET /vida
23:50:27.776 request_id=FsCF2CZaEwCBqVMAAAhJ [info] Sent 302 in 10ms
23:50:27.994 request_id=FsCF2DQBvaBrqm8AABTF [info] GET /vida/información-basica/empleo
23:50:28.017 request_id=FsCF2DQBvaBrqm8AABTF [info] Sent 200 in 22ms
23:50:28.254 request_id=FsCF2EN3Zch76RgAABIH [info] GET /vida/informaci%C3%83%C2%B3n-basica/empleo
Without the accent, our server logs:
23:54:47.872 request_id=FsCGFLXrmkhSgwkAAH8C [info] POST /end-to-end/login
%{account_id: 123}
23:54:47.888 request_id=FsCGFLXrmkhSgwkAAH8C [info] Sent 200 in 16ms
23:54:48.434 request_id=FsCGFNdtukhKR34AAH9C [info] GET /vida
23:54:48.459 request_id=FsCGFNdtukhKR34AAH9C [info] Sent 302 in 24ms
23:54:49.175 request_id=FsCGFQOaTmBzlmsAAJzB [info] GET /vida/informacion-basica/empleo
23:54:49.228 request_id=FsCGFQOaTmBzlmsAAJzB [info] Sent 200 in 52ms
23:54:51.093 [info] CONNECTED TO Phoenix.LiveView.Socket in 59µs
Transport: :websocket
Serializer: Phoenix.Socket.V2.JSONSerializer
Parameters: %{"_csrf_token" => "..., "_mounts" => "0", "vsn" => "2.0.0"}
On the Cypress side, only a single line appears:
# With the accent:
GET /vida/informaci%C3%83%C2%B3n-basica/empleo 404 300.388 ms - -
# Without the accent:
GET /vida/informacion-basica/empleo 200 5.114 ms - -
Screenshots of the requests from Chrome:
Desired behavior
Cypress should respect the encodings. Note that our app currently runs in production, with users having the usual browsers on desktop and mobile.
Test code to reproduce
cy.visit("/url-that-redirects-to-url-with-non-latin-characters"
Cypress Version
2.88.10
Other
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Should contain failing in cypress when the match string has a ...
I just ran it locally for the string Name cannot accept special characters like < > | / : * ? " #;...
Read more >Cypress-Fairbanks Independent School District / CFISD ...
Learn more about the proposed attendance boundary changes. The "Bringing Out the Best" character trait for the months of November & December is...
Read more >Error Messages | Cypress Documentation
Cypress errors because after a command, the subject becomes 'fixed' to a specific element - since it can't retry commands, if the element...
Read more >cypress-io/cypress - Gitter
CypressError : Special character sequence: '{"0c34-a556-84db":{"select ... why its break the test if the condition was not fulfilled?
Read more >How To Find Broken Links Using Cypress [With Examples]
“If you are using Cypress to find broken links on your website, it is essential to note that Cypress changes its host URL...
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
I just spent 3 hours today, and finally found this issue which explains my problem. I’ll use
encodeURI
now.Please fix this, and consider adding a yellow warning box in the docs to
cy.visit
about this in the meantime.Regards from Sweden (åäö)
You can bypass the problem by using
encodeURI
like below: