test(geschichte): replace waitForDebounce sleep with retrying locator waits (#795)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,8 +4,6 @@ import { page, userEvent } from 'vitest/browser';
|
||||
import { m } from '$lib/paraglide/messages.js';
|
||||
import StoryDocumentPanel from './StoryDocumentPanel.svelte';
|
||||
|
||||
const waitForDebounce = () => new Promise((r) => setTimeout(r, 350));
|
||||
|
||||
const docSummary = (id: string, title: string) => ({
|
||||
id,
|
||||
title,
|
||||
@@ -79,7 +77,7 @@ const defaultProps = (overrides: Record<string, unknown> = {}) => ({
|
||||
|
||||
async function addViaPicker(title: RegExp) {
|
||||
await userEvent.fill(page.getByRole('combobox'), 'Brief');
|
||||
await waitForDebounce();
|
||||
await expect.element(page.getByText(title)).toBeInTheDocument();
|
||||
await userEvent.click(page.getByText(title));
|
||||
}
|
||||
|
||||
@@ -160,7 +158,7 @@ describe('StoryDocumentPanel — add', () => {
|
||||
);
|
||||
|
||||
await userEvent.fill(page.getByRole('combobox'), 'Brief');
|
||||
await waitForDebounce();
|
||||
await expect.element(page.getByRole('option')).toBeInTheDocument();
|
||||
|
||||
const option = document.querySelector('[role="listbox"] [role="option"]');
|
||||
expect(option?.getAttribute('aria-disabled')).toBe('true');
|
||||
|
||||
Reference in New Issue
Block a user