Open
Description
Page(s)
https://playwright.dev/docs/next/test-components#hooks
// playwright/index.ts
import { beforeMount, afterMount } from '@playwright/experimental-ct-svelte/hooks';
export type HooksConfig = {
context?: string;
}
beforeMount<HooksConfig>(async ({ hooksConfig, App }) => {
return new App({
context: new Map([
['context-key', hooksConfig?.context]
]),
});
});
// context.test.ts
test('context', async ({ mount }) => {
const component = await mount<HooksConfig>(Context, {
hooksConfig: {
context: 'context-value',
}
});
await expect(component).toContainText('context-value');
});
Description
The hooks example for Svelte is missing