webship-js 1.0.47 → 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.
Files changed (46) hide show
  1. package/.circleci/config.yml +15 -63
  2. package/.claude/settings.local.json +128 -4
  3. package/.github/workflows/github-actions.yml +7 -37
  4. package/.gitlab-ci.yml +11 -35
  5. package/.travis-ci.yml +12 -23
  6. package/.travis.yml +17 -0
  7. package/README.md +8 -8
  8. package/bitbucket-pipelines.yml +3 -7
  9. package/cucumber.js +36 -0
  10. package/examples/dynamic-examples.html +1 -2
  11. package/examples/index.html +0 -1
  12. package/examples/test--modal-dialogs.html +252 -0
  13. package/examples/test--when--i-click-text-in-table-row.html +1 -1
  14. package/examples/test--when--i-scroll-functionality.html +34 -33
  15. package/examples/test--when--i-scroll-left-right-functionality.html +115 -173
  16. package/package.json +10 -21
  17. package/playwright.config.ts +37 -0
  18. package/tests/assets/test-document.pdf +14 -0
  19. package/tests/step-definitions/webship-api.js +5 -31
  20. package/tests/step-definitions/webship.js +849 -2498
  21. package/tsconfig.json +10 -0
  22. package/.eslintignore +0 -3
  23. package/.eslintrc.json +0 -34
  24. package/assets/config_templates/circleci-linux-chrome.conf.js +0 -130
  25. package/assets/config_templates/github-linux-chrome.conf.js +0 -136
  26. package/dist/nightwatch.conf.dev.js +0 -93
  27. package/examples/main.js +0 -17
  28. package/lib/custom-assertions/checkboxChecked.js +0 -87
  29. package/lib/custom-assertions/elementContainsCss.js +0 -94
  30. package/lib/custom-assertions/elementContainsText.js +0 -86
  31. package/lib/custom-assertions/responseStatus.js +0 -31
  32. package/lib/custom-assertions/shouldVisible.js +0 -8
  33. package/lib/custom-assertions/textMatching.js +0 -44
  34. package/lib/custom-commands/checkItem.js +0 -4
  35. package/lib/custom-commands/clickLink.js +0 -23
  36. package/lib/custom-commands/fileUpload.js +0 -37
  37. package/lib/custom-commands/fillTextInput.js +0 -56
  38. package/lib/custom-commands/press.js +0 -3
  39. package/lib/custom-commands/selectOption.js +0 -11
  40. package/lib/custom-commands/uncheckItem.js +0 -4
  41. package/lib/custom-commands/wait.js +0 -12
  42. package/nightwatch.conf.js +0 -136
  43. package/src/index.js +0 -10
  44. package/steplist.js +0 -245
  45. package/webpack.config.js +0 -17
  46. package/webship-init.js +0 -75
