-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
74 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
437 | ||
444 |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,27 @@ | ||
import { _electron as electron } from 'playwright' | ||
import { findLatestBuild, parseElectronApp, } from 'electron-playwright-helpers' | ||
|
||
export const launchApp = async () : Promise<{ electronApp, window }> => { | ||
const latestBuild = findLatestBuild() | ||
const appInfo = parseElectronApp(latestBuild) | ||
process.env.CI = 'e2e' | ||
const electronApp = await electron.launch({ | ||
executablePath: appInfo.executable, | ||
args: [appInfo.main], | ||
env: { ...process.env, TEST: '1' } | ||
}) | ||
electronApp.on('window', async (page) => { | ||
// capture errors | ||
page.on('pageerror', (error) => { | ||
console.error(error) | ||
}) | ||
// capture console messages | ||
page.on('console', (msg) => { | ||
console.log(msg.text()) | ||
}) | ||
}) | ||
const window = await electronApp.firstWindow() | ||
await window.waitForSelector('.main') | ||
return { electronApp, window } | ||
|
||
} |
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,24 @@ | ||
import { ElectronApplication, Page } from 'playwright' | ||
import { beforeAll, afterAll, expect, test } from 'vitest' | ||
import { launchApp } from './e2e' | ||
|
||
let electronApp: ElectronApplication | ||
let window: Page | ||
|
||
beforeAll(async () => { | ||
({ electronApp, window } = await launchApp()) | ||
}) | ||
|
||
afterAll(async () => { | ||
await electronApp.close() | ||
}) | ||
|
||
test('Prompt', async () => { | ||
await window.fill('.prompt .input textarea', 'Hello World') | ||
await window.click('.prompt .icon.send') | ||
await window.waitForSelector('.content .messages') | ||
expect(window.isVisible('.content .messages')).resolves.toBeTruthy() | ||
expect(window.isVisible('.content .messages .message')).resolves.toBeTruthy() | ||
expect(window.locator('.content .messages .message').all()).resolves.toHaveLength(2) | ||
await window.waitForSelector('.prompt .icon.send') | ||
}) |