Skip to content

Instantly share code, notes, and snippets.

@tuliobluz
Last active June 18, 2019 14:42
Show Gist options
  • Save tuliobluz/d2b633337c8727868e1d928d3aaa77b2 to your computer and use it in GitHub Desktop.
Save tuliobluz/d2b633337c8727868e1d928d3aaa77b2 to your computer and use it in GitHub Desktop.
let specPage = require('../pages/spec.po.js');
let chai = require('chai');
let chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
let expect = chai.expect;
var { setDefaultTimeout } = require('cucumber');
setDefaultTimeout(60 * 1050);
Before(async function () {
await specPage.init();
})
Given('The user go to {string}', async function (string) {
await specPage.get(string);
});
When('The user adds {string} in the name field', async function (string) {
await specPage.setName(string);
});
Then('The user should see Hello with the username', async function () {
expect(await specPage.getGreetingText())
.to.eventually.equal('Hello Tulio!!')
});
Then('The user should see Hello with the username success', async function () {
expect(await specPage.getGreetingText())
.to.eventually.equal('Hello Tulio!')
});
Then('The user should see Hello with the username success 2', async function () {
expect(await specPage.getGreetingText())
.to.eventually.equal('Hello Tulio!')
});
After(function (test) {
browser.manage().addCookie({ name: 'zaleniumTestPassed', value: test.result.status == 'failed' ? 'false' : 'true' });
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment