Skip to content

Cypress broken by URL with special characters #19355

Closed as not planned
Closed as not planned
@marcandre

Description

@marcandre

Current 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:
Screen Shot 2021-12-13 at 11 51 52 PM
Screen Shot 2021-12-13 at 11 57 11 PM

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    existing workaroundpkg/driverThis is due to an issue in the packages/driver directorystaleno activity on this issue for a long periodtype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions