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.

123 questions
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
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
  • 31
  • 1
  • 1
  • 3
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
  • 1,842
  • 1
  • 21
  • 24
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
  • 41
  • 1
  • 3
1
vote
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…
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
  • 115
  • 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
  • 696
  • 1
  • 9
  • 26
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
  • 696
  • 1
  • 9
  • 26
1
vote
1 answer

Spectron async isExisting doesnt return false

I am using spectron 3.8.0 and am trying to check if am element exists in the DOM. I tried using the waitUntil method with try/catch, but it didn't work as expected. Recently I got sync app.client.isExisting() return true if an element exists, but…
zaebalo
  • 127
  • 1
  • 12
1
vote
1 answer

Electron,Spectron: how to write test cases in seperate javascript file

I am testing electron application use these technologies, Spectron, Chai, chai as promised I want to write my test cases in separate file, except all in one file. Here's what I've tried, describe("Login", function () { this.timeout(10000); …
1
vote
0 answers

Mocha (Spectron) suddenly times out on async test scenarios

I wanted to run some Spectron e2e tests I wrote some weeks ago, but to my surprise, suddenly they all stopped working for one and the same reason. According to the error message, I'm dealing with rejected Promises, but I can't figure out where the…
Lucca
  • 1,158
  • 2
  • 12
  • 19
1
vote
1 answer

How to apply blur event with Javascript using WebdriverIO and Spectron

I am developing Spectron UI tests using Mocha for application that runs on Electron. The main issue that I have is that Javascript does not threat texts inputs by tool equally to real inputs from the keyboard. As workaround for that I want to apply…
1
vote
1 answer

Can Spectron, mocha, and chai assert that variables have expected values in an Electron-app?

How can we assert that a javascript-variable embedded in HTML has some expected value within an application built with electron? The current testing framework is spectron, mocha, chai, chai.should(), and chai.use(chaiAsPromised). I want to assert…
1 2 3
8 9