From a229855e71dbca539c2af043ddec52fe88635dc2 Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Wed, 13 Sep 2023 16:18:10 +0200 Subject: [PATCH] test(site): e2e: improve webTerminal test (#9659) --- site/e2e/playwright.config.ts | 3 +++ site/e2e/tests/webTerminal.spec.ts | 19 +++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/site/e2e/playwright.config.ts b/site/e2e/playwright.config.ts index 359a5bca9b..26eb0a7d42 100644 --- a/site/e2e/playwright.config.ts +++ b/site/e2e/playwright.config.ts @@ -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`, diff --git a/site/e2e/tests/webTerminal.spec.ts b/site/e2e/tests/webTerminal.spec.ts index 9c4f283b80..01d40c03d8 100644 --- a/site/e2e/tests/webTerminal.spec.ts +++ b/site/e2e/tests/webTerminal.spec.ts @@ -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); });