-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix and simplify electron test * add electron tests * add CI electron tests * rollback pnpm mistake * rollback pnpm mistake * fix browser tests * fix electron tests
- Loading branch information
Showing
9 changed files
with
889 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { test, expect, _electron as electron } from '@playwright/test' | ||
|
||
const SCREENSHOT_FOLDER = './playwright-report/screenshots' | ||
|
||
test.describe('App Test Results', () => { | ||
let app | ||
let page | ||
|
||
test.beforeAll(async () => { | ||
app = await electron.launch({ args: ['.', '--no-sandbox'] }) | ||
page = await app.firstWindow() | ||
await page.screenshot({ path: `${SCREENSHOT_FOLDER}/initial-load.png` }) | ||
}) | ||
|
||
test('main app should not present dwn error', async () => { | ||
const dwnError = await app.evaluate(async ({ app }) => app.getDwnError()) | ||
console.error({ dwnError }) | ||
expect(dwnError).toBeUndefined() | ||
}) | ||
|
||
test('main app should not present web5 error', async () => { | ||
const web5Error = await app.evaluate(async ({ app }) => app.getWeb5Error()) | ||
console.error({ web5Error }) | ||
expect(web5Error).toBeUndefined() | ||
}) | ||
|
||
test('should display Web5 results with success', async () => { | ||
await page.waitForSelector('#web5-results') | ||
const web5ResultsText = await page.textContent('#web5-results') | ||
await page.screenshot({ path: `${SCREENSHOT_FOLDER}/web5-loaded.png` }) | ||
const web5Results = JSON.parse(web5ResultsText) | ||
expect(web5Results.success).toBe(true) | ||
}) | ||
|
||
test('should display Dwn results with success', async () => { | ||
await page.waitForSelector('#dwn-results') | ||
const dwnResultsText = await page.textContent('#dwn-results') | ||
await page.screenshot({ path: `${SCREENSHOT_FOLDER}/dwn-loaded.png` }) | ||
const dwnResults = JSON.parse(dwnResultsText) | ||
expect(dwnResults.success).toBe(true) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export default { | ||
reporter: [['html'], ['list']], | ||
testDir: './', | ||
/* Maximum time one test can run for. */ | ||
timeout: 30 * 1000, | ||
expect: { | ||
/** | ||
* Maximum time expect() should wait for the condition to be met. | ||
* For example in `await expect(locator).toHaveText();` | ||
*/ | ||
timeout: 15_000 | ||
}, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
workers: process.env.CI ? 1 : undefined, | ||
testMatch: '**/*.spec.js', | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
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' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.