package/steplist.js DELETED
@@ -1,245 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- const fs = require('fs');
5
- var insidProject = false;
6
- var basePath = '';
7
- var projectPath = '';
8
-
9
- const currentPath = process.argv[1].split("node_modules");
10
- basePath = currentPath[0].substring(0, currentPath[0].lastIndexOf("/"));
11
- basePath = basePath + '/';
12
- projectPath = basePath + "node_modules/webship-js/";
13
-
14
- if(currentPath.length > 1){
15
- insidProject = true;
16
- }
17
- else{
18
- insidProject = false;
19
- }
20
-
21
- /**
22
- * -----------------------------------------------------
23
- * Parse arguments
24
- * -----------------------------------------------------
25
- */
26
- const { ArgumentParser } = require('argparse');
27
- const { version } = require('./package.json');
28
-
29
- const parser = new ArgumentParser({
30
- description: 'Argparse example'
31
- });
32
-
33
- parser.add_argument('-v', '--version', { action: 'version', version });
34
- parser.add_argument('-l', '--list',
35
- {
36
- help: 'Display step definitions list without information.',
37
- action: 'store_true',
38
- default: true,
39
- });
40
-
41
- parser.add_argument('-i', '--info',
42
- {
43
- help: 'Display step definitions list with information.',
44
- action: 'store_true',
45
- });
46
-
47
- parser.add_argument('-c', '--config',
48
- {
49
- help: 'Add your nightwatch config file, Example: -c="nightwatch.conf.js" OR -c=nightwatch.conf.js OR -c nightwatch.conf.js',
50
- default: 'nightwatch.conf.js',
51
- });
52
-
53
- parser.add_argument('-s', '--src_folders',
54
- {
55
- help: 'Add your step definitions folder/s path, Example: -s="path/to/folder1" OR -s="path/to/folder1 path/to/folder2", You can add as much as you want of folder paths',
56
- default: "",
57
- });
58
-
59
- parser.add_argument('-f', '--format',
60
- {
61
- help: 'Choose step definitions list format style. \n(1) stdout-spaces. \n(2) stdout-dashes \n(3) html-spaces. \n(4) html-dashes. Example: -f=stdout-dashes OR -f stdout-dashes',
62
- default: "stdout-spaces",
63
- });
64
-
65
- var argsParse = parser.parse_args();
66
- if(currentPath.length > 1){
67
- argsParse.format = 'html-spaces';
68
- }
69
-
70
- /**
71
- * -----------------------------------------------------
72
- */
73
-
74
- /**
75
- * Folders Path Array variable
76
- *
77
- * Set and Get folders path exist in (--config) tag and
78
- * (--src_folder) tag added in nodejs command line.
79
- */
80
- let foldersPath = [];
81
- function setFoldersPath(value, type) {
82
- value.forEach((element) => {
83
- var elementPath = '';
84
- if(insidProject == true && !process.argv.find(element => element == type)){
85
- elementPath = projectPath + element;
86
- }
87
- else if(insidProject == false && !process.argv.find(element => element == type)){
88
- elementPath = basePath + element;
89
- }
90
- else{
91
- elementPath = element;
92
- }
93
-
94
- foldersPath.push(elementPath);
95
- });
96
- }
97
-
98
- /**
99
- * Start with Function.
100
- *
101
- * Return list of array items that start with
102
- * (Given, Then, When, /** ,* , *\).
103
- *
104
- * @param {array} stepsList The full step-definitions file lines list.
105
- * @return {array} The array has only lines startsWith words chosen.
106
- */
107
- function startWith(stepsList) {
108
- if (argsParse.info == true) {
109
- return (stepsList.startsWith('Given') ||
110
- stepsList.startsWith('Then') ||
111
- stepsList.startsWith('When') ||
112
- stepsList.startsWith('/**') ||
113
- stepsList.startsWith('* ') ||
114
- stepsList.startsWith('*/'));
115
- }
116
- else if (argsParse.list == true) {
117
- return (stepsList.startsWith('Given') ||
118
- stepsList.startsWith('Then') ||
119
- stepsList.startsWith('When'));
120
- }
121
- }
122
-
123
- /**
124
- * Filter Step Definitions
125
- *
126
- * @param {array} stepsList The step definitions array is sent to filter
127
- * by startsWith words chosen.
128
- * @return {array} Step definitions filtered array.
129
- */
130
- function callStartsWith(stepsList) {
131
- return stepsList.filter(startWith);
132
- }
133
-
134
- /**
135
- * Clean Steps List
136
- *
137
- * Return list of array items was clean from unreadable chars.
138
- *
139
- * @param {array} stepsList The step definitions array before
140
- * clean unreadable signs.
141
- * @return {array} The step definitions cleaned array.
142
- */
143
- function stepsCleanList(stepsList) {
144
- let stepComment = '';
145
- const newStepsList = [];
146
-
147
- stepsList.forEach((element) => {
148
- if (element.startsWith('* ')) {
149
- element = element.replace('* ', '');
150
-
151
- if (stepComment === '') stepComment = element;
152
- else stepComment = `${stepComment}\r\n${element}`;
153
- } else if (!element.startsWith('/**') && !element.startsWith('*/')) {
154
- const filter1 = element.split('$/');
155
- const filter2 = filter1[0].replace('(/^', ' ');
156
-
157
- if (stepComment !== '') {
158
- if (argsParse.format.startsWith('html')){
159
- stepComment = `<div class="info">${stepComment}</div>\r\n`;
160
- newStepsList.push(`${filter2}\r\n${stepComment}`);
161
- }
162
- else newStepsList.push(`${filter2}\r\n${stepComment}`);
163
- } else newStepsList.push(filter2);
164
-
165
- stepComment = '';
166
- }
167
- });
168
- return newStepsList;
169
- }
170
-
171
- function srcFolderPaths(path) {
172
- const paths = path.split(' ');
173
-
174
- setFoldersPath(paths, '-s');
175
- }
176
-
177
- /**
178
- * "foldersPath" array
179
- *
180
- * Fill "foldersPath" array process, that has paths of
181
- * all folders contain step definitions js files.
182
- */
183
-
184
- if(insidProject == true && !process.argv.find(element => element == "-c")){
185
- argsParse.config = projectPath + argsParse.config;
186
- }
187
- else if(insidProject == false && !process.argv.find(element => element == "-c")){
188
- argsParse.config = basePath + argsParse.config;
189
- }
190
-
191
- const configPath = require(argsParse.config);
192
-
193
- let configPathsArray = [];
194
-
195
- configPathsArray = configPath.src_folders;
196
- setFoldersPath(configPathsArray, '-c');
197
-
198
- if (foldersPath.length === 0) {
199
- configPathsArray = argsParse.src_folders;
200
- setFoldersPath(configPathsArray, '-c');
201
- }
202
-
203
- if(process.argv.find(element => element == '-s')){
204
- srcFolderPaths(argsParse.src_folders);
205
- }
206
-
207
- /**
208
- * Step definitions list
209
- *
210
- * Get clear step definitions list from js
211
- * step definitions files.
212
- */
213
- foldersPath.forEach((folderPath) => {
214
- fs.readdir(folderPath, (err, files) => {
215
- if (err) {
216
- return console.log(`Unable to scan directory: ${err}`);
217
- }
218
-
219
- files.forEach((file) => {
220
- fs.readFile(`${folderPath}/${file}`, 'utf8', (err, data) => {
221
- if (err) {
222
- throw new Error(err);
223
- }
224
- const contentLines = data.split('\n');
225
- const contentTrimmed = contentLines.map((element) => element.trim());
226
-
227
- const stepsStartWith = callStartsWith(contentTrimmed);
228
- const stepsList = stepsCleanList(stepsStartWith);
229
-
230
- stepsList.forEach((element) => {
231
- if (argsParse.format == 'stdout-spaces') {
232
- console.log(element + '\n');
233
- } else if (argsParse.format == 'stdout-dashes') {
234
- console.log(element + '\n');
235
- } else if (argsParse.format == 'html-spaces') {
236
- console.log('<div>' + element + '</div><br/>');
237
- } else if (argsParse.format == 'html-dashes') {
238
- console.log('<div>' + element + '</div><br/>');
239
- }
240
-
241
- });
242
- });
243
- });
244
- });
245
- });
package/webpack.config.js DELETED
@@ -1,17 +0,0 @@
1
- const path = require('path');
2
-
3
- module.exports = {
4
- entry: './src/index.js',
5
- mode: 'development',
6
- output: {
7
- filename: 'main.js',
8
- path: path.resolve(__dirname, 'examples'),
9
- },
10
- devServer: {
11
- static: {
12
- directory: path.join(__dirname, 'examples'),
13
- },
14
- compress: true,
15
- port: 8080,
16
- },
17
- };
package/webship-init.js DELETED
@@ -1,75 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- const fs = require('fs');
5
- var insidProject = false;
6
- var basePath = '';
7
- var projectPath = '';
8
-
9
- const currentPath = process.argv[1].split("node_modules");
10
- basePath = currentPath[0].substring(0, currentPath[0].lastIndexOf("/")) + '/';
11
-
12
- if (currentPath.length > 1) {
13
- projectPath = basePath + "node_modules/webship-js/";
14
- }
15
- else {
16
- projectPath = basePath;
17
-
18
- }
19
-
20
- /**
21
- * -----------------------------------------------------
22
- * Parse arguments
23
- * -----------------------------------------------------
24
- */
25
- const { ArgumentParser } = require('argparse');
26
- const { version } = require('./package.json');
27
-
28
- const parser = new ArgumentParser({
29
- description: 'Argparse example'
30
- });
31
-
32
- parser.add_argument('-ci', '--continuous_integration',
33
- {
34
- help: 'Add your CI services (circleci, github, gitlab, bitbucket), By default: -ci circleci',
35
- default: 'circleci',
36
- });
37
-
38
- parser.add_argument('-b', '--browser',
39
- {
40
- help: 'Add your Browser (chrome, firefox), By default: -b chrome',
41
- default: 'chrome',
42
- });
43
-
44
- parser.add_argument('-os', '--operating_system',
45
- {
46
- help: 'Add your Operating System (linux, mac, windows), By default: -os linux',
47
- default: 'linux',
48
- });
49
-
50
- var argsParse = parser.parse_args();
51
-
52
- /**
53
- * -----------------------------------------------------
54
- */
55
-
56
- /**
57
- * Generate the appropriate nightwatch.conf.js
58
- *
59
- * Generate nightwatch testing configs according to the used CI
60
- * service, operating system, and browser.
61
- */
62
-
63
- fs.unlink(projectPath + 'nightwatch.conf.js', (err) => {
64
- if (err) {
65
- throw err;
66
- }
67
- });
68
-
69
- const confTemplate = projectPath + 'assets/config_templates/' + argsParse.continuous_integration + '-' + argsParse.operating_system + '-' + argsParse.browser + '.conf.js';
70
-
71
- fs.copyFile(confTemplate, projectPath + 'nightwatch.conf.js', (err) => {
72
- if (err) {
73
- throw err;
74
- }
75
- });