webship-js 1.0.46 → 2.0.0-alpha1
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.
- package/.circleci/config.yml +17 -63
- package/.claude/settings.local.json +134 -0
- package/.github/workflows/github-actions.yml +8 -37
- package/.gitlab-ci.yml +12 -35
- package/.travis-ci.yml +12 -23
- package/.travis.yml +17 -0
- package/README.md +8 -8
- package/bitbucket-pipelines.yml +5 -11
- package/cucumber.js +36 -0
- package/examples/dynamic-examples.html +1 -2
- package/examples/index.html +0 -1
- package/examples/test--modal-dialogs.html +252 -0
- package/examples/test--when--i-click-text-in-table-row.html +1 -1
- package/examples/test--when--i-scroll-functionality.html +34 -33
- package/examples/test--when--i-scroll-left-right-functionality.html +115 -173
- package/package.json +10 -21
- package/playwright.config.ts +37 -0
- package/tests/assets/test-document.pdf +14 -0
- package/tests/step-definitions/webship-api.js +5 -31
- package/tests/step-definitions/webship.js +849 -2498
- package/tsconfig.json +10 -0
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -34
- package/assets/config_templates/circleci-linux-chrome.conf.js +0 -118
- package/assets/config_templates/github-linux-chrome.conf.js +0 -124
- package/dist/nightwatch.conf.dev.js +0 -93
- package/examples/main.js +0 -17
- package/lib/custom-assertions/checkboxChecked.js +0 -87
- package/lib/custom-assertions/elementContainsCss.js +0 -94
- package/lib/custom-assertions/elementContainsText.js +0 -86
- package/lib/custom-assertions/responseStatus.js +0 -31
- package/lib/custom-assertions/shouldVisible.js +0 -8
- package/lib/custom-assertions/textMatching.js +0 -44
- package/lib/custom-commands/checkItem.js +0 -4
- package/lib/custom-commands/clickLink.js +0 -23
- package/lib/custom-commands/fileUpload.js +0 -37
- package/lib/custom-commands/fillTextInput.js +0 -56
- package/lib/custom-commands/press.js +0 -3
- package/lib/custom-commands/selectOption.js +0 -11
- package/lib/custom-commands/uncheckItem.js +0 -4
- package/lib/custom-commands/wait.js +0 -12
- package/nightwatch.conf.js +0 -118
- package/src/index.js +0 -10
- package/steplist.js +0 -245
- package/webpack.config.js +0 -17
- package/webship-init.js +0 -75
package/tsconfig.json
ADDED
package/.eslintignore
DELETED
package/.eslintrc.json
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": [
|
|
3
|
-
"airbnb-base"
|
|
4
|
-
],
|
|
5
|
-
"root": true,
|
|
6
|
-
"env": {
|
|
7
|
-
"browser": true,
|
|
8
|
-
"node": true
|
|
9
|
-
},
|
|
10
|
-
"globals": {
|
|
11
|
-
"loadjs": true
|
|
12
|
-
},
|
|
13
|
-
"rules": {
|
|
14
|
-
"consistent-return": ["off"],
|
|
15
|
-
"no-underscore-dangle": ["off"],
|
|
16
|
-
"max-nested-callbacks": ["warn", 5],
|
|
17
|
-
"import/no-mutable-exports": ["warn"],
|
|
18
|
-
"no-console": ["off"],
|
|
19
|
-
"no-plusplus": ["warn", {
|
|
20
|
-
"allowForLoopAfterthoughts": true
|
|
21
|
-
}],
|
|
22
|
-
"no-param-reassign": ["off"],
|
|
23
|
-
"no-prototype-builtins": ["off"],
|
|
24
|
-
"valid-jsdoc": ["warn", {
|
|
25
|
-
"prefer": {
|
|
26
|
-
"returns": "return",
|
|
27
|
-
"property": "prop"
|
|
28
|
-
},
|
|
29
|
-
"requireReturn": false
|
|
30
|
-
}],
|
|
31
|
-
"no-unused-vars": ["warn"],
|
|
32
|
-
"operator-linebreak": ["error", "after", { "overrides": { "?": "ignore", ":": "ignore" } }]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
const Services = {}; loadServices();
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
// An array of folders (excluding subfolders) where your tests are located;
|
|
5
|
-
// if this is not specified, the test source must be passed as the second argument to the test runner.
|
|
6
|
-
src_folders: ['tests/step-definitions'],
|
|
7
|
-
|
|
8
|
-
// See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-commands.html
|
|
9
|
-
custom_commands_path: './lib/custom-commands',
|
|
10
|
-
|
|
11
|
-
// See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-assertions.html
|
|
12
|
-
custom_assertions_path: './lib/custom-assertions',
|
|
13
|
-
|
|
14
|
-
test_runner: {
|
|
15
|
-
type: 'cucumber',
|
|
16
|
-
options: {
|
|
17
|
-
feature_path: 'tests/features/*.feature',
|
|
18
|
-
additional_config: '',
|
|
19
|
-
parallel: 2,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
globals: {
|
|
23
|
-
assets_folder : "/test/assets/",
|
|
24
|
-
minimum_wait_time: {
|
|
25
|
-
page: 3000,
|
|
26
|
-
before_scenario: 0,
|
|
27
|
-
after_scenario: 0,
|
|
28
|
-
before_step: 0,
|
|
29
|
-
after_step: 1000
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
test_settings: {
|
|
33
|
-
default: {
|
|
34
|
-
launch_url: 'http://localhost:8080/',
|
|
35
|
-
start_process: true,
|
|
36
|
-
selenium_port: 4444,
|
|
37
|
-
selenium_host: '127.0.0.1',
|
|
38
|
-
silent: true,
|
|
39
|
-
output: false,
|
|
40
|
-
screenshots: {
|
|
41
|
-
enabled: false,
|
|
42
|
-
path: './reports/screenshots',
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
desiredCapabilities: {
|
|
46
|
-
browserName: 'chrome',
|
|
47
|
-
'goog:chromeOptions': {
|
|
48
|
-
// More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/
|
|
49
|
-
//
|
|
50
|
-
// w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
|
|
51
|
-
w3c: true,
|
|
52
|
-
args: [
|
|
53
|
-
'--headless',
|
|
54
|
-
'--start-maximized',
|
|
55
|
-
'--disable-gpu',
|
|
56
|
-
'--window-size=1600,1200',
|
|
57
|
-
'--no-sandbox',
|
|
58
|
-
'--disable-dev-shm-usage',
|
|
59
|
-
'--disable-setuid-sandbox',
|
|
60
|
-
'--disable-web-security',
|
|
61
|
-
'--DNS-prefetch-disable',
|
|
62
|
-
'--disable-translate',
|
|
63
|
-
'--ignore-certificate-errors',
|
|
64
|
-
'--test-type',
|
|
65
|
-
'--disable-extensions',
|
|
66
|
-
'--incognito',
|
|
67
|
-
'--disable-infobars',
|
|
68
|
-
'--remote-debugging-port=9222',
|
|
69
|
-
'--allowed-ips=*',
|
|
70
|
-
'--whitelisted-ips=*',
|
|
71
|
-
'--allow-insecure-localhost',
|
|
72
|
-
],
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
selenium_server: {
|
|
79
|
-
// Selenium Server is running locally and is managed by Nightwatch
|
|
80
|
-
selenium: {
|
|
81
|
-
start_process: true,
|
|
82
|
-
port: 4444,
|
|
83
|
-
server_path: (Services.seleniumServer ? Services.seleniumServer.path : ''),
|
|
84
|
-
cli_args: {
|
|
85
|
-
'webdriver.gecko.driver': (Services.geckodriver ? Services.geckodriver.path : ''),
|
|
86
|
-
'webdriver.chrome.driver': (Services.chromedriver ? Services.chromedriver.path : ''),
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
webdriver: {
|
|
91
|
-
start_process: false
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
'selenium.chrome': {
|
|
96
|
-
extends: 'selenium',
|
|
97
|
-
desiredCapabilities: {
|
|
98
|
-
browserName: 'chrome',
|
|
99
|
-
chromeOptions: {
|
|
100
|
-
w3c: false,
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
function loadServices() {
|
|
107
|
-
try {
|
|
108
|
-
Services.seleniumServer = require('selenium-server');
|
|
109
|
-
} catch (err) {}
|
|
110
|
-
|
|
111
|
-
try {
|
|
112
|
-
Services.chromedriver = require('chromedriver');
|
|
113
|
-
} catch (err) {}
|
|
114
|
-
|
|
115
|
-
try {
|
|
116
|
-
Services.geckodriver = require('geckodriver');
|
|
117
|
-
} catch (err) {}
|
|
118
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
const Services = {}; loadServices();
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
// An array of folders (excluding subfolders) where your tests are located;
|
|
5
|
-
// if this is not specified, the test source must be passed as the second argument to the test runner.
|
|
6
|
-
src_folders: ['tests/step-definitions'],
|
|
7
|
-
|
|
8
|
-
// See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-commands.html
|
|
9
|
-
custom_commands_path: './lib/custom-commands',
|
|
10
|
-
|
|
11
|
-
// See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-assertions.html
|
|
12
|
-
custom_assertions_path: './lib/custom-assertions',
|
|
13
|
-
|
|
14
|
-
webdriver: {
|
|
15
|
-
start_process: true,
|
|
16
|
-
port: 4444,
|
|
17
|
-
server_path: require('chromedriver').path,
|
|
18
|
-
cli_args: [
|
|
19
|
-
// very verbose geckodriver logs
|
|
20
|
-
// '-vv'
|
|
21
|
-
]
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
test_runner: {
|
|
25
|
-
type: 'cucumber',
|
|
26
|
-
options: {
|
|
27
|
-
feature_path: 'tests/features/*.feature',
|
|
28
|
-
additional_config: '',
|
|
29
|
-
parallel: 2,
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
globals: {
|
|
34
|
-
assets_folder : "/test/assets/",
|
|
35
|
-
minimum_wait_time: {
|
|
36
|
-
page: 3000,
|
|
37
|
-
before_scenario: 0,
|
|
38
|
-
after_scenario: 0,
|
|
39
|
-
before_step: 0,
|
|
40
|
-
after_step: 1000
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
test_settings: {
|
|
44
|
-
default: {
|
|
45
|
-
launch_url: 'http://localhost:8080/',
|
|
46
|
-
selenium_port: 4444,
|
|
47
|
-
selenium_host: '127.0.0.1',
|
|
48
|
-
silent: true,
|
|
49
|
-
output: false,
|
|
50
|
-
screenshots: {
|
|
51
|
-
enabled: true,
|
|
52
|
-
path: './reports/screenshots',
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
desiredCapabilities: {
|
|
56
|
-
browserName: 'chrome',
|
|
57
|
-
'goog:chromeOptions': {
|
|
58
|
-
// More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/
|
|
59
|
-
//
|
|
60
|
-
// w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
|
|
61
|
-
w3c: true,
|
|
62
|
-
args: [
|
|
63
|
-
'--headless',
|
|
64
|
-
'--start-maximized',
|
|
65
|
-
'--disable-gpu',
|
|
66
|
-
'--window-size=1600,1200',
|
|
67
|
-
'--no-sandbox',
|
|
68
|
-
'--disable-dev-shm-usage',
|
|
69
|
-
'--disable-setuid-sandbox',
|
|
70
|
-
'--disable-web-security',
|
|
71
|
-
'--DNS-prefetch-disable',
|
|
72
|
-
'--disable-translate',
|
|
73
|
-
'--ignore-certificate-errors',
|
|
74
|
-
'--test-type',
|
|
75
|
-
'--disable-extensions',
|
|
76
|
-
'--incognito',
|
|
77
|
-
'--disable-infobars',
|
|
78
|
-
'--remote-debugging-port=9222',
|
|
79
|
-
'--allowed-ips=*',
|
|
80
|
-
'--whitelisted-ips=*',
|
|
81
|
-
'--allow-insecure-localhost',
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
selenium_server: {
|
|
89
|
-
// Selenium Server is running locally and is managed by Nightwatch
|
|
90
|
-
selenium: {
|
|
91
|
-
start_process: true,
|
|
92
|
-
port: 4444,
|
|
93
|
-
server_path: (Services.seleniumServer ? Services.seleniumServer.path : ''),
|
|
94
|
-
cli_args: {
|
|
95
|
-
'webdriver.gecko.driver': (Services.geckodriver ? Services.geckodriver.path : ''),
|
|
96
|
-
'webdriver.chrome.driver': (Services.chromedriver ? Services.chromedriver.path : ''),
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
'selenium.chrome': {
|
|
102
|
-
extends: 'selenium_server',
|
|
103
|
-
desiredCapabilities: {
|
|
104
|
-
browserName: 'chrome',
|
|
105
|
-
chromeOptions: {
|
|
106
|
-
w3c: true,
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
function loadServices() {
|
|
113
|
-
try {
|
|
114
|
-
Services.seleniumServer = require('selenium-server');
|
|
115
|
-
} catch (err) { }
|
|
116
|
-
|
|
117
|
-
try {
|
|
118
|
-
Services.chromedriver = require('chromedriver');
|
|
119
|
-
} catch (err) { }
|
|
120
|
-
|
|
121
|
-
try {
|
|
122
|
-
Services.geckodriver = require('geckodriver');
|
|
123
|
-
} catch (err) { }
|
|
124
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var Services = {};
|
|
4
|
-
loadServices();
|
|
5
|
-
require('events').EventEmitter.defaultMaxListeners = 1000;
|
|
6
|
-
module.exports = {
|
|
7
|
-
// An array of folders (excluding subfolders) where your tests are located;
|
|
8
|
-
// if this is not specified, the test source must be passed as the second argument to the test runner.
|
|
9
|
-
src_folders: ['./tests/step-definitions'],
|
|
10
|
-
// See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-commands.html
|
|
11
|
-
custom_commands_path: './lib/custom-commands',
|
|
12
|
-
// See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-assertions.html
|
|
13
|
-
custom_assertions_path: './lib/custom-assertions',
|
|
14
|
-
test_runner: {
|
|
15
|
-
type: 'cucumber',
|
|
16
|
-
options: {
|
|
17
|
-
feature_path: './tests/features/*.feature',
|
|
18
|
-
additional_config: '',
|
|
19
|
-
parallel: 1
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
globals: {
|
|
23
|
-
assets_folder: "/test/assets/",
|
|
24
|
-
min_wait_time: {
|
|
25
|
-
page: 10000,
|
|
26
|
-
before_scenario: 0,
|
|
27
|
-
after_scenario: 0,
|
|
28
|
-
before_step: 0,
|
|
29
|
-
after_step: 1000
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
test_settings: {
|
|
33
|
-
"default": {
|
|
34
|
-
launch_url: 'http://localhost:8080',
|
|
35
|
-
selenium_port: 4444,
|
|
36
|
-
selenium_host: '127.0.0.1',
|
|
37
|
-
silent: true,
|
|
38
|
-
output: false,
|
|
39
|
-
screenshots: {
|
|
40
|
-
enabled: true,
|
|
41
|
-
path: './reports/screenshots'
|
|
42
|
-
},
|
|
43
|
-
desiredCapabilities: {
|
|
44
|
-
browserName: 'chrome',
|
|
45
|
-
'goog:chromeOptions': {
|
|
46
|
-
// More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/
|
|
47
|
-
//
|
|
48
|
-
// w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
|
|
49
|
-
w3c: true,
|
|
50
|
-
args: ['--headless', '--start-maximized', '--disable-gpu', '--window-size=1600,1200', '--no-sandbox', '--disable-dev-shm-usage', '--disable-setuid-sandbox', '--disable-web-security', '--DNS-prefetch-disable', '--disable-translate', '--ignore-certificate-errors', '--test-type', '--disable-extensions', '--incognito', '--disable-infobars', '--remote-debugging-port=9222', '--allowed-ips=*', '--whitelisted-ips=*', '--allow-insecure-localhost']
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
selenium_server: {
|
|
56
|
-
// Selenium Server is running locally and is managed by Nightwatch
|
|
57
|
-
selenium: {
|
|
58
|
-
start_process: true,
|
|
59
|
-
port: 4444,
|
|
60
|
-
server_path: Services.seleniumServer ? Services.seleniumServer.path : '',
|
|
61
|
-
cli_args: {
|
|
62
|
-
'webdriver.gecko.driver': Services.geckodriver ? Services.geckodriver.path : '',
|
|
63
|
-
'webdriver.chrome.driver': Services.chromedriver ? Services.chromedriver.path : ''
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
webdriver: {
|
|
67
|
-
start_process: false
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
'selenium.chrome': {
|
|
71
|
-
"extends": 'selenium_server',
|
|
72
|
-
desiredCapabilities: {
|
|
73
|
-
browserName: 'chrome',
|
|
74
|
-
chromeOptions: {
|
|
75
|
-
w3c: false
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
function loadServices() {
|
|
82
|
-
try {
|
|
83
|
-
Services.seleniumServer = require('selenium-server');
|
|
84
|
-
} catch (err) {}
|
|
85
|
-
|
|
86
|
-
try {
|
|
87
|
-
Services.chromedriver = require('chromedriver');
|
|
88
|
-
} catch (err) {}
|
|
89
|
-
|
|
90
|
-
try {
|
|
91
|
-
Services.geckodriver = require('geckodriver');
|
|
92
|
-
} catch (err) {}
|
|
93
|
-
}
|
package/examples/main.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
3
|
-
* This devtool is not neither made for production nor for readable output files.
|
|
4
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
5
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
6
|
-
* or disable the default devtool with "devtool: false".
|
|
7
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
8
|
-
*/
|
|
9
|
-
/******/ (() => { // webpackBootstrap
|
|
10
|
-
/*!**********************!*\
|
|
11
|
-
!*** ./src/index.js ***!
|
|
12
|
-
\**********************/
|
|
13
|
-
/*! unknown exports (runtime-defined) */
|
|
14
|
-
/*! runtime requirements: */
|
|
15
|
-
eval("function component() {\n const element = document.createElement('div');\n\n //Lodash, now imported by this script\n element.innerHTML = _.join(['Hello', 'webpack'], ' ');\n\n return element;\n}\n\ndocument.body.appendChild(component());\n\n//# sourceURL=webpack://webship-js/./src/index.js?");
|
|
16
|
-
/******/ })()
|
|
17
|
-
;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
module.exports.assertion = function (checkbox, negativeCase) {
|
|
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
|
-
|
|
37
|
-
browser.element('css selector', checkbox, function (result) {
|
|
38
|
-
if (result.status === 0) {
|
|
39
|
-
if (negativeCase) {
|
|
40
|
-
return browser.expect.element(checkbox).to.not.be.selected.end();
|
|
41
|
-
}
|
|
42
|
-
return browser.expect.element(checkbox).to.be.selected.end();
|
|
43
|
-
} else {
|
|
44
|
-
browser.element('css selector', '#' + checkbox, function (result) {
|
|
45
|
-
if (result.status === 0) {
|
|
46
|
-
if (negativeCase) {
|
|
47
|
-
return browser.expect.element('#' + checkbox).to.not.be.selected.end();
|
|
48
|
-
}
|
|
49
|
-
return browser.expect.element('#' + checkbox).to.be.selected.end();
|
|
50
|
-
} else {
|
|
51
|
-
browser.element('css selector', 'input[name="' + checkbox + '"]', function (result) {
|
|
52
|
-
if (result.status === 0) {
|
|
53
|
-
if (negativeCase) {
|
|
54
|
-
return browser.expect.element('input[name="' + checkbox + '"]').to.not.be.selected.end();
|
|
55
|
-
}
|
|
56
|
-
return browser.expect.element('input[name="' + checkbox + '"]').to.be.selected.end();
|
|
57
|
-
} else {
|
|
58
|
-
browser.element('css selector', 'input[value="' + checkbox + '"]', function (result) {
|
|
59
|
-
if (result.status === 0) {
|
|
60
|
-
if (negativeCase) {
|
|
61
|
-
return browser.expect.element('input[value="' + checkbox + '"]').to.not.be.selected.end();
|
|
62
|
-
}
|
|
63
|
-
return browser.expect.element('input[value="' + checkbox + '"]').to.be.selected.end();
|
|
64
|
-
} else {
|
|
65
|
-
browser.elements('css selector', 'label', function (elements) {
|
|
66
|
-
elements.value.forEach(function (elementsObj) {
|
|
67
|
-
browser.elementIdText(elementsObj.ELEMENT, function (result) {
|
|
68
|
-
if (result.value == checkbox) {
|
|
69
|
-
browser.getAttribute(elementsObj, "for", function (forVal) {
|
|
70
|
-
if (negativeCase) {
|
|
71
|
-
return browser.expect.element('#' + forVal.value).to.not.be.selected.end();
|
|
72
|
-
}
|
|
73
|
-
return browser.expect.element('#' + forVal.value).to.be.selected.end();
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
})
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
module.exports.assertion = function (element, negativeCase, elementCss) {
|
|
3
|
-
|
|
4
|
-
elementCss = elementCss.replace(";", '');
|
|
5
|
-
const cssPropertyArr = elementCss.split(":");
|
|
6
|
-
|
|
7
|
-
const cssProperty = cssPropertyArr[0].trim();
|
|
8
|
-
const propertyVal = cssPropertyArr[1].trim();
|
|
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
|
-
|
|
42
|
-
browser.element('css selector', element, function (result) {
|
|
43
|
-
if (result.status === 0) {
|
|
44
|
-
if (negativeCase) {
|
|
45
|
-
return browser.assert.not.cssProperty(element, cssProperty, propertyVal).end();
|
|
46
|
-
}
|
|
47
|
-
return browser.assert.cssProperty(element, cssProperty, propertyVal).end();
|
|
48
|
-
} else {
|
|
49
|
-
browser.element('css selector', '#' + element, function (result) {
|
|
50
|
-
if (result.status === 0) {
|
|
51
|
-
if (negativeCase) {
|
|
52
|
-
return browser.assert.not.cssProperty(element, cssProperty, propertyVal).end();
|
|
53
|
-
}
|
|
54
|
-
return browser.assert.cssProperty(element, cssProperty, propertyVal).end();
|
|
55
|
-
} else {
|
|
56
|
-
browser.element('css selector', 'input[name="' + element + '"]', function (result) {
|
|
57
|
-
if (result.status === 0) {
|
|
58
|
-
if (negativeCase) {
|
|
59
|
-
return browser.assert.not.cssProperty(element, cssProperty, propertyVal).end();
|
|
60
|
-
}
|
|
61
|
-
return browser.assert.cssProperty(element, cssProperty, propertyVal).end();
|
|
62
|
-
} else {
|
|
63
|
-
browser.element('css selector', 'input[value="' + element + '"]', function (result) {
|
|
64
|
-
if (result.status === 0) {
|
|
65
|
-
if (negativeCase) {
|
|
66
|
-
return browser.assert.not.cssProperty(element, cssProperty, propertyVal).end();
|
|
67
|
-
}
|
|
68
|
-
return browser.assert.cssProperty(element, cssProperty, propertyVal).end();
|
|
69
|
-
} else {
|
|
70
|
-
browser.elements('css selector', 'label', function (elements) {
|
|
71
|
-
elements.value.forEach(function (elementsObj) {
|
|
72
|
-
browser.elementIdText(elementsObj.ELEMENT, function (result) {
|
|
73
|
-
if (result.value == element) {
|
|
74
|
-
browser.getAttribute(elementsObj, "for", function (forVal) {
|
|
75
|
-
|
|
76
|
-
console.log('#' + forVal.value, cssProperty, propertyVal);
|
|
77
|
-
if (negativeCase) {
|
|
78
|
-
return browser.assert.not.cssProperty('#' + forVal.value, cssProperty, propertyVal).end();
|
|
79
|
-
}
|
|
80
|
-
return browser.assert.cssProperty('#' + forVal.value, cssProperty, propertyVal).end();
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
module.exports.assertion = function (negativeCase, expectedText, element) {
|
|
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
|
-
|
|
36
|
-
browser.element('css selector', element, function (result) {
|
|
37
|
-
if (result.status === 0) {
|
|
38
|
-
if (negativeCase) {
|
|
39
|
-
return browser.assert.not.textContains(element, expectedText).end();
|
|
40
|
-
}
|
|
41
|
-
return browser.assert.textContains(element, expectedText).end();
|
|
42
|
-
} else {
|
|
43
|
-
browser.element('css selector', '#' + element, function (result) {
|
|
44
|
-
if (result.status === 0) {
|
|
45
|
-
if (negativeCase) {
|
|
46
|
-
return browser.assert.not.textContains(element, expectedText).end();
|
|
47
|
-
}
|
|
48
|
-
return browser.assert.textContains(element, expectedText).end();
|
|
49
|
-
} else {
|
|
50
|
-
browser.element('css selector', 'input[name="' + element + '"]', function (result) {
|
|
51
|
-
if (result.status === 0) {
|
|
52
|
-
if (negativeCase) {
|
|
53
|
-
return browser.assert.not.textContains(element, expectedText).end();
|
|
54
|
-
}
|
|
55
|
-
return browser.assert.textContains(element, expectedText).end();
|
|
56
|
-
} else {
|
|
57
|
-
browser.element('css selector', 'input[value="' + element + '"]', function (result) {
|
|
58
|
-
if (result.status === 0) {
|
|
59
|
-
if (negativeCase) {
|
|
60
|
-
return browser.assert.not.textContains(element, expectedText).end();
|
|
61
|
-
}
|
|
62
|
-
return browser.assert.textContains(element, expectedText).end();
|
|
63
|
-
} else {
|
|
64
|
-
browser.elements('css selector', 'label', function (elements) {
|
|
65
|
-
elements.value.forEach(function (elementsObj) {
|
|
66
|
-
browser.elementIdText(elementsObj.ELEMENT, function (result) {
|
|
67
|
-
if (result.value == element) {
|
|
68
|
-
browser.getAttribute(elementsObj, "for", function (forVal) {
|
|
69
|
-
if (negativeCase) {
|
|
70
|
-
return browser.assert.not.textContains('#' + forVal.value, expectedText).end();
|
|
71
|
-
}
|
|
72
|
-
return browser.assert.textContains('#' + forVal.value, expectedText).end();
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|