webship-js 1.0.23 → 1.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/.github/workflows/github-actions.yml +25 -9
  2. package/README.md +4 -7
  3. package/assets/config_templates/circleci-linux-chrome.conf.js +8 -3
  4. package/bitbucket-pipelines.yml +1 -1
  5. package/examples/test--then--i-should--see-text-in-element.html +48 -0
  6. package/examples/test--when--i-check-uncheck-checkbox.html +5 -3
  7. package/lib/custom-assertions/checkboxChecked.js +33 -0
  8. package/lib/custom-assertions/elementContainsCss.js +32 -0
  9. package/lib/custom-assertions/elementContainsText.js +32 -0
  10. package/lib/custom-assertions/responseStatus.js +1 -1
  11. package/lib/custom-assertions/shouldVisible.js +1 -1
  12. package/lib/custom-assertions/textMatching.js +32 -0
  13. package/lib/custom-commands/checkItem.js +21 -16
  14. package/lib/custom-commands/uncheckItem.js +21 -16
  15. package/nightwatch.conf.js +5 -1
  16. package/package.json +14 -14
  17. package/tests/features/test--then--i-should--not--see-text-in-element.feature +8 -8
  18. package/tests/features/test--then--i-should--see-text-matching-pattern-in-element.feature +0 -5
  19. package/tests/features/test--then--the-checkbox-is-checked.feature +9 -9
  20. package/tests/features/test--then--the-checkbox-should-be-checked.feature +3 -3
  21. package/tests/features/test--then--the-element-should_not-contain-cssproperty.feature +2 -2
  22. package/tests/features/test--then--the-field-should-contain-value.feature +4 -4
  23. package/tests/features/test--then--the-response-status-code-should-be.feature +4 -4
  24. package/tests/features/test--when--i-attach-file-to-feild.feature +5 -5
  25. package/tests/features/test--when--i-check-checkbox.feature +13 -9
  26. package/tests/features/test--when--i-click-link.feature +2 -2
  27. package/tests/features/test--when--i-fill-in.feature +8 -8
  28. package/tests/features/test--when--i-go-to-homepage.feature +10 -0
  29. package/tests/features/test--when--i-move-forward-backward-one-page.feature +2 -2
  30. package/tests/features/test--when--i-select-option-from-dropdownlist.feature +1 -1
  31. package/tests/step-definitions/webship.js +381 -102
  32. package/lib/custom-assertions/backToHomepage.js +0 -15
  33. package/tests/features/test--when--i-uncheck-checkbox.feature +0 -18
@@ -8,27 +8,43 @@ jobs:
8
8
  runs-on: ubuntu-latest
9
9
 
10
10
  env:
11
- TEST_BASE_URL: http://localhost:8080/
12
- SELENIUM_HOST: http://selenium:4444/wd/hub
11
+ TEST_BASE_URL: http://localhost:8080
13
12
 
14
13
  steps:
15
14
  - name: Install Chrome
16
15
  run: |
17
- CHROME_VERSION="117.0.5938.92-1"
18
- wget https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb
19
- sudo dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb
16
+ sudo apt install libu2f-udev
17
+ sudo apt-get install libappindicator1 fonts-liberation libgbm1 libgtk-3-0 xdg-utils
18
+ export CHROME_BIN=/usr/bin/google-chrome
19
+ CHROME_VERSION="120.0.6099.109-1"
20
+ wget https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb
21
+ sudo dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb
22
+ rm google-chrome-stable_${CHROME_VERSION}_amd64.deb
23
+ - name: Install/Update Chrome Driver
24
+ run: |
25
+ CHROME_DRIVER_VERSION="114.0.5735.90";
26
+ echo $CHROME_DRIVER_VERSION;
27
+ wget http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip
28
+ unzip chromedriver_linux64.zip
29
+ sudo chmod +x chromedriver
30
+ sudo mv -f chromedriver /usr/bin/
31
+ rm chromedriver_linux64.zip
32
+
20
33
  - uses: actions/checkout@v3
21
34
  - name: Use Node.js
22
35
  uses: actions/setup-node@v3
23
36
  with:
24
37
  node-version: '18.x'
