2022-08-23 20:35:43 +02:00
|
|
|
import { beforeMount, afterMount } from '@playwright/experimental-ct-vue/hooks';
|
2022-11-08 17:40:29 +01:00
|
|
|
import { router } from '../src/router';
|
2023-02-27 21:53:44 +01:00
|
|
|
import Button from '../src/components/Button.vue';
|
2022-11-08 17:40:29 +01:00
|
|
|
import '../src/assets/index.css';
|
2022-08-23 20:35:43 +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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
beforeMount<HooksConfig>(async ({ app, hooksConfig }) => {
|
2022-12-27 23:26:17 +01:00
|
|
|
if (hooksConfig?.routing)
|
2024-01-19 02:50:52 +01:00
|
|
|
app.use(router as any);
|
2023-02-27 21:53:44 +01:00
|
|
|
app.component('Button', Button);
|
2022-08-23 20:35:43 +02:00
|
|
|
console.log(`Before mount: ${JSON.stringify(hooksConfig)}, app: ${!!app}`);
|
|
|
|
|
});
|
|
|
|
|
|
2022-10-18 22:04:54 +02:00
|
|
|
afterMount<HooksConfig>(async ({ instance }) => {
|
2022-08-23 20:35:43 +02:00
|
|
|
console.log(`After mount el: ${instance.$el.constructor.name}`);
|
|
|
|
|
});
|