-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Closed
Labels
P3-collecting-feedbackfeature-test-runnerPlaywright test specific issuesPlaywright test specific issues
Description
🚀 Feature Request
We have a custom screenshotTest fixture which does some basic setup for screenshot tests. We also have a updateSnaps pipeline for updating the reference screenshots. We only want to run the screenshot tests that pipeline. We focus the screenshot test using --grep @screenshot.
I.e. we would love something like this:
import { test as base } from '@playwright/test';
+ export const screenshotTest = base.extend<{ screenshotSetup: void, tags: void }>({
- export const screenshotTest = base.extend<{ screenshotSetup: void }>({
+ tags: ['@screenshot'],
screenshotSetup: [
async ({ }, use, testInfo) => {
const isCI =
process.env.CI === '1' ||
(process.env.CI && process.env.CI.toLowerCase() === 'true');
testInfo.skip(
!isCI,
"Test is skipped because it's not running in CI.\nIf this happens in CI, please verify that the CI environment variable is set correctly.",
);
await use();
},
{ auto: true },
],
});
Example
screenshotTest(
'review card should contain the star rating',
- { tag: '@screenshot' },
async () => {
const starRating = reviewsPage.getFirstReviewDetails().starRating;
await expect(starRating).toHaveScreenshot();
},
);Motivation
We currently need to tag each screenshotTest with the tag @screenshot, because we don't know of a way to add tags statically using a fixture so --grep supports them.
angelo-loria, jan-molak, DmytroNebelskyi and Mischi
Metadata
Metadata
Assignees
Labels
P3-collecting-feedbackfeature-test-runnerPlaywright test specific issuesPlaywright test specific issues