From 16c48d4503a990e0494d6b111055bf619d35073d Mon Sep 17 00:00:00 2001 From: Raphael Schweikert Date: Tue, 19 Nov 2024 18:33:53 +0100 Subject: [PATCH] Tweak config to allow for higher tolerance --- build.gradle.kts | 1 + configs/playwright.config.ts | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f97e337..9cd65aa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -144,6 +144,7 @@ aem { inputs.dir("src/test/playwright") inputs.file("configs/playwright.config.ts") + outputs.dir(project.layout.buildDirectory.dir(name)) outputs.dir(project.layout.buildDirectory.dir("reports/$name")) } diff --git a/configs/playwright.config.ts b/configs/playwright.config.ts index fd2cd8a..66ec4fb 100644 --- a/configs/playwright.config.ts +++ b/configs/playwright.config.ts @@ -1,7 +1,7 @@ import { devices, PlaywrightTestConfig } from '@playwright/test'; import { getPort } from 'get-port-please'; -const outputDir = '../build/reports/playwright'; +const outputDir = '../build/playwright'; async function loadConfig(): Promise { const port = await getPort({ random: true }); @@ -21,7 +21,7 @@ async function loadConfig(): Promise { workers: process.env.CI ? 1 : undefined, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ reporter: [ - ['html', { open: 'never', outputFolder: outputDir }], + ['html', { open: 'never', outputFolder: '../build/reports/playwright' }], ['junit', { outputFile: `${outputDir}/TEST-playwright.xml` }], ], /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ @@ -43,6 +43,13 @@ async function loadConfig(): Promise { }, ], + expect: { + toHaveScreenshot: { + maxDiffPixelRatio: 0.05, + maxDiffPixels: 10, + } + }, + /* Run your local dev server before starting the tests */ webServer: { command: `npm run watch:serve -- --listen=${port}`,