Skip to content

Commit

Permalink
test(Popup): try fixing list/tree sizing flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
alirezamirian committed Mar 17, 2024
1 parent 17eb0ab commit bdc0bf0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe("ModalWindow containing Tree", () => {
/>
</ModalWindow>
);
cy.findByRole("dialog").invoke("width").should("be.greaterThan", 180);
matchImageSnapshot("ModalWindow-sized-based-on-Tree");
});
});
Expand Down
22 changes: 16 additions & 6 deletions packages/jui/src/Popup/Popup.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,32 @@ import { composeStories } from "@storybook/react";
import * as stories from "./Popup.stories";
import { Popup } from "./Popup";

const { Default, DefaultPosition, DefaultSize, MenuContent, ListContent } =
composeStories(stories);
const {
Default,
DefaultPosition,
DefaultSize,
MenuContent,
ListContent,
TreeContent,
} = composeStories(stories);

describe("Popup", () => {
describe("sizing and positioning", () => {
it("Sets the size based on content, and places the popup centered, if no bounds provided", () => {
it.only("Sets the size based on content, and places the popup centered, if no bounds provided", () => {

Check failure on line 18 in packages/jui/src/Popup/Popup.cy.tsx

View workflow job for this annotation

GitHub Actions / build_and_test

it.only not permitted
cy.mount(<Default />);
matchImageSnapshot("Popup-default-bounds--simple");
cy.mount(<MenuContent />);
matchImageSnapshot("Popup-default-bounds--menu");

// List and Tree use virtualization, and are not immediately sized in the first render
cy.mount(<ListContent />);
cy.findByRole("dialog").invoke("width").should("be.greaterThan", 100);

matchImageSnapshot("Popup-default-bounds--list");
cy.mount(<TreeContent />);
cy.findByRole("dialog").invoke("width").should("be.greaterThan", 150);

// Tree uses virtualization, and sizing is flaky at the moment. FIXME
// cy.mount(<TreeContent />);
// matchImageSnapshot("Popup-default-bounds--tree");
matchImageSnapshot("Popup-default-bounds--tree");
});

it("takes default position into account, while setting size based on content", () => {
Expand Down
1 change: 1 addition & 0 deletions packages/jui/src/Tree/Tree.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe("Tree", () => {
cy.mount(<Static />);

cy.contains("Foo").click().type("{enter}");
cy.findByRole("treeitem", { name: "FooBar" });
matchImageSnapshot("Tree-nested-single-child-expansion");
});

Expand Down

0 comments on commit bdc0bf0

Please sign in to comment.