{ name: 'electron',
displayName: 'Electron',
version: '53.0.2785.143',
path: '',
majorVersion: '53',
info: 'Electron is the default browser that comes with Cypress. This is the browser that runs in headless mode. Selecting this browser is useful when debugging. The version number indicates the underlying Chromium version that Electron uses.' } { width: 1280,
height: 720,
show: false,
automationMiddleware: {},
projectPath: '/home/circleci/project',
browsers:
[ { name: 'chrome',
displayName: 'Chrome',
version: '64.0.3282.140',
path: 'google-chrome',
majorVersion: '64' },
{ name: 'electron',
displayName: 'Electron',
version: '53.0.2785.143',
path: '',
majorVersion: '53',
info: 'Electron is the default browser that comes with Cypress. This is the browser that runs in headless mode. Selecting this browser is useful when debugging. The version number indicates the underlying Chromium version that Electron uses.' } ],
proxyUrl: 'http://localhost:46201',
userAgent: null,
proxyServer: 'http://localhost:46201',
socketIoRoute: '/__socket.io',
chromeWebSecurity: true,
url: 'http://localhost:3000/__/#/tests/__all',
browser:
{ name: 'electron',
displayName: 'Electron',
version: '53.0.2785.143',
path: '',
majorVersion: '53',
info: 'Electron is the default browser that comes with Cypress. This is the browser that runs in headless mode. Selecting this browser is useful when debugging. The version number indicates the underlying Chromium version that Electron uses.' },
x: null,
y: null,
devTools: false,
minWidth: 100,
minHeight: 100,
contextMenu: true,
trackState:
{ width: 'browserWidth',
height: 'browserHeight',
x: 'browserX',
y: 'browserY',
devTools: 'isBrowserDevToolsOpen' },
frame: true,
recordFrameRate: null,
onPaint: null,
webPreferences:
{ chromeWebSecurity: true,
nodeIntegration: false,
backgroundThrottling: false } }
Bug
describe('Mock Logging in', () => {
it('stub cognito', () => {
cy.server();
cy.visit('/login');
cy.visit('/login', { onLoad: (contentWindow) => {
const state = contentWindow.reduxStore.getState();
// do stuff with the reduxStore to mock the logged in state here
}})
1) Mock Logging in:
CypressError: Timed out after waiting '60000ms' for your remote page to load.
Your page did not fire its 'load' event within '60000ms'.
You can try increasing the 'pageLoadTimeout' value in 'cypress.json' to wait longer.
Browsers will not fire the 'load' event until all stylesheets and scripts are done downloading.
When this 'load' event occurs, Cypress will continue running commands.
Increasing the timeout results in it never being called
100% reproducible on CircleCI
Update - same problem exists with --browser chrome on CircleCI
Running the identical docker container locally doesn't fail the same way. Something "special" about CircleCI causing this issue.
@millarm Any updates on this? Running into the same issue on Circle occasionally.
I have encountered this behavior when visiting the same url that I am currently on. So, if you run the code below, Cypress waits for the onload event on the first visit, but on the second one, the onload event is not going to be fired since you are on the exact same page. Cypress eventually times out.
cy.visit('/login')
cy.visit('/login')
Is there a reason why you need to visit the same url? Could using cy.reload() resolve your usecase?
I think we could handle this situation better in Cypress - as I was very confused when I encountered it as well. I was not blatantly visiting the same url either, my use case was:
cy.visit('runs/123') // visiting here by default routes to runs/123/failures
// wanted to test my direct routing worked
cy.visit('runs/123/failures') // would timeout since I was already on runs/123/failures
@brian-mann thoughts?
Im experiencing the same issue.
Running visit first in a beforeEach and then in a command gives me a 60 sec timeout.
Im running this on linux mint and it fails locally, so it probably has to do with the Linux distribution?
Snippet causing the failure:
beforeEach(() => {
cy.visit("/#/registration");
});
Cypress.Commands.add("register",() => {
cy.visit("/#/registration")
const pw = "!abc123abc123";
cy.get("input#username").type("johndoe");
cy.get("input#password").type(pw);
cy.get("input#password-confirmation").type(pw);
cy.contains("button", "Submit").click();
});
+1
To be fair I've just started using cypress and I'm pretty sure I need to rewrite my test to not visit the same route multiple times anyways, but I don't think I would have figured out was going on if I hadn't come across this thread. A little warning in the documentation for cy.visit() would be nice.
Before all I have my login, which redirects the user to diff pages depending on its status.
Then when I execute the test, if the page I am trying to reach is the same of the one I have been redirected I will have this issue.
We get this intermittently, about 1 in 500 page visits.
They seemed to be when the url was the same, but I added &testId= with an incrementing number and Date.now() they still carried on.
The server logs show a successful request and response with nothing unusual on the failed request.
I've run several attempts and logged at the debug logging and it looks like a cypress problem..
succeeded:
2018-12-11T18:39:38.6834028Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:socket automation:request 'clear:cookies' [ { name: 'redacted_81',
2018-12-11T18:39:38.6834212Z value: 'IHMLBPKM',
2018-12-11T18:39:38.6834307Z path: '/',
2018-12-11T18:39:38.6834399Z domain: 'redacted.com',
2018-12-11T18:39:38.6834497Z secure: false,
2018-12-11T18:39:38.6834616Z httpOnly: false } ]
2018-12-11T18:39:38.7355549Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:socket backend:request { eventName: 'resolve:url', args: [ 'https://redacted.com/misc-cypress-intermittant/integrationTests/desktop?theme=black&lang=en&testId=11544553578708', { failOnStatusCode: true, auth: null } ] }
2018-12-11T18:39:38.7358221Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:server resolving visit { url: 'https://redacted.com/misc-cypress-intermittant/integrationTests/desktop?theme=black&lang=en&testId=11544553578708', headers: { host: 'redacted.com', connection: 'Upgrade', pragma: 'no-cache', 'cache-control': 'no-cache', upgrade: 'websocket', origin: 'https://redacted.com', 'sec-websocket-version': '13', 'user-agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Cypress/3.1.0 Chrome/59.0.3071.115 Electron/1.8.2 Safari/537.36', 'accept-encoding': 'gzip, deflate', 'accept-language': 'en-US', cookie: 'redacted_81=IHMLBPKM', 'sec-websocket-key': 'nAcme1J4zuBo0QqGC70S0A==', 'sec-websocket-extensions': 'permessage-deflate; client_max_window_bits' }, options: { failOnStatusCode: true, auth: null } }
2018-12-11T18:39:38.7359168Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:server Getting remote state: { auth: null, props: { port: '443', tld: 'com', domain: 'redacted' }, origin: 'https://redacted.com', strategy: 'http', visiting: false, domainName: 'redacted.com', fileServer: null }
2018-12-11T18:39:38.8894489Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:server received response for resolving url { isOkStatusCode: true, isHtml: true, contentType: 'text/html', url: 'https://redacted.com/misc-cypress-intermittant/integrationTests/desktop?theme=black&lang=en&testId=11544553578708', status: 200, cookies: [ { key: 'redacted_81', value: 'IHMLBPKM', domain: 'redacted.com', path: '/', hostOnly: true, creation: '2018-12-11T18:39:38.887Z', lastAccessed: '2018-12-11T18:39:38.887Z', name: 'redacted_81' } ], statusText: 'OK', redirects: [], originalUrl: 'https://redacted.com/misc-cypress-intermittant/integrationTests/desktop?theme=black&lang=en&testId=11544553578708' }
2018-12-11T18:39:38.8895378Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:server Setting remoteAuth null
2018-12-11T18:39:38.8898864Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:cors Parsed URL { port: '443', tld: 'com', domain: 'redacted' }
2018-12-11T18:39:38.8900353Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:server Setting remoteOrigin https://redacted.com
2018-12-11T18:39:38.8900505Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:server Setting remoteHostAndPort { port: '443', tld: 'com', domain: 'redacted' }
2018-12-11T18:39:38.8900660Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:server Setting remoteDocDomain redacted.com
2018-12-11T18:39:38.8901395Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:server Getting remote state: { auth: null, props: { port: '443', tld: 'com', domain: 'redacted' }, origin: 'https://redacted.com', strategy: 'http', visiting: false, domainName: 'redacted.com', fileServer: null }
2018-12-11T18:39:38.8965886Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:server Getting remote state: { auth: null, props: { port: '443', tld: 'com', domain: 'redacted' }, origin: 'https://redacted.com', strategy: 'http', visiting: false, domainName: 'redacted.com', fileServer: null }
2018-12-11T18:39:38.8968991Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:proxy handling proxied request { url: '/misc-cypress-intermittant/integrationTests/desktop?theme=black&lang=en&testId=11544553578708', proxiedUrl: 'https://redacted.com/misc-cypress-intermittant/integrationTests/desktop?theme=black&lang=en&testId=11544553578708', headers: { host: 'redacted.com', connection: 'keep-alive', 'upgrade-insecure-requests': '1', 'user-agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Cypress/3.1.0 Chrome/59.0.3071.115 Electron/1.8.2 Safari/537.36', accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', referer: 'https://redacted.com/__/', 'accept-encoding': 'gzip, deflate', 'accept-language': 'en-US', cookie: 'redacted_81=IHMLBPKM; __cypress.initial=true' }, remoteState: { auth: null, props: { port: '443', tld: 'com', domain: 'redacted' }, origin: 'https://redacted.com', strategy: 'http', visiting: false, domainName: 'redacted.com', fileServer: null } }
2018-12-11T18:39:38.8974159Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:proxy received response for { url: 'https://redacted.com/misc-cypress-intermittant/integrationTests/desktop?theme=black&lang=en&testId=11544553578708', headers: { 'cache-control': 'private', 'content-type': 'text/html; charset=utf-8', server: 'Microsoft-IIS/8.5', 'x-aspnet-version': '4.0.30319', 'x-aspnetmvc-version': '5.2', 'x-powered-by': 'ASP.NET', 'x-iit-server': 'WEB5-DK1', date: 'Tue, 11 Dec 2018 18:39:38 GMT', connection: 'close', 'content-length': '9467', 'set-cookie': [ 'redacted_81=IHMLBPKM; Path=/' ] }, statusCode: 200, isGzipped: undefined, wantsInjection: 'full', wantsSecurityRemoved: false }
2018-12-11T18:39:38.9061455Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:server Getting remote state: { auth: null, props: { port: '443', tld: 'com', domain: 'redacted' }, origin: 'https://redacted.com', strategy: 'http', visiting: false, domainName: 'redacted.com', fileServer: null }
2018-12-11T18:39:38.9063277Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:proxy handling proxied request { url: '/misc-cypress-intermittant/opencss/css/11.7/go-desktop/MSw1/black?dir=ltr&cache=7268D8ABA48087E54FF1C5DF5D8E0DEC&_=1.1.7069.0', proxiedUrl: 'https://redacted.com/misc-cypress-intermittant/opencss/css/11.7/go-desktop/MSw1/black?dir=ltr&cache=7268D8ABA48087E54FF1C5DF5D8E0DEC&_=1.1.7069.0', headers: { host: 'redacted.com', connection: 'keep-alive', 'user-agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Cypress/3.1.0 Chrome/59.0.3071.115 Electron/1.8.2 Safari/537.36', accept: 'text/css,*/*;q=0.1', referer: 'https://redacted.com/misc-cypress-intermittant/integrationTests/desktop?theme=black&lang=en&testId=11544553578708', 'accept-encoding': 'gzip, deflate', 'accept-language': 'en-US', cookie: 'redacted_81=IHMLBPKM' }, remoteState: { auth: null, props: { port: '443', tld: 'com', domain: 'redacted' }, origin: 'https://redacted.com', strategy: 'http', visiting: false, domainName: 'redacted.com', fileServer: null } }
2018-12-11T18:39:38.9093757Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:server Got CONNECT request from redacted.com:443
2018-12-11T18:39:38.9103942Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:cors Parsed URL { port: '443', tld: 'com', domain: 'redacted' }
2018-12-11T18:39:38.9104726Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:server HTTPS request does match URL: https://redacted.com:443 with props: { port: '443', tld: 'com', domain: 'redacted' }
2018-12-11T18:39:38.9134831Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:server Getting remote state: { auth: null, props: { port: '443', tld: 'com', domain: 'redacted' }, origin: 'https://redacted.com', strategy: 'http', visiting: false, domainName: 'redacted.com', fileServer: null }
2018-12-11T18:39:38.9137491Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:proxy handling proxied request { url: '/misc-cypress-intermittant/integrationTests/static/tr.ashx/1.1.7069.0/en/dist/integrationTests-desktop/entry.js', proxiedUrl: 'https://redacted.com/misc-cypress-intermittant/integrationTests/static/tr.ashx/1.1.7069.0/en/dist/integrationTests-desktop/entry.js', headers: { host: 'redacted.com', connection: 'keep-alive', 'user-agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Cypress/3.1.0 Chrome/59.0.3071.115 Electron/1.8.2 Safari/537.36', accept: '*/*', referer: 'https://redacted.com/misc-cypress-intermittant/integrationTests/desktop?theme=black&lang=en&testId=11544553578708', 'accept-encoding': 'gzip, deflate', 'accept-language': 'en-US', cookie: 'redacted_81=IHMLBPKM' }, remoteState: { auth: null, props: { port: '443', tld: 'com', domain: 'redacted' }, origin: 'https://redacted.com', strategy: 'http', visiting: false, domainName: 'redacted.com', fileServer: null } }
2018-12-11T18:39:38.9557961Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:proxy received response for { url: 'https://redacted.com/misc-cypress-intermittant/integrationTests/static/tr.ashx/1.1.7069.0/en/dist/integrationTests-desktop/entry.js', headers: { 'cache-control': 'public, max-age=31535569', 'content-type': 'text/javascript', 'content-encoding': 'gzip', expires: 'Wed, 11 Dec 2019 18:32:28 GMT', vary: 'Accept-Encoding', server: 'Microsoft-IIS/8.5', 'x-aspnet-version': '4.0.30319', 'access-control-allow-origin': '*', 'x-powered-by': 'ASP.NET', 'x-iit-server': 'WEB5-DK1', date: 'Tue, 11 Dec 2018 18:39:38 GMT', 'content-length': '4256252' }, statusCode: 200, isGzipped: true, wantsInjection: false, wantsSecurityRemoved: false }
2018-12-11T18:39:38.9615211Z Tue, 11 Dec 2018 18:39:38 GMT cypress:server:proxy received response for { url: 'https://redacted.com/misc-cypress-intermittant/opencss/css/11.7/go-desktop/MSw1/black?dir=ltr&cache=7268D8ABA48087E54FF1C5DF5D8E0DEC&_=1.1.7069.0', headers: { 'cache-control': 'public, max-age=31536000', 'transfer-encoding': 'chunked', 'content-type': 'text/css; charset=utf-8', 'content-encoding': 'gzip', expires: 'Wed, 11 Dec 2019 18:39:38 GMT', etag: '",7A3449654F7898B78A8A6224EAEBD166,False,go-desktop"', vary: 'Accept-Encoding', server: 'Microsoft-IIS/8.5', 'access-control-allow-origin': '*', 'opencss-server-version': '3.2.43.99', 'opencss-framework-version': 'single-version', 'x-aspnet-version': '4.0.30319', 'x-powered-by': 'ASP.NET', 'x-iit-server': 'WEB5-DK1', date: 'Tue, 11 Dec 2018 18:39:38 GMT' }, statusCode: 200, isGzipped: true, wantsInjection: false, wantsSecurityRemoved: false }
failed:
2018-12-11T18:39:44.2166856Z Tue, 11 Dec 2018 18:39:44 GMT cypress:server:socket automation:request 'clear:cookies' [ { name: 'redacted_81',
2018-12-11T18:39:44.2167040Z value: 'IHMLBPKM',
2018-12-11T18:39:44.2167155Z path: '/',
2018-12-11T18:39:44.2167280Z domain: 'redacted.com',
2018-12-11T18:39:44.2167372Z secure: false,
2018-12-11T18:39:44.2167459Z httpOnly: false } ]
2018-12-11T18:39:44.2343784Z Tue, 11 Dec 2018 18:39:44 GMT cypress:server:socket backend:request { eventName: 'resolve:url', args: [ 'https://redacted.com/misc-cypress-intermittant/integrationTests/desktop?theme=black&lang=en&testId=21544553584219', { failOnStatusCode: true, auth: null } ] }
2018-12-11T18:39:44.2347116Z Tue, 11 Dec 2018 18:39:44 GMT cypress:server:server resolving visit { url: 'https://redacted.com/misc-cypress-intermittant/integrationTests/desktop?theme=black&lang=en&testId=21544553584219', headers: { host: 'redacted.com', connection: 'Upgrade', pragma: 'no-cache', 'cache-control': 'no-cache', upgrade: 'websocket', origin: 'https://redacted.com', 'sec-websocket-version': '13', 'user-agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Cypress/3.1.0 Chrome/59.0.3071.115 Electron/1.8.2 Safari/537.36', 'accept-encoding': 'gzip, deflate', 'accept-language': 'en-US', cookie: 'redacted_81=IHMLBPKM', 'sec-websocket-key': 'nAcme1J4zuBo0QqGC70S0A==', 'sec-websocket-extensions': 'permessage-deflate; client_max_window_bits' }, options: { failOnStatusCode: true, auth: null } }
2018-12-11T18:39:44.2349049Z Tue, 11 Dec 2018 18:39:44 GMT cypress:server:server Getting remote state: { auth: null, props: { port: '443', tld: 'com', domain: 'redacted' }, origin: 'https://redacted.com', strategy: 'http', visiting: false, domainName: 'redacted.com', fileServer: null }
2018-12-11T18:39:44.2822970Z Tue, 11 Dec 2018 18:39:44 GMT cypress:server:server received response for resolving url { isOkStatusCode: true, isHtml: true, contentType: 'text/html', url: 'https://redacted.com/misc-cypress-intermittant/integrationTests/desktop?theme=black&lang=en&testId=21544553584219', status: 200, cookies: [ { key: 'redacted_81', value: 'IHMLBPKM', domain: 'redacted.com', path: '/', hostOnly: true, creation: '2018-12-11T18:39:44.280Z', lastAccessed: '2018-12-11T18:39:44.280Z', name: 'redacted_81' } ], statusText: 'OK', redirects: [], originalUrl: 'https://redacted.com/misc-cypress-intermittant/integrationTests/desktop?theme=black&lang=en&testId=21544553584219' }
2018-12-11T18:39:44.2823568Z Tue, 11 Dec 2018 18:39:44 GMT cypress:server:server Setting remoteAuth null
2018-12-11T18:39:44.2825925Z Tue, 11 Dec 2018 18:39:44 GMT cypress:server:cors Parsed URL { port: '443', tld: 'com', domain: 'redacted' }
2018-12-11T18:39:44.2826339Z Tue, 11 Dec 2018 18:39:44 GMT cypress:server:server Setting remoteOrigin https://redacted.com
2018-12-11T18:39:44.2826911Z Tue, 11 Dec 2018 18:39:44 GMT cypress:server:server Setting remoteHostAndPort { port: '443', tld: 'com', domain: 'redacted' }
2018-12-11T18:39:44.2827092Z Tue, 11 Dec 2018 18:39:44 GMT cypress:server:server Setting remoteDocDomain redacted.com
2018-12-11T18:39:44.2829273Z Tue, 11 Dec 2018 18:39:44 GMT cypress:server:server Getting remote state: { auth: null, props: { port: '443', tld: 'com', domain: 'redacted' }, origin: 'https://redacted.com', strategy: 'http', visiting: false, domainName: 'redacted.com', fileServer: null }
In my case above, it looks like the proxy never catches the request
e.g.
cypress:server:proxy handling proxied request never gets called. At the start it triggers the second Getting remote state and theres no log messages inbetween
@jennifer-shehane should I open the above in a new issue or keep on the above? will becoming a subscriber to the dashboard help in getting the above investigated?
The cy.visit command is defined here: https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/cy/commands/navigation.coffee#L458
Released in 3.1.5.
@denisLoncaric Please open a new issue, adding reproducible steps to recreate the issue please.
This issue exists for same url with different hashes as well. i.e. from #1687:
it("Multiple visits with hash", function() {
cy.visit("https://www.google.com#x1");
cy.visit("https://www.google.com#x2");
cy.visit("https://www.google.com#x3");
});
The second visit will timeout.
This issue will be closed to further comment as the exact issue here was resolved and tested.
If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.
Most helpful comment
I have encountered this behavior when visiting the same url that I am currently on. So, if you run the code below, Cypress waits for the
onloadevent on the first visit, but on the second one, theonloadevent is not going to be fired since you are on the exact same page. Cypress eventually times out.Is there a reason why you need to visit the same url? Could using
cy.reload()resolve your usecase?I think we could handle this situation better in Cypress - as I was very confused when I encountered it as well. I was not blatantly visiting the same url either, my use case was:
@brian-mann thoughts?