Fix playwright tests (#2695)
This commit is contained in:
1 parent
9479d2376d
commit
bd484842bd
28 files changed
+477
-330
No files matched your search
@@ -4,9 +4,23 @@ const { test, expect } = require("@playwright/test");
|
||||
test.use({ javaScriptEnabled: false });
|
||||
|
||||
test("text appears in the body without javascript", async ({ page }) => {
|
||||
await page.goto("http://localhost:5050", { waitUntil: "commit" });
|
||||
// Wait for the page to finish building. Reload until it's ready
|
||||
for (let i = 0; i < 50; i++) {
|
||||
// If the page doesn't contain #building or "Backend connection failed", we're ready
|
||||
let building_count = await page.locator("#building").count();
|
||||
building_count += await page
|
||||
.locator("body", { hasText: "backend connection failed" })
|
||||
.count();
|
||||
if (building_count === 0) {
|
||||
break;
|
||||
}
|
||||
await page.waitForTimeout(1000);
|
||||
await page.goto("http://localhost:5050", { waitUntil: "commit" });
|
||||
}
|
||||
// If we wait until the whole page loads, the content of the site should still be in the body even if javascript is disabled
|
||||
// It will not be visible, and may not be in the right order/location, but SEO should still work
|
||||
await page.goto("http://localhost:5050");
|
||||
await page.waitForLoadState("load");
|
||||
|
||||
const body = page.locator("body");
|
||||
const textExpected = [
|
||||
|
||||
Reference in new issue
Block a user