I am new to jasmine and webdriverio, I try to execute several "it" functions inside the "describe", but could not execute more than one statement.
Below is the code.
var webdriverio = require('webdriverio');
var options = { desiredCapabilities: { browserName: 'chrome' } };
var client = webdriverio.remote(options);
describe('Login Test for ES1', function () {
var session = client
.init()
.timeoutsImplicitWait(3000)
.url('myapp url');
it('Navigated url contains Title ES1', function (done) {
session.getTitle(function(error,title) {
expect(error).toBeFalsy();
expect(title).toBe('title');
done();
})
});
it('has the login button', function (complete) {
session
.getText("a.login",function(error,text){
expect(error).toBeFalsy();
expect(text).toBe('Login with Google');
complete();
})
});
it('User able to login using google', function (finished) {
session
.click('a.login')
.element('#Email').keys('username')
.click('#next').pause(1000)
.element('#Passwd').keys('password')
.click("#signIn").pause(1000)
.getText('//*[@id="context"]/div/div',function(error,text){
expect(text).toContain('User Name');
})
.end(finished);
});
});
Below is the terminal output
1 Login Test for ES1
✓ Navigated url contains Title ES1
The other one is not executed. If I delete all the callbacks (completed, completed, completed) in it. All this is transmitted before even the test is completed.
Below is the output if I delete all callbacks
1 Login Test for ES1
✓ Navigated url contains Title ES1
✓ has the login button
✓ User able to login using google
Executed 3 of 3 specs SUCCESS in 0.017 sec.
At least one spec has failed
RuntimeError: Session ID is null. Using WebDriver after calling quit()?
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: 'MacBook-Pro.local', ip: '174.165.174.131', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.5', java.version: '1.8.0_60'
Driver info: driver.version: EventFiringWebDriver
Let me know what is wrong here and how the asynchronous test should be performed.