-
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
Failed to enter full screen of video player #1213
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
This is something that definitely requires our support of native browser events, as this cannot be done programatically: #311 |
Doesn't chromium have a CLI switch to bypass "API can only be initiated by a user gesture"? |
I'm not fluent in C++. I've looked into Chromium code and I didn't find a way to bypass this check. |
Does anyone have fix this issue ? or do you need help to investigate on this |
For now I am testing this by stubbing |
Can you show us how :) |
This approach assumes you use const stubFullscreenHandlers = (someDocument) => {
cy.stub(someDocument, "fullscreenEnabled")
.get(() => true)
.as("doc:fullscreenEnabled");
cy.stub(someDocument, "exitFullscreen").resolves().as("doc:exitFullscreen");
const stubbedRequestFullscreen = cy.stub().resolves().as("requestFullscreen");
const actualGetElementById = someDocument.getElementById;
cy.stub(someDocument, "getElementById")
.callsFake((elementId) => {
const el = actualGetElementById.call(someDocument, elementId);
el.requestFullscreen = stubbedRequestFullscreen;
return el;
})
.as("doc:getElementById");
};
cy.document().then(stubFullscreenHandlers);
cy.visit(...)
// code making fullscreen request |
any update on this. I am stuck with my player testing in fullscreen. Thank you! |
any update for testing full screen button |
Hi all, I just came across this discussion, and I found one temporary solution till cypress comes up with something Using .realHover() and .realClick() on the element, you can still go in full screen, |
This comment was marked as off-topic.
This comment was marked as off-topic.
+1 for this feature. Currently, I used the real-event workaround but native implementation would be much better. |
Waiting for this feature. Facing the same issue : |
This comment was marked as duplicate.
This comment was marked as duplicate.
Testing full screen is a need for us too |
This comment was marked as duplicate.
This comment was marked as duplicate.
thanks a lot ! works for me |
I ran across the docs recently on features gated by user activation and was reminded of this issue: https://developer.mozilla.org/en-US/docs/Web/Security/User_activation We should be triggering a user activation event in order to more fully simulate browser behavior. For the time being, using the https://github.com/dmtrKovalenko/cypress-real-events plugin to perform any action on the page (like clicking on a random div) should trigger user activation and make this full screen of the video player available. |
Is this a Feature or Bug?
bug
Current behavior:
Given a html video player
When I press the full screen button
Then the video player DOES NOT GO to full screen
...and then I can see the message in the console:
Failed to execute 'requestFullscreen' on 'Element': API can only be initiated by a user gesture.
Desired behavior:
Given a html video player
When I press the full screen button
Then the video player SHOULD GO to full screen
How to reproduce:
1. open https://plyr.io/ or any other html video player
2. press full screen button
Test code:
Additional Info (images, stack traces, etc)
I know the user gesture problem is really common, and this is the default browser behaviour, but it would be great to make it working correctly in Cypress as it should simulate user journey on tested page/application.
The text was updated successfully, but these errors were encountered: