Skip to content

Commit

Permalink
try fixing a test case that fails only on CI env
Browse files Browse the repository at this point in the history
Example failure:  https://cloud.cypress.io/projects/o1ooqz/runs/227/overview/cc4afd39-ae2f-4cda-a266-b1541b9b875c/replay?roarHideRunsWithDiffGroupsAndTags=1&ts=1719867762671.1587&att=1
The reason is an unexpected scroll happens when the context menu is opened. It does not happen locally either in cypress app or when running headless.
  • Loading branch information
alirezamirian committed Jul 1, 2024
1 parent 54ac89e commit 909b6bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/jui/src/Menu/Menu.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,8 @@ describe("ContextMenu", () => {
cy.get("[role=menu]").should("not.exist");
});

it("is closed when right clicking outside the context menu trigger area", () => {
cy.mount(<ContextMenu />);
it.only("is closed when right clicking outside the context menu trigger area", () => {
cy.mount(<ContextMenu noScroll />);
cy.get("#context-menu-container").rightclick(150, 150, {
scrollBehavior: false,
});
Expand Down
7 changes: 5 additions & 2 deletions packages/jui/src/Menu/Menu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,10 @@ const StyledContainer = styled.div`

export const ContextMenu: StoryObj<{
children?: ReactNode;
noScroll: boolean;
menuProps?: Partial<MenuProps<object>>;
}> = {
render: ({ children, menuProps = {} }) => {
render: ({ children, noScroll, menuProps = {} }) => {
return (
<>
<div
Expand Down Expand Up @@ -286,7 +287,9 @@ export const ContextMenu: StoryObj<{
</Menu>
)}
>
<StyledContainer>Right click somewhere. {children}</StyledContainer>
<StyledContainer style={{ height: noScroll ? "75vh" : null }}>
Right click somewhere. {children}
</StyledContainer>
</ContextMenuContainer>
</>
);
Expand Down

0 comments on commit 909b6bf

Please sign in to comment.