1

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.

vishwa9247
  • 11
  • 2
  • You can use this documentation which provided from webdriver.io http://webdriver.io/guide/testrunner/pageobjects.html – sayhan Oct 08 '18 at 07:50

1 Answers1

0

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.

Mihai Chelaru
  • 7,614
  • 14
  • 45
  • 51
Bharath Kumar S
  • 1,410
  • 2
  • 10
  • 29