Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cy.visit() page with baseUrl and two dots doesn't work #5090

Closed
amrtn opened this issue Sep 5, 2019 · 4 comments · Fixed by #8629
Closed

cy.visit() page with baseUrl and two dots doesn't work #5090

amrtn opened this issue Sep 5, 2019 · 4 comments · Fixed by #8629
Labels
pkg/driver This is due to an issue in the packages/driver directory type: bug

Comments

@amrtn
Copy link

amrtn commented Sep 5, 2019

Current behavior:

cy.visit('?q=..') will not honor the baseUrl defined in cypress.json and will load http:///?q=.. instead.

Desired behavior:

Given cypress.json as

{
  "baseUrl": "https://google.com"
}

cy.visit('?q=..') should load https://google.com?q=..

Steps to reproduce: (app code and test code)

See https://github.com/amrtn/cypress-test-tiny/tree/double-dot-visit

Workaround

cy.visit('/?q=..') will get translated to http://www.google.com/?q=..

This behavior can be acceptable in some cases.

Versions

Tested on cypress@3.4.1 in windows 10

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Sep 5, 2019

Yeah, this is weird and also not fixed in our upcoming pre-release. There is one issue that is being highlighted here which is that it is visiting http:/// with an extra / which is described here: #2101

It's weird that the dots seem to specifically make things worse.

cypress.json

{
  "baseUrl": "https://google.com"
}

spec.js

describe('Cy.visit with double dots', () => {
  it('This will get rewritten to https://www.google.com/?q=.. and work ', () => {
    cy.visit('/?q=..')
  })

  it('This will reroute properly without baseUrl', () => {
    cy.visit('https://google.com?q=..')
  })

  it('This will get rewritten to http:///?q=.. and generate an error', () => {
    cy.visit('?q=..')
  })
})

Screen Shot 2020-05-05 at 3 22 30 PM

@cypress-bot cypress-bot bot added the stage: ready for work The issue is reproducible and in scope label Sep 5, 2019
@jennifer-shehane jennifer-shehane added type: bug pkg/driver This is due to an issue in the packages/driver directory and removed stage: ready for work The issue is reproducible and in scope labels Sep 5, 2019
ryan-snyder added a commit to ryan-snyder/cypress that referenced this issue Sep 20, 2019
@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: work in progress stage: needs review The PR code is done & tested, needs review labels Sep 20, 2019
@cypress-bot cypress-bot bot added stage: work in progress and removed stage: needs review The PR code is done & tested, needs review labels Oct 1, 2019
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: work in progress and removed stage: work in progress stage: needs review The PR code is done & tested, needs review labels Nov 7, 2019
@cypress-bot cypress-bot bot added stage: ready for work The issue is reproducible and in scope and removed stage: work in progress labels Feb 26, 2020
@atoms42
Copy link

atoms42 commented Aug 24, 2020

We appear to be encountering this as well, in our case with query parameters which contain two dots.

I've seen this on Cypress 4.12.1 as well as 5.0.0

@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: ready for work The issue is reproducible and in scope stage: work in progress labels Sep 21, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 25, 2020

The code for this is done in cypress-io/cypress#8629, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label Sep 25, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 29, 2020

Released in 5.3.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v5.3.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Sep 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg/driver This is due to an issue in the packages/driver directory type: bug
Projects
None yet
3 participants