Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions site/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
19 changes: 9 additions & 10 deletions site/e2e/tests/webTerminal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for reviewers: once this loop is over, and no items have been located, nothing happens even though the test should fail

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);
});