playwright/tests/components/ct-svelte-vite/playwright/index.ts

21 lines
487 B
TypeScript
Raw Normal View History

import '../src/assets/index.css';
import { beforeMount, afterMount } from '@playwright/experimental-ct-svelte/hooks';
2022-10-18 22:04:54 +02:00
export type HooksConfig = {
2023-08-20 01:26:06 +02:00
context?: string;
route?: string;
2022-10-18 22:04:54 +02:00
}
2023-08-20 01:26:06 +02:00
beforeMount<HooksConfig>(async ({ hooksConfig, App }) => {
console.log(`Before mount: ${JSON.stringify(hooksConfig)}`);
2023-08-20 01:26:06 +02:00
return new App({
context: new Map([
['context-key', hooksConfig?.context]
]),
});
});
2022-10-18 22:04:54 +02:00
afterMount<HooksConfig>(async () => {
console.log(`After mount`);
});