test(site): e2e: improve webTerminal test (#9659)

This commit is contained in:
Marcin Tojek
2023-09-13 16:18:10 +02:00
committed by GitHub
parent 4ebf490d97
commit a229855e71
2 changed files with 12 additions and 10 deletions
+3
View File
@@ -34,6 +34,9 @@ export default defineConfig({
use: {
baseURL: `http://localhost:${port}`,
video: "retain-on-failure",
launchOptions: {
args: ["--disable-webgl"],
},
},
webServer: {
url: `http://localhost:${port}/api/v2/deployment/config`,
+9 -10
View File
@@ -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);
});