2023-04-10 00:11:31 +02:00
|
|
|
import { beforeMount, afterMount } from '@playwright/experimental-ct-react17/hooks';
|
2022-12-27 23:26:17 +01:00
|
|
|
import { BrowserRouter } from 'react-router-dom';
|
|
|
|
|
import '../src/assets/index.css';
|
2022-07-12 18:37:33 +02:00
|
|
|
|
2022-10-18 22:04:54 +02:00
|
|
|
export type HooksConfig = {
|
2022-12-27 23:26:17 +01:00
|
|
|
route?: string;
|
|
|
|
|
routing?: boolean;
|
2022-10-18 22:04:54 +02:00
|
|
|
}
|
|
|
|
|
|
2022-12-27 23:26:17 +01:00
|
|
|
beforeMount<HooksConfig>(async ({ hooksConfig, App }) => {
|
2022-07-12 18:37:33 +02:00
|
|
|
console.log(`Before mount: ${JSON.stringify(hooksConfig)}`);
|
2022-12-27 23:26:17 +01:00
|
|
|
|
|
|
|
|
if (hooksConfig?.routing)
|
|
|
|
|
return <BrowserRouter><App /></BrowserRouter>;
|
2022-07-12 18:37:33 +02:00
|
|
|
});
|
|
|
|
|
|
2022-10-18 22:04:54 +02:00
|
|
|
afterMount<HooksConfig>(async () => {
|
2022-07-12 18:37:33 +02:00
|
|
|
console.log(`After mount`);
|
|
|
|
|
});
|