forked from nervosnetwork/neuron
-
Notifications
You must be signed in to change notification settings - Fork 3
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
6 changed files
with
87 additions
and
11 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
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,28 @@ | ||
import { concurrently } from 'concurrently' | ||
import path from 'path' | ||
const waitOn = require('wait-on'); | ||
|
||
async function globalSetup() { | ||
const { commands } = concurrently( | ||
[ | ||
{ | ||
command: 'cross-env BROWSER=none yarn run start:ui', | ||
name: 'start ui', | ||
cwd: path.resolve(__dirname, '../../'), | ||
}, | ||
], | ||
); | ||
await waitOn({ | ||
resources: [ | ||
'http://127.0.0.1:3000' | ||
], | ||
timeout: 30_000, | ||
}) | ||
console.log('ui start success') | ||
return async () => { | ||
console.log('stop ui server') | ||
await commands[0].kill() | ||
} | ||
} | ||
|
||
export default globalSetup; |
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,45 @@ | ||
import { test as baseTest } from '@playwright/test'; | ||
import { concurrently, Command } from 'concurrently' | ||
import path from 'path' | ||
import { _electron as electron, ElectronApplication } from "playwright"; | ||
const waitOn = require('wait-on'); | ||
|
||
export const test = baseTest.extend<{ | ||
uiCommand: Command; | ||
electronApp: ElectronApplication | ||
}>({ | ||
uiCommand: async ({}, use) => { | ||
const { commands, result } = await concurrently( | ||
[ | ||
{ | ||
command: 'cross-env BROWSER=none yarn run start:ui', | ||
name: 'start ui', | ||
cwd: path.resolve(__dirname, '../../'), | ||
}, | ||
], | ||
); | ||
console.log(result) | ||
await waitOn({ | ||
resources: [ | ||
'http://127.0.0.1:3000' | ||
], | ||
timeout: 30_000, | ||
}) | ||
await use(commands[0]) | ||
}, | ||
electronApp: async ({}, use) => { | ||
const electronApp = await electron.launch({args: ["../../packages/neuron-wallet/dist/main.js"]}); | ||
electronApp.on("window", async (page) => { | ||
const filename = page.url()?.split("/").pop(); | ||
console.log(`Window opened: ${filename}`); | ||
|
||
page.on("pageerror", (error) => { | ||
console.error(error); | ||
}); | ||
page.on("console", (msg) => { | ||
console.log(msg.text()); | ||
}); | ||
}); | ||
await use(electronApp) | ||
} | ||
}); |
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