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
1
vote
0 answers

Electron Mocha and Spectron

I am using Electron to write a desktop application. I want to use Spectron and Mocha because they seem to be the biggest and most supported things out there for testing electron. I am in Windows 10. using the boiler plate project here…
1
vote
0 answers

How to execute getPath with Spectron?

Inside my Electron application I use remote.app.getPath('documents' to get the path of the users current documents directory. I also use Spectron and would like to access this directory inside my test. What is the best way to execute this function…
Daniel Stephens
  • 2,371
  • 8
  • 34
  • 86
1
vote
0 answers

Mocha, Electron: Errors in testing

I was testing my electron app with mocha and got this error several times (and I'm still getting it!). Every time I run the program it returns with the error > Executing task: npm run test < > forte@1.0.0 test PATH TO PROJECT > mocha…
Quantalabs
  • 379
  • 2
  • 14
1
vote
1 answer

Can't iterate through multiple selector ($$, findElements) webdriver.io

I'm trying to use webdriver.io (https://webdriver.io/) with spectron for an electron application. I'm able to access functions that findElement or $ contain. For example, I can use the .click() on this findElement ($)…
1
vote
0 answers

Spectron not visible html element

I am new with spectron and I spend a lot of time with simple example test. I have an electron app which has loader at the beginning, and after some time it presents simple view. I want to check if header is equal "Welcome" This is my test…
tiger
  • 97
  • 1
  • 10
1
vote
1 answer

Can I rewrite webdriver v4 test method chain to v5 (current spectron / electron testing)

I use spectron / electron testing. Spectron update change to webdriver v5. I have UI test written in v4 method chain. Can I rewrite webdriver v4 test method chain to webdriver v5(current spectron)? it("input basic test", function() { return…
1
vote
0 answers

Spectron get text data from dynamic textbox

so I have downloaded an app, which uses electron framework. I have managed to click all the needed buttons to generate some server related data. This test runs approximately 2 minutes, and within this timeframe it generates text withing the…
Danny Kaminski
  • 191
  • 2
  • 15
1
vote
0 answers

Spectron test failing with bizarre reason

New user to spectron *** I am trying to write a simple test to check the app window count using spectron. Below is the code. const Application = require('spectron').Application const assert = require('assert') const electronPath =…
pmme
  • 11
  • 1
1
vote
1 answer

My spectron app.client doesn't contains all the methods

I'm trying to test my electron app using spectron and mocha, here is my file 'first.js' containing my tests: const assert = require('assert'); const path = require('path'); const {Application} = require('spectron'); const electronPath =…
1
vote
0 answers

Any workarounds for app.client.setValue in Spectron?

In my tests I fill the input fields (of Ant.Design https://ant.design/components/input/) with app.client.setValue( selector, value ) method. According to https://github.com/electron-userland/spectron it is supposed to be Selenium Webdriver's method.…
Dmitry Sheiko
  • 2,130
  • 1
  • 25
  • 28
1
vote
1 answer

Spectron: Unable to interact with elements on electron application after launching the application

I am able to launch the electron app with Spectron but not able to perform any actions on it. OS: Windows 8.1 Node Version : 10.16.0 Spectron: 3.8.0 var Application = require('spectron').Application; var chai = require('chai'); var chaiAsPromised =…
1
vote
0 answers

this.app.client.electron.remote.app.getApplicationMenu() returns undefined

I am working on setting up e2e testing for Electron app that has custom menus. I want to test these custom menus. I tried several ways to access 'getApplicationMenu()' from Spectron's Application client. But all of them return…
IronMan
  • 51
  • 1
  • 4
1
vote
1 answer

How do I use Mocha to test my custom module that requires Node API? "Cannot read property 'require' of undefined"

I'm building an Electron app. I'm setting up testing with Mocha and Spectron. Mocha is erroring on the line const filebrowser = require("../src/filebrowser.js") specifically, it's failing in the filebrowser module on line 2 when I try to require…
capsid
  • 135
  • 1
  • 11
1
vote
1 answer

Testing file choose and upload in Spectron

I have to write test for a electron GUI which contains a choose file dialog. I have no access to the implementation of the GUI. I have wrote await app.client.chooseFile('//*[@id="import-file"]/form/div/div/div[1]/input', path.join(__dirname,…
FarFarAway
  • 1,017
  • 3
  • 14
  • 35
1
vote
0 answers

Unexpected token import when importing from other ts file when running by mocha

I have a Util class where I saved some info for my test classes import * as electron from "electron"; import { Application } from "spectron"; export class TestUtils { public app: Application; public windowsCount = 2; public windowByIndex()…
FarFarAway
  • 1,017
  • 3
  • 14
  • 35