38
+
39
+ - name: Run Selenium Standalone server
40
+ run: |
41
+ wget https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.1.0/selenium-server-4.1.2.jar
42
+ java -jar selenium-server-4.1.2.jar -role node -hub http://localhost:4444
43
+
44
+
25
45
  - name: Install
26
46
  run: yarn install
27
47
  - name: Configure nightwatch.conf.js for Github
28
48
  run: node webship-init -ci github -os linux -b chrome
29
- - name: Start
30
- run: |
31
- export NODE_OPTIONS=--openssl-legacy-provider
32
- yarn start &
33
49
  - name: Test
34
50
  run: yarn test
package/README.md CHANGED
@@ -1,18 +1,15 @@
1
1
  # Webship JS
2
2
 
3
3
  [![Github Actions](https://github.com/webship/webship-js/actions/workflows/github-actions.yml/badge.svg?branch=1.0.x)](https://github.com/webship/webship-js/actions)
4
- [![CircleCI](https://circleci.com/gh/webship/webship-js/tree/1.0.x.svg?style=svg)](https://circleci.com/gh/webship/webship-js/tree/1.0.x) CircleCI
5
4
  [![Gitlab CI](https://gitlab.com/webship/webship-js/badges/1.0.x/pipeline.svg?job=karma&key_text=Gitlab+CI&key_width=60)](https://gitlab.com/webship/webship-js/-/pipelines)
5
+ [![CircleCI](https://circleci.com/gh/webship/webship-js/tree/1.0.x.svg?style=svg)](https://circleci.com/gh/webship/webship-js/tree/1.0.x)
6
+ [![Bitbucket Pipelines](https://img.shields.io/bitbucket/pipelines/webshipco/webship-js/1.0.x)](https://bitbucket.org/webshipco/webship-js/pipelines)
6
7
 
7
- Webship JS has a ready step definitions for automated functional testing.
8
-
9
- ### Using:
10
- * [Cucumber-js](https://github.com/cucumber/cucumber-js)
11
- * [Nightwatch.js](https://github.com/nightwatchjs/nightwatch)
12
8
 
9
+ Webship-js is an Automated Functional Acceptance Testing tool. Helps to ease and speed the work with the End-to-end testing features in web apps or projects. Utilizing [Nightwatch.js](https://github.com/nightwatchjs/nightwatch) and [Cucumber-js](https://github.com/cucumber/cucumber-js). Having custom and advanced general step definitions.
13
10
 
14
11
  ### Webship-js Documentations
15
- All you need to know about [webship-js Docs](https://webship.co/docs/webship-js/1.0.x).
12
+ All you need to know is at [webship-js Docs](https://webship.co/docs/webship-js/1.0.x).
16
13
 
17
14
 
18
15
  ## Install webship-js using Yarn
@@ -23,11 +23,12 @@ module.exports = {
23
23
  test_settings: {
24
24
  default: {
25
25
  launch_url: 'http://localhost:8080/',
26
+ start_process: true,
26
27
  selenium_port: 4444,
27
28
  selenium_host: '127.0.0.1',
28
29
  silent: true,
29
30
  screenshots: {
30
- enabled: true,
31
+ enabled: false,
31
32
  path: './reports/screenshots',
32
33
  },
33
34
 
@@ -75,14 +76,18 @@ module.exports = {
75
76
  'webdriver.chrome.driver': (Services.chromedriver ? Services.chromedriver.path : ''),
76
77
  },
77
78
  },
79
+
80
+ webdriver: {
81
+ start_process: false
82
+ },
78
83
  },
79
84
 
80
85
  'selenium.chrome': {
81
- extends: 'selenium_server',
86
+ extends: 'selenium',
82
87
  desiredCapabilities: {
83
88
  browserName: 'chrome',
84
89
  chromeOptions: {
85
- w3c: true,
90
+ w3c: false,
86
91
  },
87
92
  },
88
93
  }
@@ -1,4 +1,4 @@
1
- image: node:16 # Choose an appropriate Node.js version
1
+ image: node:18 # Choose an appropriate Node.js version
2
2
 
3
3
  pipelines:
4
4
  default:
@@ -0,0 +1,48 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset='utf-8'>
5
+ <title>Press Button</title>
6
+ <style>
7
+ .container,
8
+ .container input,
9
+ .container button{
10
+ font-size: 26px;
11
+ }
12
+ .style{
13
+ width: 400px;
14
+ height: 50px;
15
+ font-size: 18px;
16
+ line-height: 50px;
17
+ text-align: center;
18
+ }
19
+ </style>
20
+
21
+ <script>
22
+ function onClick(){
23
+ const username = document.getElementById("uname");
24
+ const password = document.getElementById("pword");
25
+ const element = document.getElementById("result");
26
+ element.innerText = "You enter Username: " + username.value + " and Password: " + password.value;
27
+ }
28
+ </script>
29
+
30
+ </head>
31
+ <body>
32
+ <h1>Login</h1>
33
+
34
+ <div class="container">
35
+ <p><label for="uname"><b>Username</b></label></p>
36
+ <p><input id="uname" class="unamecss" type="text" placeholder="Enter Username" name="username"></p>
37
+
38
+ <p><label for="pword"><b>Password</b></label></p>
39
+ <p><input id="pword" class="pwordcss" type="password" placeholder="Enter Password" name="password"></p>
40
+
41
+ <p><input id="reset" type="reset" value="Reset" /><input id="btnLogin" class="btnLogin" name="btnLogin" type="button" value="Login" onclick="onClick()" /></p>
42
+
43
+ </div>
44
+
45
+ <div id="result" class="style"></div><br/>
46
+
47
+ </body>
48
+ </html>
@@ -30,12 +30,14 @@
30
30
  <body>
31
31
  <h1>Check Option</h1>
32
32
  <form>
33
- <input type="checkbox" id="vehicle1" name="vehicle1" value="Bike">
33
+ <input type="checkbox" id="bike" name="vehicle1" value="Bike">
34
34
  <label for="vehicle1"> I have a bike</label><br>
35
- <input type="checkbox" id="vehicle2" name="vehicle2" value="Car">
35
+ <input type="checkbox" id="car" name="vehicle2" value="Car">
36
36
  <label for="vehicle2"> I have a car</label><br>
37
- <input type="checkbox" id="vehicle3" name="vehicle3" value="Boat">
37
+ <input type="checkbox" id="boat" name="vehicle3" value="Boat">
38
38
  <label for="vehicle3"> I have a boat</label><br>
39
+ <input type="checkbox" id="van" class="van" name="vehicle4a" value="Van">
40
+ <label for="vehicle4"> I have a van</label><br>
39
41
  </form>
40
42
 
41
43
  <input id="btnClick" class="btnClick" name="btnClick" type="button" value="Submit" onclick="onClick()">
@@ -1,6 +1,39 @@
1
1
 
2
2
  module.exports.assertion = function (checkbox, negativeCase) {
3
3
 
4
+ this.expected = function () {
5
+ return negativeCase ? `not contains '${expectedText}'` : `contains '${expectedText}'`;
6
+ };
7
+
8
+ this.evaluate = function (value) {
9
+ return (typeof value === 'string') && (value.includes(expectedText) !== negativeCase);
10
+ };
11
+
12
+ this.value = function (result) {
13
+ return result.value;
14
+ };
15
+
16
+ /**
17
+ * The command which is to be executed by the assertion runner; Nightwatch api is available as browser.api
18
+ * @param {function} callback
19
+ */
20
+ this.command = function(callback) {
21
+ setTimeout(function() {
22
+ callback({
23
+ value: ''
24
+ });
25
+ }, 1000);
26
+ };
27
+
28
+
29
+ this.pass = function (value) {
30
+ return this.evaluate(value);
31
+ };
32
+
33
+ this.failure = function (result) {
34
+ return result === false || result && result.status === -1;
35
+ };
36
+
4
37
  browser.element('css selector', checkbox, function (result) {
5
38
  if (result.status === 0) {
6
39
  if (negativeCase) {
@@ -7,6 +7,38 @@ module.exports.assertion = function (element, negativeCase, elementCss) {
7
7
  const cssProperty = cssPropertyArr[0].trim();
8
8
  const propertyVal = cssPropertyArr[1].trim();
9
9
 
10
+ this.expected = function () {
11
+ return negativeCase ? `not contains '${expectedText}'` : `contains '${expectedText}'`;
12
+ };
13
+
14
+ this.evaluate = function (value) {
15
+ return (typeof value === 'string') && (value.includes(expectedText) !== negativeCase);
16
+ };
17
+
18
+ this.value = function (result) {
19
+ return result.value;
20
+ };
21
+
22
+ /**
23
+ * The command which is to be executed by the assertion runner; Nightwatch api is available as browser.api
24
+ * @param {function} callback
25
+ */
26
+ this.command = function(callback) {
27
+ setTimeout(function() {
28
+ callback({
29
+ value: ''
30
+ });
31
+ }, 1000);
32
+ };
33
+
34
+ this.pass = function (value) {
35
+ return this.evaluate(value);
36
+ };
37
+
38
+ this.failure = function (result) {
39
+ return result === false || result && result.status === -1;
40
+ };
41
+
10
42
  browser.element('css selector', element, function (result) {
11
43
  if (result.status === 0) {
12
44
  if (negativeCase) {
@@ -1,6 +1,38 @@
1
1
 
2
2
  module.exports.assertion = function (negativeCase, expectedText, element) {
3
3
 
4
+ this.expected = function () {
5
+ return negativeCase ? `not contains '${expectedText}'` : `contains '${expectedText}'`;
6
+ };
7
+
8
+ this.evaluate = function (value) {
9
+ return (typeof value === 'string') && (value.includes(expectedText) !== negativeCase);
10
+ };
11
+
12
+ this.value = function (result) {
13
+ return result.value;
14
+ };
15
+
16
+ /**
17
+ * The command which is to be executed by the assertion runner; Nightwatch api is available as browser.api
18
+ * @param {function} callback
19
+ */
20
+ this.command = function(callback) {
21
+ setTimeout(function() {
22
+ callback({
23
+ value: ''
24
+ });
25
+ }, 1000);
26
+ };
27
+
28
+ this.pass = function (value) {
29
+ return this.evaluate(value);
30
+ };
31
+
32
+ this.failure = function (result) {
33
+ return result === false || result && result.status === -1;
34
+ };
35
+
4
36
  browser.element('css selector', element, function (result) {
5
37
  if (result.status === 0) {
6
38
  if (negativeCase) {
@@ -1,7 +1,7 @@
1
1
  const request = require("request");
2
2
 
3
3
  module.exports.assertion = function (negativeCase, expectedStatusCode) {
4
-
4
+
5
5
  return browser.url(function (currentURL) {
6
6
  request(currentURL.value, (error, response, body) => {
7
7
  if (negativeCase) {
@@ -1,6 +1,6 @@
1
1
 
2
2
  module.exports.assertion = function (negativeCase, element) {
3
-
3
+
4
4
  if (negativeCase) {
5
5
  return browser.verify.not.visible(element).end();
6
6
  }
@@ -1,6 +1,38 @@
1
1
 
2
2
  module.exports.assertion = function (negativeCase, textPattern, element) {
3
3
 
4
+ this.expected = function () {
5
+ return negativeCase ? `not contains '${expectedText}'` : `contains '${expectedText}'`;
6
+ };
7
+
8
+ this.evaluate = function (value) {
9
+ return (typeof value === 'string') && (value.includes(expectedText) !== negativeCase);
10
+ };
11
+
12
+ this.value = function (result) {
13
+ return result.value;
14
+ };
15
+
16
+ /**
17
+ * The command which is to be executed by the assertion runner; Nightwatch api is available as browser.api
18
+ * @param {function} callback
19
+ */
20
+ this.command = function(callback) {
21
+ setTimeout(function() {
22
+ callback({
23
+ value: ''
24
+ });
25
+ }, 1000);
26
+ };
27
+
28
+ this.pass = function (value) {
29
+ return this.evaluate(value);
30
+ };
31
+
32
+ this.failure = function (result) {
33
+ return result === false || result && result.status === -1;
34
+ };
35
+
4
36
  browser.elements('css selector', element, function (elements) {
5
37
  elements.value.forEach(function (elementsObj) {
6
38
  if (negativeCase) {
@@ -1,4 +1,3 @@
1
-
2
1
  module.exports.command = function (item) {
3
2
 
4
3
  browser.element('css selector', item, function (result) {
@@ -9,24 +8,30 @@ module.exports.command = function (item) {
9
8
  if (result.status === 0) {
10
9
  return browser.click('#' + item);
11
10
  } else {
12
- browser.element('css selector', 'input[name="' + item + '"]', function (result) {
11
+ browser.element('css selector', '.' + item, function (result) {
13
12
  if (result.status === 0) {
14
- return browser.click('input[name="' + item + '"]');
13
+ return browser.click('.' + item);
15
14
  } else {
16
- browser.element('css selector', 'input[value="' + item + '"]', function (result) {
15
+ browser.element('css selector', 'input[name="' + item + '"]', function (result) {
17
16
  if (result.status === 0) {
18
- return browser.click('input[value="' + item + '"]');
17
+ return browser.click('input[name="' + item + '"]');
19
18
  } else {
20
- browser.elements('css selector', 'label', function (elements) {
21
- elements.value.forEach(function (elementsObj) {
22
- browser.elementIdText(elementsObj.ELEMENT, function (result) {
23
- if (result.value == item) {
24
- browser.getAttribute(elementsObj, "for", function (forVal) {
25
- return browser.click('#' + forVal.value);
26
- });
27
- }
28
- })
29
- });
19
+ browser.element('css selector', 'input[value="' + item + '"]', function (result) {
20
+ if (result.status === 0) {
21
+ return browser.click('input[value="' + item + '"]');
22
+ } else {
23
+ browser.elements('css selector', 'label', function (elements) {
24
+ elements.value.forEach(function (elementsObj) {
25
+ browser.elementIdText(elementsObj.ELEMENT, function (result) {
26
+ if (result.value == item) {
27
+ browser.getAttribute(elementsObj, "for", function (forVal) {
28
+ return browser.click('#' + forVal.value);
29
+ });
30
+ }
31
+ })
32
+ });
33
+ });
34
+ }
30
35
  });
31
36
  }
32
37
  });
@@ -36,4 +41,4 @@ module.exports.command = function (item) {
36
41
  });
37
42
  }
38
43
  });
39
- }
44
+ }
@@ -1,4 +1,3 @@
1
-
2
1
  module.exports.command = function (item) {
3
2
 
4
3
  browser.element('css selector', item, function (result) {
@@ -9,24 +8,30 @@ module.exports.command = function (item) {
9
8
  if (result.status === 0) {
10
9
  return browser.click('#' + item);
11
10
  } else {
12
- browser.element('css selector', 'input[name=' + item + ']', function (result) {
11
+ browser.element('css selector', '.' + item, function (result) {
13
12
  if (result.status === 0) {
14
- return browser.click('input[name=' + item + ']');
13
+ return browser.click('.' + item);
15
14
  } else {
16
- browser.element('css selector', 'input[value="' + item + '"]', function (result) {
15
+ browser.element('css selector', 'input[name=' + item + ']', function (result) {
17
16
  if (result.status === 0) {
18
- return browser.click('input[value="' + item + '"]');
17
+ return browser.click('input[name=' + item + ']');
19
18
  } else {
20
- browser.elements('css selector', 'label', function (elements) {
21
- elements.value.forEach(function (elementsObj) {
22
- browser.elementIdText(elementsObj.ELEMENT, function (result) {
23
- if (result.value == item) {
24
- browser.getAttribute(elementsObj, "for", function (forVal) {
25
- return browser.click('#' + forVal.value);
26
- });
27
- }
28
- })
29
- });
19
+ browser.element('css selector', 'input[value="' + item + '"]', function (result) {
20
+ if (result.status === 0) {
21
+ return browser.click('input[value="' + item + '"]');
22
+ } else {
23
+ browser.elements('css selector', 'label', function (elements) {
24
+ elements.value.forEach(function (elementsObj) {
25
+ browser.elementIdText(elementsObj.ELEMENT, function (result) {
26
+ if (result.value == item) {
27
+ browser.getAttribute(elementsObj, "for", function (forVal) {
28
+ return browser.click('#' + forVal.value);
29
+ });
30
+ }
31
+ })
32
+ });
33
+ });
34
+ }
30
35
  });
31
36
  }
32
37
  });
@@ -36,4 +41,4 @@ module.exports.command = function (item) {
36
41
  });
37
42
  }
38
43
  });
39
- }
44
+ }
@@ -76,6 +76,10 @@ module.exports = {
76
76
  'webdriver.chrome.driver': (Services.chromedriver ? Services.chromedriver.path : ''),
77
77
  },
78
78
  },
79
+
80
+ webdriver: {
81
+ start_process: false
82
+ },
79
83
  },
80
84
 
81
85
  'selenium.chrome': {
@@ -83,7 +87,7 @@ module.exports = {
83
87
  desiredCapabilities: {
84
88
  browserName: 'chrome',
85
89
  chromeOptions: {
86
- w3c: true,
90
+ w3c: false,
87
91
  },
88
92
  },
89
93
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webship-js",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "description": "Webship JS automated functional testing.",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "engines": {
10
10
  "yarn": ">= 1.6",
11
- "node": ">= 16.0"
11
+ "node": ">= 18.0"
12
12
  },
13
13
  "scripts": {
14
14
  "test": "nightwatch --format @cucumber/pretty-formatter --format-options '{\"colorsEnabled\": true}' --format-options '{\"theme\": {\"feature keyword\":[\"bold\",\"blue\"],\"feature name\":[\"blue\",\"underline\"],\"feature description\":[\"blueBright\"],\"scenario keyword\":[\"bold\",\"magenta\"],\"scenario name\":[\"magenta\",\"underline\"],\"step keyword\":[\"bold\",\"green\"],\"step text\":[\"greenBright\",\"italic\"]}}' --format json:./tests/reports/cucumber_report.json; node generate-reports.js;",
@@ -28,21 +28,21 @@
28
28
  },
29
29
  "homepage": "https://github.com/webship/webship-js",
30
30
  "dependencies": {
31
- "nightwatch": "~2.0",
31
+ "nightwatch": "~3",
32
32
  "@cucumber/cucumber": "*",
33
- "@cucumber/pretty-formatter": "^1.0.0-alpha.2",
34
- "args-parser": "~1.0",
35
- "cucumber-html-reporter": "^7.1.0",
36
- "eslint": "~8.0",
37
- "eslint-config-airbnb-base": "~15.0",
38
- "eslint-plugin-import": "~2.25",
39
- "lodash": "~4.17.21",
40
- "webpack": "~5.0",
33
+ "@cucumber/pretty-formatter": "~1",
34
+ "args-parser": "~1",
35
+ "cucumber-html-reporter": "~7",
36
+ "eslint": "~8",
37
+ "eslint-config-airbnb-base": "~15",
38
+ "eslint-plugin-import": "~2",
39
+ "lodash": "~4",
40
+ "webpack": "~5",
41
41
  "chromedriver": "*",
42
42
  "geckodriver": "*",
43
- "webpack-cli": "~5.0",
44
- "webpack-dev-server": "~4.0",
45
- "request": "~2.0"
43
+ "webpack-cli": "~5",
44
+ "webpack-dev-server": "~4",
45
+ "request": "~2"
46
46
  },
47
47
  "bin": {
48
48
  "steplist": "./steplist.js"
@@ -4,14 +4,14 @@ Feature: An example to test whether an element contains a certain text or not
4
4
 
5
5
  Scenario: Check an element if it contains a specific text
6
6
  Given I am on "/test--then--i-should--not--see-text-in-element.html"
7
- And I fill in "Username" with "user1"
8
- And I fill in "Password" with "1234"
9
- Then I should see "user1" in the "Username" element
10
- When I fill in "Username" with:
11
- And I fill in "Password" with:
12
- Then I should not see "user1" in the "Username" element
7
+ And I fill in "#uname" with "user1"
8
+ And I fill in "#pword" with "1234"
9
+ Then I should see "user1" in the "#uname" element
10
+ When I fill in "#uname" with:
11
+ And I fill in "#pword" with:
12
+ Then I should not see "user1" in the "#uname" element
13
13
 
14
14
  Scenario: Check an element if it does not contain a specific text
15
15
  Given I am on "/test--then--i-should--not--see-text-in-element.html"
16
- And I fill in "Username" with "user2"
17
- Then I should not see "user1" in the "Username" element
16
+ And I fill in "#uname" with "user2"
17
+ Then I should not see "user1" in the "#uname" element
@@ -7,11 +7,6 @@ Scenario: Check if text exist in an element has a pattern match with 12-hour tim
7
7
  And I wait max of 3 seconds
8
8
  Then I should see text matching "(((0[1-9])|(1[0-2])):([0-5])(0|5)\s(A|P|a|p)(M|m))" in the ".time" element
9
9
 
10
- Scenario: Check if text exist in an element has a pattern not match with date YYYY-MM-DD
11
- Given I am on "/test--then--i-should--see-text-matching-pattern.html"
12
- And I wait max of 3 seconds
13
- Then I should not see text matching "\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])" in the "#date" element
14
-
15
10
  Scenario: Check if text exist in an element has a pattern match with date DD/MM/YYYY or DD-MM-YYYY
16
11
  Given I am on "/test--then--i-should--see-text-matching-pattern.html"
17
12
  And I wait max of 3 seconds
@@ -4,15 +4,15 @@ Feature: An example of test for selecting a checkbox
4
4
 
5
5
  Scenario: Check that the checkbox is checked
6
6
  Given I am on "/test--then--the-checkbox-checked.html"
7
- When I check "rememberMe"
8
- And I check "PrivacyPolicy"
9
- And I press "Register"
10
- Then the checkbox "Remember me" is checked
11
- And I should see "Registration Done Successfully"
7
+ When I check "#rememberMe"
8
+ And I check "#PrivacyPolicy"
9
+ And I press "Register"
10
+ Then the checkbox "#rememberMe" is checked
11
+ And I should see "Registration Done Successfully"
12
12
 
13
13
  Scenario: Check that the checkbox is not checked
14
14
  Given I am on "/test--then--the-checkbox-checked.html"
15
- When I check "PrivacyPolicy"
16
- And I press "Register"
17
- Then the checkbox "Remember me" is not checked
18
- Then I should see "Registration Done Successfully"
15
+ When I check "#PrivacyPolicy"
16
+ And I press "Register"
17
+ Then the checkbox "#rememberMe" is not checked
18
+ Then I should see "Registration Done Successfully"
@@ -4,13 +4,13 @@ Feature: An example of test assert for selecting a checkbox
4
4
 
5
5
  Scenario: Check that the checkbox should be checked
6
6
  Given I am on "/test--then--the-checkbox-checked.html"
7
- When I check "PrivacyPolicy"
7
+ When I check "#PrivacyPolicy"
8
8
  And I press "Register"
9
- Then the checkbox "PrivacyPolicy" should be checked
9
+ Then the checkbox "#PrivacyPolicy" should be checked
10
10
  And I should see "Registration Done Successfully"
11
11
 
12
12
  Scenario: Check that the checkbox should not be checked
13
13
  Given I am on "/test--then--the-checkbox-checked.html"
14
14
  When I press "Register"
15
- Then the "PrivacyPolicy" checkbox should not be checked
15
+ Then the "#PrivacyPolicy" checkbox should not be checked
16
16
  And I should see "Please check Agree to Privacy Policy"
@@ -6,10 +6,10 @@ Feature: An example to test if the element contains a certain expected CSS prope
6
6
  Given I am on "/test--then--the-element-should_not-contain-cssproperty.html"
7
7
  Then I should see a "body" element
8
8
  When I press "Submit"
9
- Then the "body" element should contain "background-color: white;"
9
+ Then the "body" element should contain "background-color:white;"
10
10
 
11
11
  Scenario: Check element if the element not contains a certain CSS property
12
12
  Given I am on "/test--then--the-element-should_not-contain-cssproperty.html"
13
13
  Then I should see a "body" element
14
14
  When I press "Submit"
15
- Then the "Username" element should not contain "border: solid 5px red;"
15
+ Then the "#uname" element should not contain "border:solid 5px red;"