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

The context of window is `undefined` when called within a `setTimeout` during strict mode #5707

jennifer-shehane opened this issue Nov 14, 2019 · 2 comments · Fixed by #5709


Copy link

@jennifer-shehane jennifer-shehane commented Nov 14, 2019

Current behavior:

The context of window is undefined when called within a setTimeout during strict mode - originally found in this issue: #5698

Desired behavior:

this should be window - not undefined.

Steps to reproduce: (app code and test code)


<!doctype html>
<html lang="en">
    'use strict';
    window.setTimeout(function () { = 'bar'
    }, 50)


it('asserts', () => {
  cy.window().its('foo').should('eq', 'bar')


Cypress 3.6.1

To Fix

This line of code below should be changed to:

return fnOrCode.apply(contentWindow, params)

I've confirmed this fixes the issue


This comment has been minimized.

Copy link

@cypress-bot cypress-bot bot commented Nov 15, 2019

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


This comment has been minimized.

Copy link

@cypress-bot cypress-bot bot commented Nov 27, 2019

Released in 3.7.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can’t perform that action at this time.