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);
//Case 1: wait for Electron window to open
it('open window', function () {
return app.client.waitUntilWindowLoaded().getWindowCount().should.eventually.equal(1);
});
//Case 2: Initial Login - Empty username & Password
it("Click on Login Without any Data", function () {
//Wait for window to load
return app.client.waitUntilWindowLoaded()
.setValue(usernametxt, "")
.setValue(passwordtxt, "")
.click(submitbtn)
.getText('.notification-content')
.should.eventually.equal("Please fill both username and password");
});
});
Simply I want to write Case 1 and Case 2 into Seperate file, from Test initializing File.
Just create two spec files with your tests separated:
spec1.js
spec2.js
Create a .js file with the following contents (test.js):
require('spec1')
require('spec2')
And in the package.json, refer to test.js in the mocha test command:
"scripts": {
"test": "mocha test/test.js"
}
considering you have a test folder.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.