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

Fullscreen permissions error #28557

Open
JasonStrazisar opened this issue Dec 20, 2023 · 2 comments
Open

Fullscreen permissions error #28557

JasonStrazisar opened this issue Dec 20, 2023 · 2 comments
Labels
stage: needs investigating Someone from Cypress needs to look at this stale no activity on this issue for a long period

Comments

@JasonStrazisar
Copy link

JasonStrazisar commented Dec 20, 2023

Current behavior

When we try to enter full screen mode, by clicking on a button, we got this error:

Unhandled Runtime Error TypeError: Permissions check failed
Capture d’écran 2023-12-20 à 11 07 59

Wich happen only on cypress. I believe it is because chrome does not allow cypress to go fullscreen.

Desired behavior

The behavior should be to be to able to enter fullscreen (like when you press F11 or when you enter on fullscreen on a youtube video. So we could test that the app behave correctly in fullscreen.

Test code to reproduce

  • Test:
describe("Dashboard fullscreen", () => {
  beforeEach(() => {
    cy.fixture("users").then((users) => {
      cy.loginAndNavigateTo("/modules/%2Fmodules%2F1/pages/%2Fpages%2F1-performance-margin", users.superuser);
    });
  });

  it("Should enter and quit fullscreen", () => {
    cy.intercept("GET", "/pages/*").as("getPage");
    cy.wait("@getPage");

    cy.get("main").scrollTo("bottom");
    cy.get("button[name=enter_fullscreen]").click();


  });
});
  • toggleFullScreen method:
export function useFullScreen(): FullScreenHook {
  const [isFullScreen, setIsFullScreen] = React.useState<boolean>(false);

  React.useEffect(() => {
    const handleFullScreenChange = () => {
      setIsFullScreen(document.fullscreenElement !== null);
    };

    document.addEventListener("fullscreenchange", handleFullScreenChange);

    return () => {
      document.removeEventListener("fullscreenchange", handleFullScreenChange);
    };
  }, []);

  function toggleFullScreen() {
    if (!isFullScreen) {
      document.documentElement.requestFullscreen();
    } else {
      document.exitFullscreen();
    }
  }

  return {
    isFullScreen,
    toggleFullScreen,
  };
}

Cypress Version

v10.4.0

Node version

v20.9.0

Operating System

macOS 14.1 (23B2073)

Debug Logs

No response

Other

No response

@jennifer-shehane
Copy link
Member

I wonder if you clicked using cypress-real-events plugin if the behavior would be different. I was recently reading about how browsers need user activation before going fullscreen and I know this plugin will simulate that. I’f be interested to know. https://developer.mozilla.org/en-US/docs/Web/Security/User_activation

@jennifer-shehane jennifer-shehane added the stage: awaiting response Potential fix was proposed; awaiting response label Dec 21, 2023
@jennifer-shehane jennifer-shehane added stage: needs investigating Someone from Cypress needs to look at this and removed stage: awaiting response Potential fix was proposed; awaiting response labels Feb 29, 2024
@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: needs investigating Someone from Cypress needs to look at this stale no activity on this issue for a long period
Projects
None yet
Development

No branches or pull requests

3 participants