Skip to content

Commit

Permalink
robust a few test cases
Browse files Browse the repository at this point in the history
Some tests started to fail after the Github Action ubuntu container and cypress are upgraded
  • Loading branch information
alirezamirian committed Oct 2, 2023
1 parent c0f7979 commit f8a6475
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/jui/src/Checkbox/Checkbox.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe("Checkbox", () => {
);
cy.get("#dummyInput").focus(); // tabbing to the text input
cy.realPress("Tab"); // next tab should move focus to the checkbox
cy.focused().should("have.attr", "type", "checkbox");
cy.findByRole("checkbox").should("be.focused");

cy.mount(
<div id="component-container">
Expand All @@ -50,7 +50,7 @@ describe("Checkbox", () => {
);
cy.get("#dummyInput").focus(); // tabbing to the text input
cy.realPress("Tab"); // next tab should not focus the checkbox since excludeFromTabOrder is passed
cy.focused().should("not.exist");
cy.findByRole("checkbox").should("not.be.focused");
});

it("supports preventFocus", () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/jui/src/ToolWindows/ToolWindows.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const SimpleToolWindows = ({
>
<div style={{ padding: 8 }}>
<textarea data-testid="main content focusable" />
<div data-testid="main content non-focusable">main content</div>
</div>
</ToolWindows>
);
Expand Down Expand Up @@ -85,7 +86,7 @@ describe("ToolWindows", () => {
);
cy.contains("First window").click();
cy.findByTestId("First window focusable 2").click();
cy.get("body").click(500, 100);
cy.findByTestId("main content non-focusable").click();
cy.focused().should("exist");
cy.findByTestId("First window focusable 2").should("have.focus");
});
Expand Down
4 changes: 2 additions & 2 deletions packages/jui/src/Tree/Tree.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ describe("Tree", () => {
const onAction = cy.stub().as("onAction");
cy.mount(<Static onAction={onAction} />);

cy.contains("index.ts").dblclick();
cy.findByRole("treeitem", { name: "index.ts" }).dblclick();
cy.get("@onAction").should("be.calledOnceWith", "index.ts");
cy.contains("index.ts").type("{enter}");
cy.findByRole("treeitem", { name: "index.ts" }).type("{enter}");
cy.get("@onAction").should("be.calledTwice");
});

Expand Down

0 comments on commit f8a6475

Please sign in to comment.