Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: CucumberJS 3.x support has been dropped.
- Loading branch information
Igor Muchychka
committed
Jan 25, 2018
1 parent
fa29bc9
commit 893f8bf
Showing
23 changed files
with
308 additions
and
376 deletions.
There are no files selected for viewing
42 changes: 18 additions & 24 deletions
42
examples/babel-example/features/step_definitions/steps.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,20 @@ | ||
import { client } from 'nightwatch-cucumber' | ||
import { defineSupportCode } from 'cucumber' | ||
import { Given, Then, When } from 'cucumber' | ||
|
||
defineSupportCode(({ Given, Then, When }) => { | ||
Given(/^I open Google`s search page$/, async () => { | ||
await client.url('http://google.com') | ||
await client.waitForElementVisible('body', 1000) | ||
}) | ||
|
||
Then(/^the title is "(.*?)"$/, async (text) => { | ||
await client.assert.title(text) | ||
}) | ||
|
||
Then(/^the Google search form exists$/, async () => { | ||
await client.assert.visible('input[name="q"]') | ||
}) | ||
|
||
Given(/^I open Yahoo`s search page$/, async () => { | ||
await client.url('http://yahoo.com') | ||
await client.waitForElementVisible('body', 1000) | ||
}) | ||
|
||
Then(/^the Yahoo search form exists$/, async () => { | ||
await client.assert.visible('input[name="p"]') | ||
}) | ||
}) | ||
Given(/^I open Google`s search page$/, async () => { | ||
await client.url('http://google.com') | ||
await client.waitForElementVisible('body', 1000) | ||
}) | ||
Then(/^the title is "(.*?)"$/, async (text) => { | ||
await client.assert.title(text) | ||
}) | ||
Then(/^the Google search form exists$/, async () => { | ||
await client.assert.visible('input[name="q"]') | ||
}) | ||
Given(/^I open Yahoo`s search page$/, async () => { | ||
await client.url('http://yahoo.com') | ||
await client.waitForElementVisible('body', 1000) | ||
}) | ||
Then(/^the Yahoo search form exists$/, async () => { | ||
await client.assert.visible('input[name="p"]') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 14 additions & 18 deletions
32
examples/background-example/features/step_definitions/steps.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,16 @@ | ||
const { client } = require('nightwatch-cucumber') | ||
const { defineSupportCode } = require('cucumber') | ||
const { Given, Then, When } = require('cucumber') | ||
|
||
defineSupportCode(({ Given, Then, When }) => { | ||
Given(/^I open Google`s search page$/, () => { | ||
return client | ||
.url('http://google.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
|
||
When(/^I search for "(.*?)"$/, (text) => { | ||
return client | ||
.setValue('input[name=q]', text) | ||
.submitForm('input[name=q]') | ||
}) | ||
|
||
Then(/^the search result should contain "(.*?)"$/, (text) => { | ||
return client.assert.containsText('body', text) | ||
}) | ||
}) | ||
Given(/^I open Google`s search page$/, () => { | ||
return client | ||
.url('http://google.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
When(/^I search for "(.*?)"$/, (text) => { | ||
return client | ||
.setValue('input[name=q]', text) | ||
.submitForm('input[name=q]') | ||
}) | ||
Then(/^the search result should contain "(.*?)"$/, (text) => { | ||
return client.assert.containsText('body', text) | ||
}) |
28 changes: 12 additions & 16 deletions
28
examples/group-example/features/step_definitions/steps.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
const { client } = require('nightwatch-cucumber') | ||
const { defineSupportCode } = require('cucumber') | ||
const { Given, Then, When } = require('cucumber') | ||
|
||
defineSupportCode(({ Given, Then, When }) => { | ||
Given(/^I open Google`s search page$/, () => { | ||
return client | ||
.url('http://google.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
|
||
Then(/^the title is "(.*?)"$/, (text) => { | ||
return client.assert.title(text) | ||
}) | ||
|
||
Then(/^the Google search form exists$/, () => { | ||
return client.assert.visible('input[name="q"]') | ||
}) | ||
}) | ||
Given(/^I open Google`s search page$/, () => { | ||
return client | ||
.url('http://google.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
Then(/^the title is "(.*?)"$/, (text) => { | ||
return client.assert.title(text) | ||
}) | ||
Then(/^the Google search form exists$/, () => { | ||
return client.assert.visible('input[name="q"]') | ||
}) |
46 changes: 20 additions & 26 deletions
46
examples/hooks-example/features/step_definitions/steps.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,22 @@ | ||
const { client } = require('nightwatch-cucumber') | ||
const { defineSupportCode } = require('cucumber') | ||
const { Given, Then, When } = require('cucumber') | ||
|
||
defineSupportCode(({ Given, Then, When }) => { | ||
Given(/^I open Google`s search page$/, () => { | ||
return client | ||
.url('http://google.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
|
||
Then(/^the title is "(.*?)"$/, (text) => { | ||
return client.assert.title(text) | ||
}) | ||
|
||
Then(/^the Google search form exists$/, () => { | ||
return client.assert.visible('input[name="q"]') | ||
}) | ||
|
||
Given(/^I open Yahoo`s search page$/, () => { | ||
return client | ||
.url('http://yahoo.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
|
||
Then(/^the Yahoo search form exists$/, () => { | ||
return client.assert.visible('input[name="p"]') | ||
}) | ||
}) | ||
Given(/^I open Google`s search page$/, () => { | ||
return client | ||
.url('http://google.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
Then(/^the title is "(.*?)"$/, (text) => { | ||
return client.assert.title(text) | ||
}) | ||
Then(/^the Google search form exists$/, () => { | ||
return client.assert.visible('input[name="q"]') | ||
}) | ||
Given(/^I open Yahoo`s search page$/, () => { | ||
return client | ||
.url('http://yahoo.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
Then(/^the Yahoo search form exists$/, () => { | ||
return client.assert.visible('input[name="p"]') | ||
}) |
46 changes: 20 additions & 26 deletions
46
examples/multi-example/features/step_definitions/steps.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,22 @@ | ||
const { client } = require('nightwatch-cucumber') | ||
const { defineSupportCode } = require('cucumber') | ||
const { Given, Then, When } = require('cucumber') | ||
|
||
defineSupportCode(({ Given, Then, When }) => { | ||
Given(/^I open Google`s search page$/, () => { | ||
return client | ||
.url('http://google.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
|
||
Then(/^the title is "(.*?)"$/, (text) => { | ||
return client.assert.title(text) | ||
}) | ||
|
||
Then(/^the Google search form exists$/, () => { | ||
return client.assert.visible('input[name="q"]') | ||
}) | ||
|
||
Given(/^I open Yahoo`s search page$/, () => { | ||
return client | ||
.url('http://yahoo.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
|
||
Then(/^the Yahoo search form exists$/, () => { | ||
return client.assert.visible('input[name="p"]') | ||
}) | ||
}) | ||
Given(/^I open Google`s search page$/, () => { | ||
return client | ||
.url('http://google.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
Then(/^the title is "(.*?)"$/, (text) => { | ||
return client.assert.title(text) | ||
}) | ||
Then(/^the Google search form exists$/, () => { | ||
return client.assert.visible('input[name="q"]') | ||
}) | ||
Given(/^I open Yahoo`s search page$/, () => { | ||
return client | ||
.url('http://yahoo.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
Then(/^the Yahoo search form exists$/, () => { | ||
return client.assert.visible('input[name="p"]') | ||
}) |
32 changes: 14 additions & 18 deletions
32
examples/outlines-example/features/step_definitions/steps.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,16 @@ | ||
const { client } = require('nightwatch-cucumber') | ||
const { defineSupportCode } = require('cucumber') | ||
const { Given, Then, When } = require('cucumber') | ||
|
||
defineSupportCode(({ Given, Then, When }) => { | ||
Given(/^I open Google`s search page$/, () => { | ||
return client | ||
.url('http://google.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
|
||
When(/^I search for (.*?)$/, (expression) => { | ||
return client | ||
.setValue('input[name=q]', expression) | ||
.submitForm('input[name=q]') | ||
}) | ||
|
||
Then(/^the search result should contain (.*?)$/, (result) => { | ||
return client.assert.containsText('body', result) | ||
}) | ||
}) | ||
Given(/^I open Google`s search page$/, () => { | ||
return client | ||
.url('http://google.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
When(/^I search for (.*?)$/, (expression) => { | ||
return client | ||
.setValue('input[name=q]', expression) | ||
.submitForm('input[name=q]') | ||
}) | ||
Then(/^the search result should contain (.*?)$/, (result) => { | ||
return client.assert.containsText('body', result) | ||
}) |
32 changes: 14 additions & 18 deletions
32
examples/page-object-example/features/step_definitions/steps.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,18 @@ | ||
const { client } = require('nightwatch-cucumber') | ||
const { defineSupportCode } = require('cucumber') | ||
const { Given, Then, When } = require('cucumber') | ||
|
||
defineSupportCode(({ Given, Then, When }) => { | ||
Given(/^I open Yahoo`s search page$/, () => { | ||
const yahoo = client.page.yahoo() | ||
Given(/^I open Yahoo`s search page$/, () => { | ||
const yahoo = client.page.yahoo() | ||
|
||
return yahoo | ||
.navigate() | ||
.waitForElementVisible('@body', 1000) | ||
}) | ||
return yahoo | ||
.navigate() | ||
.waitForElementVisible('@body', 1000) | ||
}) | ||
Then(/^the title is "(.*?)"$/, (text) => { | ||
return client.assert.title(text) | ||
}) | ||
Then(/^the Yahoo search form exists$/, () => { | ||
const yahoo = client.page.yahoo() | ||
|
||
Then(/^the title is "(.*?)"$/, (text) => { | ||
return client.assert.title(text) | ||
}) | ||
|
||
Then(/^the Yahoo search form exists$/, () => { | ||
const yahoo = client.page.yahoo() | ||
|
||
return yahoo.assert.visible('@searchBar') | ||
}) | ||
}) | ||
return yahoo.assert.visible('@searchBar') | ||
}) |
46 changes: 20 additions & 26 deletions
46
examples/paralell-example/features/step_definitions/steps.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,22 @@ | ||
const { client } = require('nightwatch-cucumber') | ||
const { defineSupportCode } = require('cucumber') | ||
const { Given, Then, When } = require('cucumber') | ||
|
||
defineSupportCode(({ Given, Then, When }) => { | ||
Given(/^I open Google`s search page$/, () => { | ||
return client | ||
.url('http://google.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
|
||
Then(/^the title is "(.*?)"$/, (text) => { | ||
return client.assert.title(text) | ||
}) | ||
|
||
Then(/^the Google search form exists$/, () => { | ||
return client.assert.visible('input[name="q"]') | ||
}) | ||
|
||
Given(/^I open Yahoo`s search page$/, () => { | ||
return client | ||
.url('http://yahoo.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
|
||
Then(/^the Yahoo search form exists$/, () => { | ||
return client.assert.visible('input[name="p"]') | ||
}) | ||
}) | ||
Given(/^I open Google`s search page$/, () => { | ||
return client | ||
.url('http://google.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
Then(/^the title is "(.*?)"$/, (text) => { | ||
return client.assert.title(text) | ||
}) | ||
Then(/^the Google search form exists$/, () => { | ||
return client.assert.visible('input[name="q"]') | ||
}) | ||
Given(/^I open Yahoo`s search page$/, () => { | ||
return client | ||
.url('http://yahoo.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
Then(/^the Yahoo search form exists$/, () => { | ||
return client.assert.visible('input[name="p"]') | ||
}) |
28 changes: 12 additions & 16 deletions
28
examples/pending-with-no-strict-example/features/step_definitions/steps.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
const { client } = require('nightwatch-cucumber') | ||
const { defineSupportCode } = require('cucumber') | ||
const { Given, Then, When } = require('cucumber') | ||
|
||
defineSupportCode(({ Given, Then, When }) => { | ||
Given(/^I open Google`s search page$/, () => { | ||
return client | ||
.url('http://google.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
|
||
Then(/^the title is "(.*?)"$/, (text) => { | ||
return 'pending' | ||
}) | ||
|
||
Then(/^the Google search form exists$/, () => { | ||
return client.assert.visible('input[name="q"]') | ||
}) | ||
}) | ||
Given(/^I open Google`s search page$/, () => { | ||
return client | ||
.url('http://google.com') | ||
.waitForElementVisible('body', 1000) | ||
}) | ||
Then(/^the title is "(.*?)"$/, (text) => { | ||
return 'pending' | ||
}) | ||
Then(/^the Google search form exists$/, () => { | ||
return client.assert.visible('input[name="q"]') | ||
}) |
Oops, something went wrong.