Skip to content

Commit

Permalink
test: update playwright screenshot name format for CI compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Biggins <sambiggins@gmail.com>
  • Loading branch information
smileynet committed Apr 3, 2023
1 parent e18ff7f commit 9ce0e0b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
1 change: 1 addition & 0 deletions COMMITLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
* key up stops movement correctly ([a014c98](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/a014c9863a7db359628e7d44beaeeb692c4a4366))
* object destruction ([387e2f0](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/387e2f0b90265c43869725704558b188a8021c42))
* object destruction ([36f6f29](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/36f6f29212c5fe23f23f5342e3c8726e47b08212))
* playwright snapshot compatibility with CI ([e18ff7f](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/e18ff7f28de1c8647a956d62910f773f5188c12c))


### Documentation
Expand Down
19 changes: 2 additions & 17 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests/playwright',
fullyParallel: true,
snapshotPathTemplate:
'tests/playwright/screenshots/{testFilePath}/{arg}{ext}',
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
Expand Down Expand Up @@ -56,21 +58,4 @@ export default defineConfig({
url: 'http://127.0.0.1:4173',
reuseExistingServer: !process.env.CI,
},
expect: {
toMatchSnapshot: async (actual, options = {}) => {
// Check if options.snapshotSuffix is defined, if not, set it to an empty string
if (!options.snapshotSuffix) {
options.snapshotSuffix = '';
}

// Remove the OS part from the snapshot suffix
options.snapshotSuffix = options.snapshotSuffix.replace(
/-darwin|-linux|-windows/,
''
);

// Call the original toMatchSnapshot function with the modified options
return await expect._toMatchSnapshot(actual, options);
},
},
});

0 comments on commit 9ce0e0b

Please sign in to comment.