-
-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: integrate playwright and web workers support
- Loading branch information
Showing
11 changed files
with
1,206 additions
and
208 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
**/*.worker.ts |
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,58 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { | ||
BrowserContext, | ||
ElectronApplication, | ||
Page, | ||
_electron as electron, | ||
} from 'playwright'; | ||
const PATH = require('path'); | ||
|
||
test.describe('Check Home Page', async () => { | ||
let app: ElectronApplication; | ||
let firstWindow: Page; | ||
let context: BrowserContext; | ||
|
||
test.beforeAll(async () => { | ||
app = await electron.launch({ | ||
args: [ | ||
PATH.join(__dirname, '../electron/main.js'), | ||
PATH.join(__dirname, '../electron/package.json'), | ||
], | ||
}); | ||
context = app.context(); | ||
//await context.tracing.start({ screenshots: true, snapshots: true }); | ||
|
||
firstWindow = await app.windows()[0]; | ||
const isMainWindow = (await firstWindow.title()) === 'IPTVnator'; | ||
if (!isMainWindow) { | ||
firstWindow = await app.windows()[1]; | ||
} | ||
await firstWindow.waitForLoadState('domcontentloaded'); | ||
}); | ||
|
||
test('Launch electron app', async () => { | ||
const windowState = await app.evaluate(async (process) => { | ||
let mainWindow = process.BrowserWindow.getAllWindows()[0]; | ||
const isMainWindow = mainWindow.title === 'IPTVnator'; | ||
if (!isMainWindow) { | ||
mainWindow = process.BrowserWindow.getAllWindows()[1]; | ||
} | ||
return { | ||
isVisible: mainWindow.isVisible(), | ||
isDevToolsOpened: mainWindow.webContents.isDevToolsOpened(), | ||
isCrashed: mainWindow.webContents.isCrashed(), | ||
}; | ||
}); | ||
|
||
expect(windowState.isVisible).toBeTruthy(); | ||
expect(windowState.isDevToolsOpened).toBeFalsy(); | ||
expect(windowState.isCrashed).toBeFalsy(); | ||
expect(app.windows()).toHaveLength(2); | ||
}); | ||
|
||
test('Check title', async ({ page }) => { | ||
const title = await firstWindow.title(); | ||
await firstWindow.screenshot({ path: 'e2e/screenshots/intro.png' }); | ||
expect(title).toBe('IPTVnator'); | ||
}); | ||
}); |
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,8 @@ | ||
import { PlaywrightTestConfig } from '@playwright/test'; | ||
|
||
const config: PlaywrightTestConfig = { | ||
testDir: '.', | ||
maxFailures: 2, | ||
}; | ||
|
||
export default config; |
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.