Skip to content

Commit 2dc7976

Browse files
authored
Merge pull request #3357 from AtCoder-NoviSteps/#3356
test(e2e): fix broken test and update docs (#3356)
2 parents 3fc12c0 + d487305 commit 2dc7976

7 files changed

Lines changed: 72 additions & 2131 deletions

File tree

.claude/rules/testing-e2e.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ await expect(toggleInput).toBeChecked({ checked: true });
8888

8989
The same pattern applies to any Flowbite component that visually overlays its native input (e.g. `Checkbox`, `Radio`).
9090

91+
## Waiting for Svelte Transitions
92+
93+
Svelte's `{#if}/{:else}` blocks with transitions may temporarily render multiple elements with the same selector during outro/intro overlap. Playwright locators may match either element non-deterministically, causing flaky tests.
94+
95+
Use `waitForFunction` with `Array.from(elements).every(...)` to explicitly wait until **all** matching elements reach the desired state before asserting — checking every element guards against the transient window where multiple elements coexist. **Do not use assertions as implicit sleeps** — separating wait logic from assertions makes test intent clear and avoids timing-dependent failures.
96+
97+
This pattern applies to any Svelte component with transitions: modals, drawers, dropdowns, etc.
98+
9199
## Strict Mode: Scope Locators to the Content Area
92100

93101
When the navbar and page body both contain a link or button with the same text (e.g., a breadcrumb and a nav link share the same label), `getByRole` in strict mode will find multiple matches and throw. Scope the locator to the page's content container:

0 commit comments

Comments
 (0)