Allow cold lazy modules to load in library tests
All checks were successful
Validate Sokko G / validate (push) Successful in 17m27s

This commit is contained in:
Shinuwa 2026-10-23 20:22:32 +02:00
parent 27a6c90c25
commit 153311494d

View file

@ -4,6 +4,8 @@ import { test, expect } from "@playwright/test";
import { LIBRARY_CATEGORY_DEFINITIONS } from "../website/src/features/toolboxes/toolboxModuleRegistry.js";
import { resetSokkoStorage } from "./helpers/storage.js";
const LAZY_TOOL_TIMEOUT = 15_000;
async function readStoredLibraryCopy(page) {
return page.evaluate(async () => new Promise((resolve, reject) => {
const request = window.indexedDB.open("sokkog", 1);
@ -23,6 +25,7 @@ async function readStoredLibraryCopy(page) {
}
test("loads every library tool through the shared component registry", async ({ page }) => {
test.slow();
const errors = [];
page.on("pageerror", (error) => errors.push(error.message));
page.on("console", (message) => {
@ -35,8 +38,8 @@ test("loads every library tool through the shared component registry", async ({
const tools = page.locator(`[data-module-type="${type}"] .module-content`);
await expect(tools.first()).toBeVisible();
for (const tool of await tools.all()) {
await expect(tool.getByText("Chargement de l'outil...")).toHaveCount(0);
await expect(tool.locator(":scope > *").first()).toBeVisible();
await expect(tool.getByText("Chargement de l'outil...")).toHaveCount(0, { timeout: LAZY_TOOL_TIMEOUT });
await expect(tool.locator(":scope > *").first()).toBeVisible({ timeout: LAZY_TOOL_TIMEOUT });
}
}
}