How to use the spectron.Application.mock function in spectron

To help you get started, we’ve selected a few spectron examples, based on popular ways it is used in public projects.

github nklayman / vue-cli-plugin-electron-builder / __tests__ / commands.spec.js View on Github external
test('uses custom output dir and url', async () => {
    const { url } = await runSpectron(
      {},
      {
        url: 'http://localhost:1234/',
        outputDir: 'customOutput'
      }
    )
    // Proper URL is returned
    expect(url).toBe('http://localhost:1234/')
    const appArgs = Application.mock.calls[0][0]
    // Spectron is launched with proper path to output dir
    expect(appArgs.args).toEqual(['customOutput'])
  })
github nklayman / vue-cli-plugin-electron-builder / __tests__ / commands.spec.js View on Github external
test('uses custom spectron options if provided', async () => {
    await runSpectron({ spectronOptions: { testKey: 'expected' } })
    // Custom spectron option is passed through
    expect(Application.mock.calls[0][0].testKey).toBe('expected')
  })

spectron

Easily test your Electron apps using ChromeDriver and WebdriverIO.

MIT
Latest version published 8 months ago

Package Health Score

61 / 100
Full package analysis