feat: add shared fixtures for testing
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { test as base } from '@playwright/test';
|
||||
import { PerformanceMonitor } from '../utils/performance/PerformanceMonitor';
|
||||
import { LighthouseRunner } from '../utils/performance/LighthouseRunner';
|
||||
import { CoreWebVitals } from '../utils/performance/CoreWebVitals';
|
||||
|
||||
type MyFixtures = {
|
||||
performanceMonitor: PerformanceMonitor;
|
||||
lighthouseRunner: LighthouseRunner;
|
||||
coreWebVitals: CoreWebVitals;
|
||||
};
|
||||
|
||||
export const test = base.extend<MyFixtures>({
|
||||
performanceMonitor: async ({ page }, use) => {
|
||||
const monitor = new PerformanceMonitor(page);
|
||||
await use(monitor);
|
||||
},
|
||||
|
||||
lighthouseRunner: async ({ page }, use) => {
|
||||
const runner = new LighthouseRunner(page);
|
||||
await use(runner);
|
||||
},
|
||||
|
||||
coreWebVitals: async ({ page }, use) => {
|
||||
const vitals = new CoreWebVitals(page);
|
||||
await use(vitals);
|
||||
}
|
||||
});
|
||||
|
||||
export { expect } from '@playwright/test';
|
||||
Reference in New Issue
Block a user