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

Support Network.setCacheDisabled command for Firefox #23580

Open
shwarcu opened this issue Aug 27, 2022 · 4 comments
Open

Support Network.setCacheDisabled command for Firefox #23580

shwarcu opened this issue Aug 27, 2022 · 4 comments
Labels
browser: firefox E2E Issue related to end-to-end testing type: enhancement Requested enhancement of existing feature

Comments

@shwarcu
Copy link

shwarcu commented Aug 27, 2022

What would you like?

I googled a bit and it looks like that Firefox should also support following workaround for cached requests

  Cypress.automation('remote:debugger:protocol', {
    command: 'Network.enable',
    params: {},
  });
  Cypress.automation('remote:debugger:protocol', {
    command: 'Network.setCacheDisabled',
    params: { cacheDisabled: true },
  });

Mozilla documentation https://wiki.mozilla.org/WebDriver/RemoteProtocol
provides a list of supported commands
https://docs.google.com/spreadsheets/d/e/2PACX-1vRqKh563C0b0pnJruf85REpviTERnEoNEITEH3v9RvSCpkLzu9vw8c8_PAIgJoUpnUviVHV93u4V8V_/pubhtml?gid=108099026&single=true
and Network.setCacheDisabled is listed there as supported (experimental).
You can also find commits that added support for this command in the Firefox.

However when trying to run above workaround on Firefox, we get such error
Screenshot from 2022-08-27 10-09-14

Event:      uncaught exception [index.347a0a6e.js:98212:13](https://127.0.0.1:8080/__/assets/index.347a0a6e.js)
Caught by:  "unhandledrejection" handler [index.347a0a6e.js:98212:13](https://127.0.0.1:8080/__/assets/index.347a0a6e.js)
Error:      Error: No handler registered for: 'remote:debugger:protocol'
     automation cypress_runner.js:163965
     ./cypress/support/e2e.ts e2e.ts:35
    Webpack 15

Issue related to #14459

Why is this needed?

Cypress does not provide a solution for not-working cy.intercept when request is cached by a Browser,
We are forced to use workaround from issue #14459.
But Cypress did not implement handler (?) for this remote debugger protocol command for Firefox. So we can't use that workaround when running tests on Firefox

Other

No response

@nagash77 nagash77 added E2E Issue related to end-to-end testing and removed E2E-core labels Nov 8, 2022
@flotwig
Copy link
Contributor

flotwig commented Nov 8, 2022

Related: #7942

For now, the automation.use invocation in firefox-util.ts can be updated to pass remote:debugger:protocol commands to the FF CDP client, since we already connect to it.

@shwarcu
Copy link
Author

shwarcu commented Nov 10, 2022

I will take a look and try to contribute if I don't leave my place for the weekend

@Havrin
Copy link

Havrin commented Jan 20, 2023

just noticed this error in our tests only in firefox. +1 to fix it!

@MDG-JHowley
Copy link

Can possibly be resolved with user prefs e.g.

// in Cypress config, `setupNodeEvents`
on('before:browser:launch', (browser, launchOptions) => {
    if (browser.family === 'firefox') {
      launchOptions.preferences['browser.cache.disk.enable'] = false;
      launchOptions.preferences['browser.cache.memory.enable'] = false;

      return launchOptions;
    }
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser: firefox E2E Issue related to end-to-end testing type: enhancement Requested enhancement of existing feature
Projects
None yet
Development

No branches or pull requests

5 participants