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

Basic auth in baseUrl does not work in electron browser #1639

Closed
Narretz opened this issue Apr 25, 2018 · 6 comments
Closed

Basic auth in baseUrl does not work in electron browser #1639

Narretz opened this issue Apr 25, 2018 · 6 comments
Labels
type: duplicate This issue or pull request already exists

Comments

@Narretz
Copy link
Contributor

Narretz commented Apr 25, 2018

Current behavior:

If I have a baseUrl in cypress.json:

{
  "baseUrl": "http://username:password@test.dev.mypage.com"
}

then a basic cypress run does not work. I get this error:

Timed out waiting for the browser to connect. Retrying...

This also happens if I run --headed.

It does work in latest Chrome (66).

Desired behavior:

It should open the page with basic auth data.

Steps to reproduce:

  1. Add baseUrl to cypress.json:
{
  "baseUrl": "http://username:password@test.dev.mypage.com"
}
  1. Do cypress run

Versions

Cypress 2.1.0

@Narretz
Copy link
Contributor Author

Narretz commented Apr 25, 2018

Important note: It works with the auth parameter in "cy.visit".

@rgrigel
Copy link

rgrigel commented May 3, 2018

We ran into this issue in our project when updating Cypress from 1.4.2 to 2.1.0. There is a workaround based on (#1115).
We extended Cypress's visit command with:

Cypress.Commands.overwrite('visit', (orig, url, options) => {
  options = options || {};
  options.auth = {
    username: Cypress.env('AUTH_USER'),
    password: Cypress.env('AUTH_PASS')
  };
  return orig(url, options)
});

and we are running it with:

CYPRESS_AUTH_USER=user CYPRESS_AUTH_PASS=pass CYPRESS_baseUrl=https://app.com cypress run

@montogeek
Copy link

Hello Cypress team!
It is there any information about a roadmap to fix this bug or something?

@jennifer-shehane jennifer-shehane added stage: ready for work The issue is reproducible and in scope type: bug and removed stage: awaiting response Potential fix was proposed; awaiting response labels Dec 6, 2018
@keskiju
Copy link

keskiju commented Dec 30, 2018

Cypress 3.1.4 seems to work ok on my Mac (at least with Chrome). However, this problem occurs when running Cypress 3.1.4 with Electron on cypress/base:10 Docker image (Debian + Node.js 10.13).

Basic auth seems to work ok, if you just don't set the baseUrl configuration parameter at all and you make the calls using a full url (e.g. cy.visit('https://user:pass@domain.com'). If you have set the baseUrl configuration parameter, Cypress probably gives that url to the browser even before the tests are run, and that time the timeout problem occurs. Even this dummy test fails to a connection timeout, if the baseUrl configuration parameter has been set:

describe('My First Test', function() {
  it('Does not do much!', function() {
    expect(true).to.equal(true)
  })
})

@keskiju
Copy link

keskiju commented Dec 30, 2018

Actually the problem occurs also on Mac if you have set the baseUrl configuration parameter and choose Electron 56 as the browser. You wont see the same connection timeout error message, but you'll see that the browser won't load anything, it just stays blank. Try again with an undefined baseUrl and everything works ok. (Note that baseUrl must be undefined. Empty string as baseUrl won't work the same way.)

@jennifer-shehane
Copy link
Member

Duplicate of #1598

@jennifer-shehane jennifer-shehane marked this as a duplicate of #1598 May 2, 2019
@jennifer-shehane jennifer-shehane added type: duplicate This issue or pull request already exists and removed stage: ready for work The issue is reproducible and in scope type: bug labels May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

5 participants