Skip to content

Commit 225cf8a

Browse files
authored
chore: print page content on failed promise (#9681)
1 parent dcad0a4 commit 225cf8a

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

site/e2e/tests/webTerminal.spec.ts

+17-5
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,30 @@ test("web terminal", async ({ context, page }) => {
4141
const terminal = await pagePromise;
4242
await terminal.waitForLoadState("domcontentloaded");
4343

44-
const xtermRows = await terminal.waitForSelector("div.xterm-rows", {
44+
await terminal.waitForSelector("div.xterm-rows", {
4545
state: "visible",
4646
});
4747

4848
// Ensure that we can type in it
49-
await terminal.keyboard.type("echo he${justabreak}llo");
49+
await terminal.keyboard.type("echo he${justabreak}llo123456");
5050
await terminal.keyboard.press("Enter");
5151

5252
// Check if "echo" command was executed
53-
await xtermRows.waitForSelector('div:text-matches("hello")', {
54-
state: "visible",
55-
});
53+
// try-catch is used temporarily to find the root cause: https://github.com/coder/coder/actions/runs/6176958762/job/16767089943
54+
try {
55+
await terminal.waitForSelector(
56+
'div.xterm-rows div:text-matches("hello123456")',
57+
{
58+
state: "visible",
59+
timeout: 10 * 1000,
60+
},
61+
);
62+
} catch (error) {
63+
const pageContent = await terminal.content();
64+
// eslint-disable-next-line no-console -- Let's see what is inside of xterm-rows
65+
console.log("Unable to find echoed text:", pageContent);
66+
throw error;
67+
}
5668

5769
await stopAgent(agent);
5870
});

0 commit comments

Comments
 (0)