-
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
Clipboard works with cypress open and not cypress run (permissions) #8957
Comments
Adding the following code at the beginning of my test body resolved it for me in the headless: cy.wrap(
Cypress.automation('remote:debugger:protocol', {
command: 'Browser.grantPermissions',
params: {
permissions: ['clipboardReadWrite', 'clipboardSanitizedWrite'],
origin: window.location.origin,
},
}),
); |
Does this help anyone? #21673 (comment) For me the same issue appears to be intermittently failing my headless tests however I have not been able to successfully test the success of something like: const setFocusEmulationEnabled = (enabled: boolean): any => {
return cy.wrap(
Cypress.automation("remote:debugger:protocol", {
command: "Emulation.setFocusEmulationEnabled",
params: {
enabled
},
}),
);
}; As at the moment I have been testing it, setting it false also seems to yield document.hasFocus() true, and subsequent tests after removing the call all together are also working (until they won't). This involves diving deep into Chrome internals to debug it, something I am not very familiar with at this time. |
Current behavior
I have a test that is testing clipboard functionality. When I run
cypress open --browser chromium
, my tests are passing, but when I am runningcypress run --browser chromium
they will not pass. Error is that the app (not the test) can not read the clipboard withwindow.navigator.clipboard.readText()
without manually granting permission inside chromium.Why am I getting this behavior only with
cypress run
? How can I bypass it?I've been debugging, passing
DEBUG=cypress:launcher
and found that the browser launch arguments are identical. I have noticed one huge difference within the chromium browser: when I go toSettings>Security>Safe Browsing
, it is set to "Standard protection" when runningcypress run
, but it's set toNo protection
when usingcypress open
.(Manually setting Safe Browsing to 'No protection' and re-running tests does not fix the issue)
Desired behavior
Same browser behavior with
cypress open
andcypress run
when the provided configuration is identical.Versions
5.2.0
The text was updated successfully, but these errors were encountered: