Skip to content

Commit

Permalink
chore: test tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianWielga committed Sep 3, 2024
1 parent b427627 commit 8e5b93f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
11 changes: 4 additions & 7 deletions cypress/e2e/demo.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ context("WM", () => {
it("should maximize/restore window", () => {
cy.contains("with title").click();
cy.get("[data-testid='window-frame']").should("be.visible").as("window");
cy.get("@window").contains("scroll to bottom").should("be.enabled");
cy.document().matchImage({ screenshotConfig });
cy.get("@window").contains("with title").dblclick();
cy.document().matchImage({ screenshotConfig });
Expand All @@ -27,36 +26,34 @@ context("WM", () => {
it("should prevent window from going offscreen", () => {
cy.contains("danger").click();
cy.get("[data-testid='window-frame']").should("be.visible").as("window");
cy.contains("to bottom").should("be.enabled");
cy.contains("to bottom").should("be.disabled");
cy.document().matchImage({ screenshotConfig });
cy.viewport(500, 500);
cy.wait(defaultWait);
cy.get("[data-testid='window-frame']").matchImage({ screenshotConfig });
cy.contains("to bottom").should("be.enabled");
cy.viewport(1280, 815);
cy.viewport(1280, 720);
cy.wait(defaultWait);
cy.contains("to bottom").should("be.disabled");
cy.contains("add line").should("be.visible").click().click().click();
cy.contains("to bottom").should("be.enabled");
cy.get("[role=tree]").scrollIntoView();
cy.document().matchImage({ screenshotConfig });
});

it("should prevent window from going offscreen (minimal size)", () => {
cy.contains("minimal size").click();
cy.get("[data-testid='window-frame']").should("be.visible").as("window");
cy.contains("to bottom").should("be.enabled");
cy.contains("to bottom").should("be.disabled");
cy.document().matchImage({ screenshotConfig });
cy.viewport(500, 500);
cy.wait(defaultWait);
cy.get("[data-testid='window-frame']").matchImage({ screenshotConfig });
cy.contains("to bottom").should("be.enabled");
cy.viewport(1280, 830);
cy.viewport(1280, 720);
cy.wait(defaultWait);
cy.contains("to bottom").should("be.disabled");
cy.contains("add line").should("be.visible").click().click().click();
cy.contains("to bottom").should("be.enabled");
cy.get("[role=tree]").scrollIntoView();
cy.document().matchImage({ screenshotConfig });
});

Expand Down
4 changes: 2 additions & 2 deletions src/demo/DebugButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ export function DebugButtons({ currentId }: { currentId?: WindowId }): JSX.Eleme
return (
<div>
{buttons.map((props, index) => (
<div key={index}>
<span key={index}>
<button onClick={() => open(props)} style={{ fontWeight: "bold", color: "black", margin: ".5em" }}>
add({JSON.stringify(props)})
</button>
</div>
</span>
))}
<button style={{ margin: ".5em" }} onClick={() => closeAll()}>
close all
Expand Down
6 changes: 4 additions & 2 deletions src/demo/overflowDebug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ export const OverflowDebug = () => {
<button className={cx(className1, className2)} disabled={!scrollToBottom} onClick={scrollToBottom}>
scroll to bottom
</button>
<button className={cx(className1)} onClick={() => setData((s) => [...s, Math.random().toString()])}>
<button className={cx(className1)} onClick={() => setData((s) => [...s, "line"])}>
add line
</button>
<button className={cx(className1)} onClick={() => setData([])}>
clear
</button>

{data.map((e) => (
<p key={e}>{e}</p>
<div className={css({ fontSize: "3em", margin: "1em" })} key={e}>
{e}
</div>
))}
</>
);
Expand Down

0 comments on commit 8e5b93f

Please sign in to comment.