webship-js 1.0.47 → 2.0.0-beta1
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 +15 -63
- package/.github/workflows/github-actions.yml +7 -37
- package/.gitlab-ci.yml +11 -35
- package/.travis-ci.yml +12 -23
- package/.travis.yml +17 -0
- package/README.md +8 -8
- package/bitbucket-pipelines.yml +3 -7
- 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/.claude/settings.local.json +0 -10
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -34
- package/assets/config_templates/circleci-linux-chrome.conf.js +0 -130
- package/assets/config_templates/github-linux-chrome.conf.js +0 -136
- 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 -136
- package/src/index.js +0 -10
- package/steplist.js +0 -245
- package/webpack.config.js +0 -17
- package/webship-init.js +0 -75
|
@@ -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
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const axios = require('axios');
|
|
2
|
-
|
|
3
|
-
module.exports.assertion = function (negativeCase, expectedStatusCode) {
|
|
4
|
-
|
|
5
|
-
browser.url(function (currentURL) {
|
|
6
|
-
request(currentURL.value, (error, response, body) => {
|
|
7
|
-
if (negativeCase) {
|
|
8
|
-
return axios.get(currentURL.value)
|
|
9
|
-
.then(function (response) {
|
|
10
|
-
browser.assert.equal(response.status, expectedStatusCode);
|
|
11
|
-
})
|
|
12
|
-
.catch(function (error) {
|
|
13
|
-
browser.assert.equal(error.status, expectedStatusCode);
|
|
14
|
-
})
|
|
15
|
-
.finally(function () {
|
|
16
|
-
// always executed
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
return axios.get(currentURL.value)
|
|
20
|
-
.then(function (response) {
|
|
21
|
-
browser.assert.equal(response.status, expectedStatusCode);
|
|
22
|
-
})
|
|
23
|
-
.catch(function (error) {
|
|
24
|
-
browser.assert.equal(error.status, expectedStatusCode);
|
|
25
|
-
})
|
|
26
|
-
.finally(function () {
|
|
27
|
-
// always executed
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
module.exports.assertion = function (negativeCase, textPattern, 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.elements('css selector', element, function (elements) {
|
|
37
|
-
elements.value.forEach(function (elementsObj) {
|
|
38
|
-
if (negativeCase) {
|
|
39
|
-
return browser.assert.not.textMatches(elementsObj, textPattern).end();
|
|
40
|
-
}
|
|
41
|
-
return browser.assert.textMatches(elementsObj, textPattern).end();
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
module.exports.command = function (item) {
|
|
3
|
-
|
|
4
|
-
browser.element('css selector', item, function (result) {
|
|
5
|
-
if (result.status === 0) {
|
|
6
|
-
return browser.click(item);
|
|
7
|
-
} else {
|
|
8
|
-
browser.element('css selector', '#' + item, function (result) {
|
|
9
|
-
if (result.status === 0) {
|
|
10
|
-
return browser.click('#' + item);
|
|
11
|
-
} else {
|
|
12
|
-
browser.element('css selector', '.' + item, function (result) {
|
|
13
|
-
if (result.status === 0) {
|
|
14
|
-
return browser.click('.' + item);
|
|
15
|
-
} else {
|
|
16
|
-
return browser.click("link text", item);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
module.exports.command = function (fileUrl, element) {
|
|
2
|
-
browser.element('css selector', element, function (result) {
|
|
3
|
-
if (result.status === 0) {
|
|
4
|
-
browser.setValue(element, require('path').resolve(__dirname + fileUrl));
|
|
5
|
-
} else {
|
|
6
|
-
browser.element('css selector', '#' + element, function (result) {
|
|
7
|
-
if (result.status === 0) {
|
|
8
|
-
browser.setValue('#' + element, require('path').resolve(__dirname + fileUrl))
|
|
9
|
-
} else {
|
|
10
|
-
browser.element('css selector', '.' + element, function (result) {
|
|
11
|
-
if (result.status === 0) {
|
|
12
|
-
browser.setValue('.' + element, require('path').resolve(__dirname + fileUrl))
|
|
13
|
-
} else {
|
|
14
|
-
browser.element('css selector', 'input[name="' + element + '"]', function (result) {
|
|
15
|
-
if (result.status === 0) {
|
|
16
|
-
browser.setValue('input[name="' + element + '"]', require('path').resolve(__dirname + fileUrl))
|
|
17
|
-
} else {
|
|
18
|
-
browser.elements('css selector', 'label', function (elements) {
|
|
19
|
-
elements.value.forEach(function (elementsObj) {
|
|
20
|
-
browser.elementIdText(elementsObj.ELEMENT, function (result) {
|
|
21
|
-
if (result.value == element) {
|
|
22
|
-
browser.getAttribute(elementsObj, "for", function (forVal) {
|
|
23
|
-
browser.setValue(forVal.value, require('path').resolve(__dirname + fileUrl))
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
module.exports.command = function (field, value) {
|
|
2
|
-
let element = null;
|
|
3
|
-
let selector = field;
|
|
4
|
-
|
|
5
|
-
browser.element('css selector', selector, function (result) {
|
|
6
|
-
if (result.status == 0) {
|
|
7
|
-
return browser.setValue(selector, value);
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
selector = '#' + field;
|
|
11
|
-
browser.element('css selector', selector, function (result) {
|
|
12
|
-
if (result.status == 0) {
|
|
13
|
-
return browser.setValue(selector, value);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
selector = '.' + field;
|
|
17
|
-
browser.element('css selector', selector, function (result) {
|
|
18
|
-
if (result.status == 0) {
|
|
19
|
-
return browser.setValue(selector, value);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
selector = 'input[name=' + field + ']';
|
|
23
|
-
browser.element('css selector', selector, function (result) {
|
|
24
|
-
if (result.status == 0) {
|
|
25
|
-
return browser.setValue(selector, value);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
selector = "input[placeholder='" + field + "']";
|
|
29
|
-
browser.element('css selector', selector, function (result) {
|
|
30
|
-
if (result.status == 0) {
|
|
31
|
-
return browser.setValue(selector, value);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
browser.elements('css selector', 'label', function (elements) {
|
|
35
|
-
for (let i = 0; i < elements.value.length; i++) {
|
|
36
|
-
this.elementIdText(elements.value[i].ELEMENT, function (result) {
|
|
37
|
-
if (result.value === field) {
|
|
38
|
-
element = elements.value[i].ELEMENT;
|
|
39
|
-
browser.elementIdAttribute(element, 'for', function (eleAttribute) {
|
|
40
|
-
return browser.setValue('#' + eleAttribute.value, value);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
module.exports.command = function (option, dropdownlist) {
|
|
2
|
-
|
|
3
|
-
browser.findElement('css selector', 'select[name=' + dropdownlist + ']', function (result) {
|
|
4
|
-
if (result.status === 0) {
|
|
5
|
-
browser.waitForElementVisible('css selector', 'select[name="' + dropdownlist + '"]')
|
|
6
|
-
.click('select[name="' + dropdownlist + '"]')
|
|
7
|
-
.click(browser.element.findByText(option))
|
|
8
|
-
.click('select[name="' + dropdownlist + '"]');
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
module.exports.command = function (maxof, number, timeType) {
|
|
2
|
-
|
|
3
|
-
var waitTime = number * 1000;
|
|
4
|
-
if(timeType == "m"){
|
|
5
|
-
waitTime = waitTime * 60;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
if (maxof) {
|
|
9
|
-
return browser.waitForElementPresent('body', waitTime);
|
|
10
|
-
}
|
|
11
|
-
return browser.pause(waitTime);
|
|
12
|
-
}
|
package/nightwatch.conf.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
const Services = {}; loadServices();
|
|
2
|
-
require('events').EventEmitter.defaultMaxListeners = 1000;
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
// An array of folders (excluding subfolders) where your tests are located;
|
|
6
|
-
// if this is not specified, the test source must be passed as the second argument to the test runner.
|
|
7
|
-
src_folders: ['./tests/step-definitions'],
|
|
8
|
-
|
|
9
|
-
// See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-commands.html
|
|
10
|
-
custom_commands_path: './lib/custom-commands',
|
|
11
|
-
|
|
12
|
-
// See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-assertions.html
|
|
13
|
-
custom_assertions_path: './lib/custom-assertions',
|
|
14
|
-
|
|
15
|
-
test_runner: {
|
|
16
|
-
type: 'cucumber',
|
|
17
|
-
options: {
|
|
18
|
-
feature_path: './tests/features/*.feature',
|
|
19
|
-
additional_config: '',
|
|
20
|
-
parallel: 1,
|
|
21
|
-
'format-options': JSON.stringify({
|
|
22
|
-
colorsEnabled: true,
|
|
23
|
-
theme: {
|
|
24
|
-
'feature keyword': ['bold', 'blue'],
|
|
25
|
-
'feature name': ['blue', 'underline'],
|
|
26
|
-
'feature description': ['blueBright'],
|
|
27
|
-
'scenario keyword': ['bold', 'magenta'],
|
|
28
|
-
'scenario name': ['magenta', 'underline'],
|
|
29
|
-
'step keyword': ['bold', 'green'],
|
|
30
|
-
'step text': ['greenBright', 'italic'],
|
|
31
|
-
},
|
|
32
|
-
}),
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
globals: {
|
|
36
|
-
assets_folder : "/test/assets/",
|
|
37
|
-
min_wait_time: {
|
|
38
|
-
page : 3000,
|
|
39
|
-
before_scenario : 0,
|
|
40
|
-
after_scenario : 0,
|
|
41
|
-
before_step : 0,
|
|
42
|
-
after_step : 1000
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
test_settings: {
|
|
46
|
-
default: {
|
|
47
|
-
launch_url: 'http://localhost:8080',
|
|
48
|
-
selenium: {
|
|
49
|
-
start_process: false,
|
|
50
|
-
host: 'localhost',
|
|
51
|
-
port: 4444,
|
|
52
|
-
},
|
|
53
|
-
webdriver: {
|
|
54
|
-
start_process: false,
|
|
55
|
-
},
|
|
56
|
-
silent: true,
|
|
57
|
-
output: false,
|
|
58
|
-
screenshots: {
|
|
59
|
-
enabled: true,
|
|
60
|
-
path: './reports/screenshots',
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
desiredCapabilities: {
|
|
64
|
-
browserName: 'chrome',
|
|
65
|
-
'goog:chromeOptions': {
|
|
66
|
-
// More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/
|
|
67
|
-
//
|
|
68
|
-
// w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
|
|
69
|
-
w3c: true,
|
|
70
|
-
args: [
|
|
71
|
-
'--headless',
|
|
72
|
-
'--start-maximized',
|
|
73
|
-
'--disable-gpu',
|
|
74
|
-
'--window-size=1600,1200',
|
|
75
|
-
'--no-sandbox',
|
|
76
|
-
'--disable-dev-shm-usage',
|
|
77
|
-
'--disable-setuid-sandbox',
|
|
78
|
-
'--disable-web-security',
|
|
79
|
-
'--DNS-prefetch-disable',
|
|
80
|
-
'--disable-translate',
|
|
81
|
-
'--ignore-certificate-errors',
|
|
82
|
-
'--test-type',
|
|
83
|
-
'--disable-extensions',
|
|
84
|
-
'--incognito',
|
|
85
|
-
'--disable-infobars',
|
|
86
|
-
'--remote-debugging-port=9222',
|
|
87
|
-
'--allowed-ips=*',
|
|
88
|
-
'--whitelisted-ips=*',
|
|
89
|
-
'--allow-insecure-localhost',
|
|
90
|
-
],
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
selenium_server: {
|
|
97
|
-
// Selenium Server is running locally and is managed by Nightwatch
|
|
98
|
-
selenium: {
|
|
99
|
-
start_process: true,
|
|
100
|
-
port: 4444,
|
|
101
|
-
server_path: (Services.seleniumServer ? Services.seleniumServer.path : ''),
|
|
102
|
-
cli_args: {
|
|
103
|
-
'webdriver.gecko.driver': (Services.geckodriver ? Services.geckodriver.path : ''),
|
|
104
|
-
'webdriver.chrome.driver': (Services.chromedriver ? Services.chromedriver.path : ''),
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
webdriver: {
|
|
109
|
-
start_process: false
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
'selenium.chrome': {
|
|
114
|
-
extends: 'selenium_server',
|
|
115
|
-
desiredCapabilities: {
|
|
116
|
-
browserName: 'chrome',
|
|
117
|
-
chromeOptions: {
|
|
118
|
-
w3c: false,
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
function loadServices() {
|
|
125
|
-
try {
|
|
126
|
-
Services.seleniumServer = require('selenium-server');
|
|
127
|
-
} catch (err) { }
|
|
128
|
-
|
|
129
|
-
try {
|
|
130
|
-
Services.chromedriver = require('chromedriver');
|
|
131
|
-
} catch (err) { }
|
|
132
|
-
|
|
133
|
-
try {
|
|
134
|
-
Services.geckodriver = require('geckodriver');
|
|
135
|
-
} catch (err) { }
|
|
136
|
-
}
|
package/src/index.js
DELETED