From 1a4a1b121b39c387707a85567d76f025e1abe429 Mon Sep 17 00:00:00 2001 From: Jens Grochtdreis <jens.grochtdreis@swr.de> Date: Thu, 14 Mar 2024 16:59:29 +0100 Subject: [PATCH] Konfigurationen um extra CSS-Datei erweitert --- playwright.config.js | 37 ++++++------------------------------- screenshot.config.js | 5 ++++- screenshots.css | 10 ++++++++++ 3 files changed, 20 insertions(+), 32 deletions(-) create mode 100644 screenshots.css diff --git a/playwright.config.js b/playwright.config.js index 34cb191..b5a66ba 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -22,7 +22,10 @@ module.exports = defineConfig({ * Maximum time expect() should wait for the condition to be met. * For example in `await expect(locator).toHaveText();` */ - timeout: 5000 + timeout: 5000, + toHaveScreenshot: { + stylePath: './screenshots.css' + } }, /* Fail the build on CI if you accidentally left test.only in the source code. */ forbidOnly: !!process.env.CI, @@ -36,8 +39,6 @@ module.exports = defineConfig({ use: { /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ actionTimeout: 0, - /* Base URL to use in actions like `await page.goto('/')`. */ - // baseURL: 'http://localhost:3000', /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry', @@ -58,36 +59,10 @@ module.exports = defineConfig({ { name: 'webkit', use: { ...devices['Desktop Safari'] }, - }, - - /* Test against mobile viewports. */ - // { - // name: 'Mobile Chrome', - // use: { ...devices['Pixel 5'] }, - // }, - // { - // name: 'Mobile Safari', - // use: { ...devices['iPhone 12'] }, - // }, - - /* Test against branded browsers. */ - // { - // name: 'Microsoft Edge', - // use: { channel: 'msedge' }, - // }, - // { - // name: 'Google Chrome', - // use: { channel: 'chrome' }, - // }, + } ], /* Folder for test artifacts such as screenshots, videos, traces, etc. */ - outputDir: 'test-results/', - - /* Run your local dev server before starting the tests */ - // webServer: { - // command: 'npm run start', - // port: 3000, - // }, + outputDir: 'test-results/' }); diff --git a/screenshot.config.js b/screenshot.config.js index 3565bda..96b1b00 100644 --- a/screenshot.config.js +++ b/screenshot.config.js @@ -19,7 +19,10 @@ module.exports = defineConfig({ * Maximum time expect() should wait for the condition to be met. * For example in `await expect(locator).toHaveText();` */ - timeout: 5000 + timeout: 5000, + toHaveScreenshot: { + stylePath: './screenshots.css' + } }, /* Run tests in files in parallel */ fullyParallel: true, diff --git a/screenshots.css b/screenshots.css new file mode 100644 index 0000000..53ef977 --- /dev/null +++ b/screenshots.css @@ -0,0 +1,10 @@ +#playerbar { display: none !important;} +#header {position: relative !important;} +#header.nav-down, +#header.nav-up { top: 0; animation: none;} + +#header-main-navi-header#header-main-navi-header, #header-main-navi-header#header-main-navi-header.search-open { + position: relative; + left: initial; + transform: initial; +} \ No newline at end of file -- GitLab