Skip to content

Commit a2c43f2

Browse files
authored
Merge pull request #113 from wvankuipers/feature/1.2.0
Version 1.2.0
2 parents ba5064e + 88a797b commit a2c43f2

23 files changed

+4108
-109
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ branches:
2323
- master
2424
- /^greenkeeper/.*$/
2525

26-
script: "npm run-script test"
26+
script: "yarn run test"
2727

2828
after_success:
29-
- npm install -g codeclimate-test-reporter
29+
- yarn install -g codeclimate-test-reporter
3030
- CODECLIMATE_REPO_TOKEN=b087813d4296a775b39b1465f365d52e6e8f62c6ee3150392345b0911bd186ee codeclimate-test-reporter < coverage/lcov.info

CHANGELOG.md

+25-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Changelog
22

3+
## [1.2.0] - 2017-07-12
4+
### Added
5+
- Rules:
6+
- [Given] `I expect that element "([^"]*)?" is( not)* empty$`
7+
8+
### Changed
9+
- Switched to [Yarn]() for managing our packages
10+
- Readme to reflect Yarn changes
11+
- Updated dependencies
12+
- Removed no longer needed dependencies Cucumber and Babel-jest
13+
- Locked Webdriverio to 4.7.1 to make sure we don't upgrade before all deprecated functions will be fixed
14+
- Removed specific element/inputfield requirement from checkContainsAnyText, checkContainsText and checkEqualsText check's (thanks [cheapsteak](https://github.com/cheapsteak))
15+
16+
### Fixed
17+
- `checkCointainsText` now correctly checks if the given element actualy contains the given text (thanks [inspiraller](https://github.com/inspiraller))
18+
- Removed unneeded sudo from `clean` script (thanks [l-hendriks](https://github.com/l-hendriks))
19+
- ESLint error's after upgrading ESLint
20+
- Resolved an issue with running `yarn run clean` in Bash (thanks [mondwan](https://github.com/mondwan))
21+
- Fixed `^I expect that element "([^"]*)?" is( not)* empty$` then rule (thanks [stevezxu](https://github.com/stevezxu))
22+
23+
324
## [1.1.1] - 2017-03-03
425
### Added
526
- Requirements section to the readme
@@ -15,7 +36,7 @@
1536

1637

1738
## [1.1.0] - 2017-01-14
18-
### Added
39+
### Added
1940
- Changelog
2041
- Unit-tests set-up using Jest
2142
- Basic unit-tests for all Javascript code
@@ -26,12 +47,12 @@
2647
- Favicon to the demo-app
2748

2849
### Changed
29-
- Moved the boilerplate code from `test/` to `src/` to make clear it's the
50+
- Moved the boilerplate code from `test/` to `src/` to make clear it's the
3051
source of the project and separate if from the actual test code.
3152
- ESLint configuration now matches ES6 `comma-dangle`
3253
- Updated dependencies
33-
- `babel-reset-2015`
34-
- `babel-register`
54+
- `babel-reset-2015`
55+
- `babel-register`
3556
- `wdio-phantomjs-service`
3657
- `webdriverio`
3758
- `wdio-cucumber-framework`

README.md

+16-13
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Boilerplate project to run WebdriverIO tests with [Cucumber](https://cucumber.io
99

1010
## Requirements
1111

12-
- Node version 4 or higher
12+
- Node version 6 or higher
13+
14+
Although this project works fine with NPM we recommend to use Yarn (>= 0.20.0) instead, due to its speed & solid dependency locking mechanism. To keep things simple we use yarn in this guide, but feel free to replace this with NPM if that is what you are using.
1315

1416
## Quick start
1517

@@ -22,14 +24,14 @@ Choose one of the following options:
2224

2325
3. Clean the project (Optional):
2426
- *On OSX/Linux:*
25-
-- Run `npm run clean`
27+
-- Run `yarn run clean`
2628

2729
- *On Windows:*
2830
-- Remove the directories `/.git`, `/.github`, `/demo-app` & `/test`
2931
-- Remove the files `.travis.yml`, `jest.json` & `wdio.BUILD.conf.js`
3032
-- Remove all the demo features from the `/src/features` directory
3133

32-
4. Install the dependencies (`npm install` or `yarn install`)
34+
4. Install the dependencies (`yarn install`)
3335

3436
Now you are ready to write your own features.
3537

@@ -76,13 +78,13 @@ query after doing a search. As you can see, it is pretty simple and understandab
7678
Start the local web server:
7779

7880
```sh
79-
$ npm run-script local-webserver
81+
$ yarn run local-webserver
8082
```
8183

8284
To run your tests just call the [WDIO runner](http://webdriver.io/guide/testrunner/gettingstarted.html):
8385

8486
```sh
85-
$ wdio
87+
$ yarn run wdio
8688
```
8789

8890
_please note_ The WDIO runner uses the configuration file `wdio.conf.js` by default.
@@ -117,14 +119,14 @@ Your environment-specific config file will get merged into the default config fi
117119
To run a test in a specific environment just add the desired configuration file as the first parameter:
118120

119121
```sh
120-
$ wdio wdio.STAGING.conf.js
122+
$ yarn run wdio wdio.STAGING.conf.js
121123
```
122124

123125
# Running single feature
124126
Sometimes its useful to only execute a single feature file, to do so use the following command:
125127

126128
```sh
127-
$ wdio --spec ./test/features/select.feature
129+
$ yarn run wdio -- --spec ./test/features/select.feature
128130
```
129131

130132

@@ -140,7 +142,7 @@ Feature: ...
140142
To run only the tests with specific tag(s) use the `--tags=` parameter like so:
141143

142144
```sh
143-
$ wdio --tags=@Tag,@AnotherTag
145+
$ yarn run wdio -- --tags=@Tag,@AnotherTag
144146
```
145147

146148
You can add multiple tags separated by a comma
@@ -205,8 +207,9 @@ Check out all predefined snippets. You can see how they get used in [`sampleSnip
205207
- `there is (an|no) element "([^"]*)?" on the page` <br>Check if a element (does not) exist
206208
- `the title is( not)* "([^"]*)?"` <br>Check the title of the current browser window/tab
207209
- `the element "([^"]*)?" contains( not)* the same text as element "([^"]*)?"` <br>Compaire the text of two elements
208-
- `the (element|inputfield) "([^"]*)?"( not)* contains the text "([^"]*)?"` <br>Check if a element contains the given text
209-
- `the (element|inputfield) "([^"]*)?"( not)* contains any text` <br>Check if a element does not contain any text
210+
- `the element "([^"]*)?"( not)* contains the text "([^"]*)?"` <br>Check if a element contains the given text
211+
- `the element "([^"]*)?"( not)* contains any text` <br>Check if a element does not contain any text
212+
- `the element "([^"]*)?" is( not)* empty` <br>Check if a element is empty
210213
- `the page url is( not)* "([^"]*)?"` <br>Check the url of the current browser window/tab
211214
- `the( css)* attribute "([^"]*)?" from element "([^"]*)?" is( not)* "([^"]*)?"` <br>Check the value of a element's (css) attribute
212215
- `the cookie "([^"]*)?" contains( not)* the value "([^"]*)?"` <br>Check the value of a cookie
@@ -225,9 +228,9 @@ Check out all predefined snippets. You can see how they get used in [`sampleSnip
225228
- `I expect that element "([^"]*)?" is( not)* within the viewport` <br>Check if a certain element is within the current viewport
226229
- `I expect that element "([^"]*)?" does( not)* exist` <br>Check if a certain element exists
227230
- `I expect that element "([^"]*)?"( not)* contains the same text as element "([^"]*)?"` <br>Compare the text of two elements
228-
- `I expect that (element|inputfield) "([^"]*)?"( not)* contains the text "([^"]*)?"` <br>Check if a element or input field contains the given text
229-
- `I expect that (element|inputfield) "([^"]*)?"( not)* contains any text` <br>Check if a element or input field contains any text
230-
- `I expect that (element|inputfield) "([^"]*)?" is( not)* empty` <br>Check if a element or input field is empty
231+
- `I expect that element "([^"]*)?"( not)* contains the text "([^"]*)?"` <br>Check if a element or input field contains the given text
232+
- `I expect that element "([^"]*)?"( not)* contains any text` <br>Check if a element or input field contains any text
233+
- `I expect that element "([^"]*)?" is( not)* empty` <br>Check if a element or input field is empty
231234
- `I expect that the url is( not)* "([^"]*)?"` <br>Check if the the URL of the current browser window/tab is a certain string
232235
- `I expect that the path is( not)* "([^"]*)?"` <br>Check if the path of the URL of the current browser window/tab is a certain string
233236
- `I expect the url to( not)* contain "([^"]*)?"` <br>Check if the URL of the current browser window/tab contains a certain string

package.json

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "cucumber-boilerplate",
3-
"version": "1.1.1",
3+
"version": "1.2.0",
44
"description": "Boilerplate project to run WebdriverIO tests with Cucumber",
55
"homepage": "https://github.com/webdriverio/cucumber-boilerplate",
66
"scripts": {
7-
"clean": "read -p \"Are you sure you want to clean the project? [y/n] \" -n 1 -r; if [[ $REPLY =~ ^[Yy]$ ]]; then sudo rm -R .git .github demo-app test .codeclimate.yml .travis.yml jest.json wdio.BUILD.conf.js src/features/**; fi",
7+
"clean": "read -p \"Are you sure you want to clean the project? [y/n] \" REPLY; if [[ $REPLY =~ ^[Yy]$ ]]; then rm -R .git .github demo-app test .codeclimate.yml .travis.yml jest.json wdio.BUILD.conf.js src/features/**; fi",
88
"local-webserver": "http-server ./demo-app -s",
99
"test": "npm run test:validate && npm run test:unit && npm run test:features",
10-
"test:features": "npm run-script local-webserver & (wdio wdio.BUILD.conf.js; wdio_ret=$?; kill $(lsof -t -i:8080); exit $wdio_ret)",
10+
"test:features": "npm run local-webserver & (wdio wdio.BUILD.conf.js; wdio_ret=$?; kill $(lsof -t -i:8080); exit $wdio_ret)",
1111
"test:unit": "jest --config=jest.json",
1212
"test:validate": "eslint 'src/**/*.js' 'test/**/*.js!(setup.js)'"
1313
},
@@ -25,25 +25,26 @@
2525
"selenium"
2626
],
2727
"author": "Christian Bromann <[email protected]>",
28+
"contributors": [
29+
"W. van Kuipers <[email protected]>"
30+
],
2831
"license": "MIT",
2932
"dependencies": {
3033
"babel-preset-es2015": "~6.24.0",
3134
"babel-register": "~6.24.0",
3235
"chai": "~4.1.0",
33-
"cucumber": "~2.2.0",
34-
"wdio-cucumber-framework": "~0.3.0",
36+
"wdio-cucumber-framework": "~0.3.1",
3537
"wdio-phantomjs-service": "~0.2.2",
36-
"wdio-selenium-standalone-service": "~0.0.8",
38+
"wdio-selenium-standalone-service": "~0.0.9",
3739
"wdio-spec-reporter": "~0.1.0",
38-
"webdriverio": "~4.8.0"
40+
"webdriverio": "4.7.1"
3941
},
4042
"devDependencies": {
41-
"babel-jest": "~20.0.0",
4243
"babel-polyfill": "~6.23.0",
4344
"eslint": "~4.2.0",
4445
"eslint-config-airbnb-base": "~11.2.0",
45-
"eslint-plugin-import": "~2.6.0",
46+
"eslint-plugin-import": "~2.7.0",
4647
"http-server": "~0.10.0",
47-
"jest": "~20.0.0"
48+
"jest": "~20.0.4"
4849
}
4950
}

src/features/githubSearch.feature.pending

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Scenario: search for webdriverio repository
1515
And I press "Space"
1616
And I add "selenium" to the inputfield ".input-block"
1717
When I submit the form "#search_form"
18-
Then I expect that inputfield ".input-block" contains the text "webdriverio selenium"
18+
Then I expect that element ".input-block" contains the text "webdriverio selenium"
1919
And I expect that element ".repo-list-item:first-child > .repo-list-description" contains the text "Webdriver/Selenium 2.0 JavaScript bindings for Node.js"
2020

2121
Scenario: login with fake credentials

src/features/inputfield.feature

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ Feature: Test input fields on a page
44

55
Background:
66
Given I open the site "/"
7-
Then I expect that inputfield "#testInput" not contains any text
7+
Then I expect that element "#testInput" not contains any text
88

99
Scenario: Set the content of a input field
1010
When I set "test" to the inputfield "#testInput"
11-
Then I expect that inputfield "#testInput" contains any text
12-
And I expect that inputfield "#testInput" contains the text "test"
11+
Then I expect that element "#testInput" contains any text
12+
And I expect that element "#testInput" contains the text "test"
1313

1414
Scenario: Add content to a input field
1515
When I set "test" to the inputfield "#testInput"
16-
Then I expect that inputfield "#testInput" contains any text
16+
Then I expect that element "#testInput" contains any text
1717
When I add " more tests" to the inputfield "#testInput"
18-
Then I expect that inputfield "#testInput" contains the text "test more tests"
18+
Then I expect that element "#testInput" contains the text "test more tests"
1919

2020
Scenario: Clear the content of a input field
2121
When I set "test" to the inputfield "#testInput"
22-
Then I expect that inputfield "#testInput" contains any text
23-
And I expect that inputfield "#testInput" contains the text "test"
22+
Then I expect that element "#testInput" contains any text
23+
And I expect that element "#testInput" contains the text "test"
2424
When I clear the inputfield "#testInput"
25-
Then I expect that inputfield "#testInput" not contains any text
25+
Then I expect that element "#testInput" not contains any text

src/features/isEmpty.feature

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Feature: Test input fields on a page
2+
As a developer
3+
I want to be able to test input fields on a certain page
4+
5+
Background:
6+
Given I open the site "/"
7+
Then I expect that element "#testInput" is empty
8+
9+
Scenario: Set the content of a input field
10+
When I set "test" to the inputfield "#testInput"
11+
Then I expect that element "#testInput" is not empty
12+
And I expect that element "#testInput" contains the text "test"
13+
14+
Scenario: Add content to a input field
15+
When I set "test" to the inputfield "#testInput"
16+
Then I expect that element "#testInput" is not empty
17+
When I add " more tests" to the inputfield "#testInput"
18+
Then I expect that element "#testInput" contains the text "test more tests"
19+
20+
Scenario: Clear the content of a input field
21+
When I set "test" to the inputfield "#testInput"
22+
Then I expect that element "#testInput" is not empty
23+
And I expect that element "#testInput" contains the text "test"
24+
When I clear the inputfield "#testInput"
25+
Then I expect that element "#testInput" is empty

src/features/sampleSnippets.feature

+11-11
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,27 @@ Feature: Sample Snippets test
4141

4242
Scenario: add value to an input element
4343
Given I open the url "http://webdriverjs.christian-bromann.com/"
44-
And the inputfield "//html/body/section/form/input[1]" not contains the text "abc"
44+
And the element "//html/body/section/form/input[1]" not contains the text "abc"
4545
When I add "bc" to the inputfield "//html/body/section/form/input[1]"
46-
Then I expect that inputfield "//html/body/section/form/input[1]" contains the text "abc"
46+
Then I expect that element "//html/body/section/form/input[1]" contains the text "abc"
4747

4848
Scenario: set value to an input element
4949
Given I open the url "http://webdriverjs.christian-bromann.com/"
50-
And the inputfield "//html/body/section/form/input[1]" not contains the text "bc"
50+
And the element "//html/body/section/form/input[1]" not contains the text "bc"
5151
When I set "bc" to the inputfield "//html/body/section/form/input[1]"
52-
Then I expect that inputfield "//html/body/section/form/input[1]" contains the text "bc"
52+
Then I expect that element "//html/body/section/form/input[1]" contains the text "bc"
5353

5454
Scenario: clear value of input element
5555
Given I open the url "http://webdriverjs.christian-bromann.com/"
5656
When I set "test" to the inputfield "//html/body/section/form/input[1]"
5757
And I clear the inputfield "//html/body/section/form/input[1]"
58-
Then I expect that inputfield "//html/body/section/form/input[1]" not contains any text
58+
Then I expect that element "//html/body/section/form/input[1]" not contains any text
5959

6060
Scenario: drag n drop
6161
Given I open the url "http://webdriverjs.christian-bromann.com/"
62-
And the inputfield ".searchinput" not contains the text "Dropped!"
62+
And the element ".searchinput" not contains the text "Dropped!"
6363
When I drag element "#overlay" to element ".red"
64-
Then I expect that inputfield ".searchinput" contains the text "Dropped!"
64+
Then I expect that element ".searchinput" contains the text "Dropped!"
6565

6666
Scenario: submit form
6767
Given I open the url "http://webdriverjs.christian-bromann.com/"
@@ -115,10 +115,10 @@ Feature: Sample Snippets test
115115

116116
Scenario: check input content
117117
Given I open the url "http://webdriverjs.christian-bromann.com/"
118-
And the inputfield "//html/body/section/form/input[1]" contains the text "a"
119-
And the inputfield "//html/body/section/form/input[1]" not contains the text "aa"
120-
Then I expect that inputfield "//html/body/section/form/input[1]" contains the text "a"
121-
And I expect that inputfield "//html/body/section/form/input[1]" not contains the text "aa"
118+
And the element "//html/body/section/form/input[1]" contains the text "a"
119+
And the element "//html/body/section/form/input[1]" not contains the text "aa"
120+
Then I expect that element "//html/body/section/form/input[1]" contains the text "a"
121+
And I expect that element "//html/body/section/form/input[1]" not contains the text "aa"
122122

123123
Scenario: check attribut
124124
Given I open the url "http://webdriverjs.christian-bromann.com/"

src/features/textComparison.feature

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Feature: Test text contents of elements
3131
Then I expect that element "#textDoesContainCucumber" contains the text "This element contains cucumber"
3232

3333
Scenario: Input containing different text
34-
Then I expect that inputfield "#valueDoesNotContainCucumber" not contains the text "This input contains cucumber"
34+
Then I expect that element "#valueDoesNotContainCucumber" not contains the text "This input contains cucumber"
3535

3636
Scenario: Input containing the same text
37-
Then I expect that inputfield "#valueDoesContainCucumber" contains the text "This input contains cucumber"
37+
Then I expect that element "#valueDoesContainCucumber" contains the text "This input contains cucumber"

src/features/wait.feature

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Feature: Test waiting for actions
3737
Then I wait on element "#waitForContainsTextElement" for 1000ms to contain a text
3838

3939
Scenario: Test if element to contain a value
40-
Given the inputfield "#waitForContainsValueElement" not contains any text
40+
Given the element "#waitForContainsValueElement" not contains any text
4141
When I click on the button "#waitForContainsValueBtn"
4242
Then I wait on element "#waitForContainsValueElement" for 1000ms to contain a value
4343

@@ -89,7 +89,7 @@ Feature: Test waiting for actions
8989
Scenario: Test if element to not contain a value
9090
When I click on the button "#waitForContainsValueBtn"
9191
And I pause for 1000ms
92-
Then I expect that inputfield "#waitForContainsValueElement" contains any text
92+
Then I expect that element "#waitForContainsValueElement" contains any text
9393
When I click on the button "#waitForContainsValueBtn"
9494
Then I wait on element "#waitForContainsValueElement" for 2000ms to not contain a value
9595

src/steps/given.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import checkContainsAnyText from '../support/check/checkContainsAnyText';
2+
import checkIsEmpty from '../support/check/checkIsEmpty';
23
import checkContainsText from '../support/check/checkContainsText';
34
import checkCookieContent from '../support/check/checkCookieContent';
45
import checkCookieExists from '../support/check/checkCookieExists';
@@ -60,20 +61,25 @@ module.exports = function given() {
6061
);
6162

6263
this.Given(
63-
/^the (element|inputfield) "([^"]*)?"( not)* matches the text "([^"]*)?"$/,
64+
/^the element "([^"]*)?"( not)* matches the text "([^"]*)?"$/,
6465
checkEqualsText
6566
);
6667

6768
this.Given(
68-
/^the (element|inputfield) "([^"]*)?"( not)* contains the text "([^"]*)?"$/,
69+
/^the element "([^"]*)?"( not)* contains the text "([^"]*)?"$/,
6970
checkContainsText
7071
);
7172

7273
this.Given(
73-
/^the (element|inputfield) "([^"]*)?"( not)* contains any text$/,
74+
/^the element "([^"]*)?"( not)* contains any text$/,
7475
checkContainsAnyText
7576
);
7677

78+
this.Given(
79+
/^the element "([^"]*)?" is( not)* empty$/,
80+
checkIsEmpty
81+
);
82+
7783
this.Given(
7884
/^the page url is( not)* "([^"]*)?"$/,
7985
checkUrl

0 commit comments

Comments
 (0)