Questions tagged [spectron]

Spectron is a testing framework, built upon ChromeDriver and WebdriverIO, for end to end testing Electron applications.

Spectron is built by the Electron team to make end to end testing Electron apps easy. As of 2017 it's the only e2e testing framework with native support for Electron.

It's a wrapper around WebdriverIO which their API's is almost the same, except the additional Electron parts.

112 questions
3
votes
0 answers

How can I apply babel config ahead of an electron app's main.js, when using Spectron?

I'm using jest to run a test script that starts an Electron application using Spectron. What is the correct way to load my babel configuration? Normally I start the app like this: npx electron -r @babel/register . (npm start in package.json) My test…
davemfish
  • 172
  • 1
  • 9
3
votes
3 answers

simple example of electron app with spectron test

I am trying to learn how to test apps, build with electron, using spectron. for this I took an example application from the web with a simple header, counter label, and incrementer button. I use mocha as a test runnen. The test should launch the…
wallage
  • 73
  • 2
  • 6
3
votes
0 answers

Use add files dialog in Electron testing with Spectron

I want to test my Electron application but I feel this is harder than I expected! Just a simple thing as using the open file dialog seems impossible from what I've seen when I looked around a while! Is it at all possible, or can I mock this behavior…
mottosson
  • 3,283
  • 4
  • 35
  • 73
3
votes
1 answer

How to access client window javascript global variable with Spectron

I'm trying test of Electron app with Spectron. But I can't test client window javascript global variable. Here is my simplified code. Please help me. Thanks. index.html
3
votes
3 answers

Linking selenium with electron framework (c#)

I've already written few lines of code in C# using Selenium webdriver. As my application was transferred to the Electron framework everything has changed and honestly, I don't know how to cope with it right now. Could you please clarify it to me?…
Ixi11
  • 219
  • 2
  • 14
3
votes
2 answers

Double click x y co-ordinates WebdriverIO

WebdriverIO supplies a doubleClick() command. Unlike some other commands, such as leftClick(), doubleClick() does not have any x y parameters. I am unable to double click on specific x y positions on one particular component. I would like to do this…
cham
  • 8,666
  • 9
  • 48
  • 69
3
votes
2 answers

Spectron/WebdriverIO nth child using $$[n] instead of selector

I am trying to use Spectron to test my Electron application. The documentation says when trying to find the nth child, you can use an nth child selector, or get all children that match selector using $$ and then use index operator ie $$ ("foo")[0]…
2
votes
0 answers

Spectron : app.client.click is not a function

I am testing a simple electron app using Spectron. following is my test.js having a test case to click an element. const Application = require('spectron').Application; const assert = require('assert'); const electronPath = require('electron'); //…
Jithin Zachariah
  • 313
  • 3
  • 13
2
votes
1 answer

unknown error: Chrome failed to start: exited abnormally when trying to test electron spectron with mocha

i'm trying to test electron spectron testing. my project is very simple, just clone an electron quick start repo then write code to spec.js as written from the readme file from electron-userland/spectron but when i run npm test, i face this error: $…
dhanyn10
  • 704
  • 1
  • 9
  • 26
2
votes
0 answers

app.browserWindow returns TypeError during testing of electron app with Spectron

I am trying to run simple tests on my electron application using Spectron and mocha. However, whenever I try to use the browserWindow API I obtain an error of the form: TypeError: Cannot read property '.....' of undefined I did a bit of research on…
a_squared
  • 51
  • 1
  • 1
  • 4
2
votes
0 answers

How to write UI automation test for a vs code extension without using the source code

I am trying to write UI automation scripts to perform the automated testing of a vs code extension. After reading tutorials about spectron/ vs code test, I found that they both need source code to perform tests. I am trying to perform from a QA side…
2
votes
1 answer

How to select a React component with Spectron?

I'm using Spectron to test an Electron app that is based on React. I'd like to select a React component and I'm trying to access WebDriverIO's browser for that and call react$, however the function cannot be found - 'app.client.react$ is not a…
Rani
  • 6,424
  • 1
  • 23
  • 31
2
votes
0 answers

Clicking with Spectron

I have rendered two tr elements onto a browser window. I'd like to click the second one. Based on the webdriver docs, I figured the code would be as follows (using ava): test('onclick should fire', async t => { const [, tr] = await…
2
votes
2 answers

Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves

I am trying to write tests for electron using spectron. This is my code. describe ('Application launch', function(done) { this.timeout(30000); const app = new Application({ path: electronBinary, args: [baseDir], }); before(() =>…
Emjey
  • 2,038
  • 3
  • 18
  • 33
2
votes
3 answers

Using Python + Selenium for Electron-based app testing

There is a lot of documentation on using Spectron for testing applications built using Electron. As I have a lot of utilities written in Python, I would like to know if there is any way to use Python-Selenium for testing apps built in Electron. From…