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 = require('chai-as-promised');
const SearchPage = require('./page-objects/search.page');
const assert= require('assert');
describe('Test Suite', function () {
this.timeout(20000);
beforeEach('Start Application', function () {
this.app = new Application({
path: 'path of .exe file located', // Ex: D:\\Foldername\\filename.exe
requireName:'electronRequire',
env: {
NODE_ENV: 'test'
}
});
chai.should();
chai.use(chaiAsPromised);
chaiAsPromised.transferPromiseness = this.app.transferPromiseness;
return this.app.start()
});
afterEach(() => {
if (this.app && this.app.isRunning()) {
return this.app.stop();
}
});
it('Sign In, function () {
return this.app.client.
.pause(20000) //waiting for login window
.setValue(SearchPage.username, 'username').pause(1000)
.setValue(SearchPage.password, 'password').pause(1000)
.click(SearchPage.loginButton);
});
});
Package.json file:
{
"name": "spectron-test-framework",
"version": "1.0.0",
"description": "Test Framework for Electron Desktop Application",
"main": "index.js",
"scripts": {
"test": "mocha --timeout 20000",
},
"author": "Tester",
"license": "ISC",
"devDependencies": {
"webdriverio": "^4.10.2",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"electron": "^2.0.2",
"mocha": "^5.2.0",
"mochawesome": "^3.0.2",
"spectron": "^3.8.0"
}
}
I am unable to interact the elements and seeing error as
1) Test Suite Sign In: Error: Timeout of 20000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\spectron-example\Spec.js)
Even if I am increasing the timeout still seeing this timeout error.
How to fix this issue?
And my Questions are
Can we Start writing automation script without development code base ? because in most of the sample tests I have seen automation script is available in test folder of development code.
I have .exe while launching which I am able to see application being launched but not able to perform actions. Does .exe file needs to be provided to QA for automation with any specific packages and options enabled/disabled.
What are the Ideal Electron, Spectron, Nodejs, Wdio, Mocha compatible versions to work together?
Thanks In Advance.
Aucun commentaire:
Enregistrer un commentaire