playwright/tests/components/ct-vue-cli/playwright/index.ts

21 lines
631 B
TypeScript
Raw Normal View History

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 = {
route?: string;
routing?: boolean;
2022-10-18 22:04:54 +02:00
}
beforeMount<HooksConfig>(async ({ app, hooksConfig }) => {
if (hooksConfig?.routing)
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}`);
});