Skip to content

Commit

Permalink
Added test: Visual comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
el3um4s committed Oct 20, 2021
1 parent d95be88 commit 2fc857b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
/dist
tests/screenshot
tests/tracing
test-results

.DS_Store
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Template to create a desktop app with Svelte, Electron and TypeScript (with electron-updater, electron-reload and electron-builder)",
"author": "Samuele de Tomasi <[email protected]>",
"license": "MIT",
"version": "0.0.16",
"version": "0.0.17",
"main": "dist/index.js",
"scripts": {
"nodemon": "nodemon",
Expand Down
3 changes: 3 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const config: PlaywrightTestConfig = {
use: {
trace: 'on',
},
expect: {
toMatchSnapshot: { threshold: 0.2 },
},
}

export default config
2 changes: 2 additions & 0 deletions tests/base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// https://github.com/cawa-93/vite-electron-builder/blob/7d2df55fd8a0b3a803963d62558f719c9034ba2a/tests/app.spec.js
// https://github.com/microsoft/playwright/tree/master/tests/electron
// https://github.com/spaceagetv/electron-playwright-example
// https://playwright.dev/docs/test-snapshots

import { ElectronApplication, Page, _electron as electron } from 'playwright';
import { test, expect } from '@playwright/test';
Expand Down Expand Up @@ -50,6 +51,7 @@ test.describe('Check Man Page', async () => {
firstWindow = await electronApp.firstWindow();

await firstWindow.screenshot({ path: 'tests/screenshot/firstWindow.png' });
expect(await firstWindow.screenshot()).toMatchSnapshot('firstWindow.png');
})

test('Check title', async () => {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2fc857b

Please sign in to comment.