Wait for the hidden test drawer divider

Merged
PA
5h ago
+5-3

disabled execution hides the test drawer divider in tests/browser/test-drawer-resizer.test.js failed once in CI on #321 (actual: false at the isHidden() assertion) and passes locally and on main. The test reads isHidden() once right after domcontentloaded, but web/interview.js hides #test-drawer-resizer and #test-drawer in renderRuntimeConfig() from init(), which runs only after the module's top-level await loadProblem(...). DOMContentLoaded does not wait for a module's top-level await, so on a loaded runner the read can land before the hide.

The test now waits with locator.waitFor({ state: "hidden" }) for both elements. The divider has no hidden attribute in the markup and starts visible, so the wait cannot pass before init() runs.

Validation:

  • With every *.json request delayed by 1.5 s through page.route, the old one-shot read fails with actual: false and the new wait passes (scratch test, not committed).
  • node --test tests/browser/test-drawer-resizer.test.js: 4 pass, 0 fail.
  • ESLint and Prettier --check on the changed file pass. The full scripts/test.sh was not run locally; CI covers it.

Summary by cubic

Fixes the flaky disabled execution hides the test drawer divider browser test, which failed once in CI because it read isHidden() right after domcontentloaded. init() hides the divider and drawer only after the module's top-level await on the problem fetch, and DOMContentLoaded does not wait for that, so the read can land before the hide on a loaded runner. The test now waits for both elements with waitFor({ state: "hidden" }); since the divider starts visible, the wait cannot pass before init() runs.