-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Cannot spy on browser Notification constructor function #6129
Comments
can this test be one of e2e tests in 4.0 branch? it('spies on Notification', () => {
cy.spy(window, 'Notification').as('Notification')
const f = new Notification('Hello')
cy.get('@Notification').should('have.been.calledWith', 'Hello')
}) Then I will feel safe :) |
Hmm, I'm a bit unsure of where a test like this should go. @chrisbreiding Do we have any similar tests like this in our repo? Any idea where a test like this would go? |
I think it could go along with the other cy.spy() tests in the driver. |
Found the original Sinon issue that was fixed in 4.1.3: sinonjs/sinon#1265 |
So... the I opened a bug report here: sinonjs/sinon#2215 Might open a PR, since it looks like a simple fix. |
Opened a PR over there to address the issue: sinonjs/sinon#2216 Once that gets merged and we update |
The code for this is done in cypress-io/cypress#6310, but has yet to be released. |
Sinon will release the fix in 9.0.0. Not sure why this issue has been left open... D: |
Cypress v3.8.1
Reproducible example in https://github.com/cypress-io/cypress-test-tiny/tree/spy-on-constructor
This test breaks with the error below
Note that spying on "regular" constructor functions works
and if we wrap Notification with our function that calls
new
then notifications are workingSo this seems like sinon.js problem in this case, but still very weird behavior
The text was updated successfully, but these errors were encountered: