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() should allow override of baseUrl #30000

Open
mryellow opened this issue Aug 8, 2024 · 3 comments
Open

cy.visit() should allow override of baseUrl #30000

mryellow opened this issue Aug 8, 2024 · 3 comments
Labels
E2E Issue related to end-to-end testing type: feature New feature that does not currently exist

Comments

@mryellow
Copy link

mryellow commented Aug 8, 2024

What would you like?

cy.visit() should itself accept the option baseUrl: null.

Then it can be disabled on a case-by-case basis without impacting an entire test by specifying in options for it or by calling Cypress.config('baseUrl', null).

Why is this needed?

#2918
#4450

Other

if (Cypress.isCrossOriginSpecBridge) {
url = $Location.qualifyWithBaseUrl(Cypress.state('originCommandBaseUrl'), url)
} else {
const baseUrl = config('baseUrl')
if (baseUrl) {
url = $Location.qualifyWithBaseUrl(baseUrl, url)
}
}

@jennifer-shehane jennifer-shehane added type: feature New feature that does not currently exist E2E Issue related to end-to-end testing labels Aug 9, 2024
@mryellow
Copy link
Author

file:// does not work in the same way.

It requires a relative path. Relative local paths are interpreted as URLs when baseUrl is set.

@mryellow
Copy link
Author

You'll note the attached issues feature people needing to call Cypress.config('baseUrl', null') before their cy.visit().

Mutating the config for a single call seems a little harsh when what is really required is simply setting baseUrl for the single cy.visit() call. Which could be done by adding it to the options in the signature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E2E Issue related to end-to-end testing type: feature New feature that does not currently exist
Projects
None yet
Development

No branches or pull requests

3 participants
@mryellow @jennifer-shehane and others