Skip to content

onLoad not being called on second cy.visit to current url #1311

@millarm

Description

@millarm
  • Operating System: CircleCI 2.0 running the docker container node-9.5.0-browsers and node-8.9.4-browsers
  • Cypress Version: 1.4.2
  • Browser Version: electron 53
{ 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 } }

Is this a Feature or Bug?

Bug

Current behavior:

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
    }})

Desired behavior:

  • Running in electron on MacOS this runs fine
  • Running in Chrome on MacOS this runs fine
  • Running in Electron on Circle CI the onLoad is never called - resulting in
  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

How to reproduce:

100% reproducible on CircleCI

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions