Open Bug 1604723 Opened 2 years ago Updated 1 year ago

[meta] Support Cypress

Categories

(Remote Protocol :: Agent, task)

task
Not set
normal

Tracking

(Not tracked)

People

(Reporter: ato, Unassigned)

References

(Depends on 2 open bugs, Blocks 1 open bug, )

Details

(Keywords: meta)

Tracking bug for Cypress related issues with Firefox.

Blocks: 1602820
Keywords: meta

Does Cypress really depend on Puppeteer or does it make direct use of the Chrome dev-tools protocol? I only see references to CDP when checking the repository, but nothing about Puppeteer.

As James seconded on IRC it is using CDP directly.

No longer blocks: 1602820

Current commands in use seem to be:

Methods:

  • Browser.getVersion (supported)
  • Page.bringToFront (supported)
  • Page.captureScreenshot (supported - clip option soon via bug 1587845)
  • Page.navigate (supported but there are issues with early returning - see bug 1603776)
  • Page.startScreencast (not supported)

Events:

  • Page.screencastFrame (not supported)
Depends on: 1587845, 1603776

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+1] from comment #2)

As James seconded on IRC it is using CDP directly.

Not only that, Cypress uses CDP through chrome-remote-interface, which we are fortunate enough to use for our browser-chrome testing! 👏🏻

Cypress also uses some Network.* commands to manage cookies: https://github.com/cypress-io/cypress/blob/develop/packages/server/lib/browsers/cdp_automation.ts

  • Network.setCookie bug 1588114
  • Network.deleteCookies bug 1549453
  • Network.getAllCookies - there does not seem to be an open bug for this
  • Network.getCookies bug 1549458

(In reply to Zach Bloomquist from comment #5)

  • Network.getAllCookies - there does not seem to be an open bug for this

Is that a new feature? I wonder why it isn't listed under https://chromedevtools.github.io/devtools-protocol/tot/Network. Maybe they missed to add it?

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+1] from comment #7)

(In reply to Zach Bloomquist from comment #5)

  • Network.getAllCookies - there does not seem to be an open bug for this

Is that a new feature? I wonder why it isn't listed under https://chromedevtools.github.io/devtools-protocol/tot/Network. Maybe they missed to add it?

What version of the API are you looking at? I see it in the docs for 1.3 and latest: https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-getAllCookies

Network.getAllCookies is a new feature as of 13th December of this year, introduced by 9349e8fc.

I made a similar comments with some more details on the review for bug 1590098 implementing Network.getCookies yesterday.

Depends on: 1605061

(In reply to Andreas Tolfsen 「:ato」 from comment #9)

Network.getAllCookies is a new feature as of 13th December of this year, introduced by 9349e8fc.

Hmm, that commit seems to say Tue Dec 13 17:12:37 2016, not Tue Dec 13 17:12:37 2019. I am not sure what exact release it was introduced in Chrome, but we've been using it in Cypress for at least a few months with no complaints from users (users use their Chrome version of choice)

Depends on: 1605377

Oops, years are apparently easy to misread (-:

Zach, which specific features of Emulation.setDeviceMetricsOverride is in use by Cypress? Could you check if the current Firefox Nightly build contains everything with bug 1544417 fixed? Thanks

Flags: needinfo?(z)

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+1] from comment #12)

Zach, which specific features of Emulation.setDeviceMetricsOverride is in use by Cypress? Could you check if the current Firefox Nightly build contains everything with bug 1544417 fixed? Thanks

It's used in 1 place, in Cypress's tests, here is how it's invoked:

https://github.com/cypress-io/cypress/blob/9f3f45aa10f75d7272465232594e7debe1aa5322/packages/server/test/support/fixtures/projects/e2e/cypress/support/index.js#L3-L13

Cypress uses width, height, deviceScaleFactor, mobile, screenWidth, and screenHeight. It looks like the first three of those are implemented, and the last two (screenHeight and screenWidth) actually seem to be redundant, so we don't need those for now.

mobile isn't implemented in FF yet, but we set it to false anyways, so that's fine too. Interestingly though, if I omit mobile from the arguments, Chrome responds with an error:

received CDP message { error: { code: -32602, message: 'Invalid parameters', data: 'mobile: boolean value expected' }, id: 6 } +12ms
Flags: needinfo?(z)

Yes, it's not raising an error because we don't have the mobile support yet. It will be added with bug 1608468.

You need to log in before you can comment on or make changes to this bug.