add preload.js script to electron main
This commit is contained in:
parent
ee6b0c3c5c
commit
04d694619e
8 changed files with 1847 additions and 55 deletions
32
tests/unit/electron.spec.js
Normal file
32
tests/unit/electron.spec.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* @jest-environment node
|
||||
*/
|
||||
import spectron from 'spectron'
|
||||
import { testWithSpectron } from 'vue-cli-plugin-electron-builder'
|
||||
jest.setTimeout(50000)
|
||||
|
||||
test('Window Loads Properly', async () => {
|
||||
// Wait for dev server to start
|
||||
const { app, stopServe } = await testWithSpectron(spectron)
|
||||
const win = app.browserWindow
|
||||
const client = app.client
|
||||
|
||||
// Window was created
|
||||
expect(await client.getWindowCount()).toBe(1)
|
||||
// It is not minimized
|
||||
expect(await win.isMinimized()).toBe(false)
|
||||
// Window is visible
|
||||
expect(await win.isVisible()).toBe(true)
|
||||
// Size is correct
|
||||
const { width, height } = await win.getBounds()
|
||||
expect(width).toBeGreaterThan(0)
|
||||
expect(height).toBeGreaterThan(0)
|
||||
// App is loaded properly
|
||||
expect(
|
||||
/Welcome to Your Vue\.js (\+ TypeScript )?App/.test(
|
||||
await client.getHTML('#app')
|
||||
)
|
||||
).toBe(true)
|
||||
|
||||
await stopServe()
|
||||
})
|
||||
Loading…
Reference in a new issue