mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
test(site): e2e: improve webTerminal test (#9659)
This commit is contained in:
@@ -41,19 +41,18 @@ test("web terminal", async ({ context, page }) => {
|
||||
const terminal = await pagePromise;
|
||||
await terminal.waitForLoadState("domcontentloaded");
|
||||
|
||||
const xtermRows = await terminal.waitForSelector("div.xterm-rows", {
|
||||
state: "visible",
|
||||
});
|
||||
|
||||
// Ensure that we can type in it
|
||||
await terminal.keyboard.type("echo hello");
|
||||
await terminal.keyboard.type("echo he${justabreak}llo");
|
||||
await terminal.keyboard.press("Enter");
|
||||
|
||||
const locator = terminal.locator("text=hello");
|
||||
// Check if "echo" command was executed
|
||||
await xtermRows.waitForSelector('div:text-matches("hello")', {
|
||||
state: "visible",
|
||||
});
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const items = await locator.all();
|
||||
// Make sure the text came back
|
||||
if (items.length === 2) {
|
||||
break;
|
||||
}
|
||||
await new Promise((r) => setTimeout(r, 250));
|
||||
}
|
||||
await stopAgent(agent);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user