vendredi 20 avril 2018

Mocha (Spectron) suddenly times out on async test scenarios

I wanted to run some Spectron e2e tests, I've written some weeks ago. But to my surprise, suddenly they all stopped working for one and the same reason.

enter image description here

According to the error message i'm dealing with rejected Promises. But i can't figure out where this problem is comming from.

Here is a minimal example that throws the exact error: I'm running the following command to launch my test suit: mocha test/e2e

Mocha then executes this index.js before running my tests in ordner to support ES6+ features

'use strict'
//index.js

// Set BABEL_ENV to use proper env config
process.env.BABEL_ENV = 'test'

// Enable use of ES6+ on required files
require('babel-register')({
  ignore: /node_modules/
})

// Attach Chai APIs to global scope
const { expect, should, assert } = require('chai')
global.expect = expect
global.should = should
global.assert = assert

// Require all JS files in `./specs` for Mocha to consume
require('require-dir')('./specs')

After that its trying to run this small Login.spec.js which returns the error mentioned above

import utils from '../utils'
import {Application} from "spectron";
import electron from "electron";


describe('🔑 Login', function () {

    this.timeout(11000);

    it('login form exists', async function () {

        this.app = new Application({
            path: electron,
            env: {"SPECTRON_RUNNING":true},
            args: ['dist/electron/main.js'],
            startTimeout: 10000,
            waitTimeout: 10000
        })

        await this.app.start()

        await this.app.client.windowByIndex(1);

    })

})

I am thankful for any help :)

Aucun commentaire:

Enregistrer un commentaire