webship-js 1.0.45 → 1.0.47

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 (87) hide show
  1. package/.circleci/config.yml +2 -0
  2. package/.claude/settings.local.json +10 -0
  3. package/.eslintrc.json +0 -0
  4. package/.github/workflows/github-actions.yml +1 -0
  5. package/.gitlab-ci.yml +1 -0
  6. package/assets/config_templates/circleci-linux-chrome.conf.js +13 -1
  7. package/assets/config_templates/github-linux-chrome.conf.js +13 -1
  8. package/bitbucket-pipelines.yml +2 -4
  9. package/examples/about-us.html +0 -0
  10. package/examples/ajax-wait-examples.html +147 -0
  11. package/examples/contact-us.html +0 -0
  12. package/examples/dynamic-examples.html +499 -0
  13. package/examples/example-api.json +0 -0
  14. package/examples/existing-page.html +0 -0
  15. package/examples/index.html +1 -0
  16. package/examples/test--then--i-should--see-text-in-element.html +0 -0
  17. package/examples/test--then--i-should--see-text-matching-pattern.html +0 -0
  18. package/examples/test--then--i-should-see-text-in-table-row.html +0 -0
  19. package/examples/test--then--the-checkbox-checked.html +0 -0
  20. package/examples/test--then--the-element-should_not-contain-cssproperty.html +0 -0
  21. package/examples/test--then--the-link-should-contain.html +0 -0
  22. package/examples/test--when--i-attach-file-to-feild.html +0 -0
  23. package/examples/test--when--i-check-uncheck-checkbox.html +0 -0
  24. package/examples/test--when--i-click-link.html +0 -0
  25. package/examples/test--when--i-click-text-in-table-row.html +0 -0
  26. package/examples/test--when--i-press-button.html +0 -0
  27. package/examples/test--when--i-reload-page.html +0 -0
  28. package/examples/test--when--i-scroll-functionality.html +0 -0
  29. package/examples/test--when--i-scroll-left-right-functionality.html +0 -0
  30. package/examples/test--when--i-select-option-from-dropdownlist.html +0 -0
  31. package/examples/test--when--i-select-radio-button.html +95 -0
  32. package/examples/test--when-i-wait-max-of-time.html +0 -0
  33. package/examples/test--when-i-wait-page-until-is-loaded.html +0 -0
  34. package/examples/test--when-i-wait-specific-time.html +0 -0
  35. package/examples/test-acceptable-url-path.html +0 -0
  36. package/nightwatch.conf.js +22 -4
  37. package/package.json +4 -4
  38. package/tests/features/ajax-wait-examples.feature +24 -0
  39. package/tests/features/api-step-definitions-individual.feature +0 -0
  40. package/tests/features/complete-api-testing-examples.feature +0 -0
  41. package/tests/features/dynamic-content-examples.feature +156 -0
  42. package/tests/features/modal-advanced-example.feature +54 -0
  43. package/tests/features/modal-basic-example.feature +42 -0
  44. package/tests/features/modal-error-handling-example.feature +37 -0
  45. package/tests/features/test--given--i-am-on-homepage.feature +0 -0
  46. package/tests/features/test--then--i-should--not--see-text-in-element.feature +0 -0
  47. package/tests/features/test--then--i-should--see-text-in-element-by-attr.feature +0 -0
  48. package/tests/features/test--then--i-should--see-text-in-element.feature +0 -0
  49. package/tests/features/test--then--i-should--see-text-matching-pattern-in-element.feature +0 -0
  50. package/tests/features/test--then--i-should--see-text-matching-pattern.feature +0 -0
  51. package/tests/features/test--then--i-should-be-on-page.feature +0 -0
  52. package/tests/features/test--then--i-should-be-on-the-homepage.feature +0 -0
  53. package/tests/features/test--then--i-should-not-see-an-element-by-attr.feature +0 -0
  54. package/tests/features/test--then--i-should-not-see-an-element.feature +0 -0
  55. package/tests/features/test--then--i-should-see-an-element-by-attr.feature +0 -0
  56. package/tests/features/test--then--i-should-see-an-element.feature +0 -0
  57. package/tests/features/test--then--i-should-see-text-in-table-row.feature +0 -0
  58. package/tests/features/test--then--the-checkbox-is-checked.feature +0 -0
  59. package/tests/features/test--then--the-checkbox-should-be-checked.feature +0 -0
  60. package/tests/features/test--then--the-element-should-contain-cssproperty.feature +0 -0
  61. package/tests/features/test--then--the-element-should-not-contain-cssproperty.feature +0 -0
  62. package/tests/features/test--then--the-field-should-contain-value.feature +0 -0
  63. package/tests/features/test--then--the-response-should-contain.feature +0 -0
  64. package/tests/features/test--then--the-response-status-code-should-be.feature +0 -0
  65. package/tests/features/test--then--the-url-should-match.feature +0 -0
  66. package/tests/features/test--then-the-link-should-contain-by-attribute.feature +0 -0
  67. package/tests/features/test--then-the-link-should-contain.feature +0 -0
  68. package/tests/features/test--when--i-attach-file-to-feild.feature +0 -0
  69. package/tests/features/test--when--i-check-checkbox.feature +0 -0
  70. package/tests/features/test--when--i-click-link-by-attribute.feature +0 -0
  71. package/tests/features/test--when--i-click-link.feature +0 -0
  72. package/tests/features/test--when--i-click-text-in-table-row.feature +0 -0
  73. package/tests/features/test--when--i-fill-in-by-attr.feature +0 -0
  74. package/tests/features/test--when--i-fill-in-table-by-attr.feature +0 -0
  75. package/tests/features/test--when--i-fill-in.feature +0 -0
  76. package/tests/features/test--when--i-go-to-homepage.feature +0 -0
  77. package/tests/features/test--when--i-move-forward-backward-one-page.feature +0 -0
  78. package/tests/features/test--when--i-press-button-by-attribute.feature +0 -0
  79. package/tests/features/test--when--i-press-button.feature +0 -0
  80. package/tests/features/test--when--i-reload-page.feature +0 -0
  81. package/tests/features/test--when--i-scroll-left-right.feature +0 -0
  82. package/tests/features/test--when--i-scroll.feature +0 -0
  83. package/tests/features/test--when--i-select-option-from-dropdownlist.feature +0 -0
  84. package/tests/features/test--when--i-select-radio-button.feature +37 -0
  85. package/tests/features/test--when--i-wait-page-is-loaded.feature +0 -0
  86. package/tests/features/test--when--i-wait-time.feature +0 -0
  87. package/tests/step-definitions/webship.js +1469 -503
@@ -5,6 +5,8 @@ defaults: &defaults
5
5
  auth:
6
6
  username: mydockerhub-user
7
7
  password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
8
+ environment:
9
+ FORCE_COLOR: "1"
8
10
  commands:
9
11
  webship-js-build:
10
12
  steps:
@@ -0,0 +1,10 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(FORCE_COLOR=1 node -e \"\nconst {styleText} = require\\('node:util'\\);\nconst {Writable} = require\\('stream'\\);\nconst fakeStream = new Writable\\({write\\(c,e,cb\\){cb\\(\\)}}\\);\nfakeStream.isTTY = false;\nconst result = styleText\\('red', 'test', {stream: fakeStream}\\);\nconsole.log\\('Non-TTY WITH FORCE_COLOR=1:', JSON.stringify\\(result\\)\\);\n\")",
5
+ "Bash(node -e \"\n// Check the full styleText source to understand FORCE_COLOR handling\nconst src = require\\('node:util'\\).styleText.toString\\(\\);\nconsole.log\\(src\\);\n\")",
6
+ "Bash(node -e \"\n// Check what shouldColorize does - it's in node:util internals\n// Let's check how FORCE_COLOR interacts with shouldColorize\nconst util = require\\('node:util'\\);\n\n// The shouldColorize function checks:\n// 1. stream.isTTY\n// 2. FORCE_COLOR env var\n// 3. NO_COLOR env var\n// Let's verify by testing edge cases\n\nconst {Writable} = require\\('stream'\\);\nconst fakeStream = new Writable\\({write\\(c,e,cb\\){cb\\(\\)}}\\);\nfakeStream.isTTY = false;\n\n// Test NO_COLOR\nconst result1 = require\\('child_process'\\).execSync\\(\n 'node -e \\\\\"const {styleText}=require\\(\\\\\\\\\\\\\"node:util\\\\\\\\\\\\\"\\); const {Writable}=require\\(\\\\\\\\\\\\\"stream\\\\\\\\\\\\\"\\); const s=new Writable\\({write\\(c,e,cb\\){cb\\(\\)}}\\); s.isTTY=true; console.log\\(JSON.stringify\\(styleText\\(\\\\\\\\\\\\\"red\\\\\\\\\\\\\",\\\\\\\\\\\\\"x\\\\\\\\\\\\\",{stream:s}\\)\\)\\)\\\\\"',\n {env: {...process.env, NO_COLOR: '1'}}\n\\).toString\\(\\).trim\\(\\);\nconsole.log\\('TTY + NO_COLOR=1:', result1\\);\n\nconst result2 = require\\('child_process'\\).execSync\\(\n 'node -e \\\\\"const {styleText}=require\\(\\\\\\\\\\\\\"node:util\\\\\\\\\\\\\"\\); const {Writable}=require\\(\\\\\\\\\\\\\"stream\\\\\\\\\\\\\"\\); const s=new Writable\\({write\\(c,e,cb\\){cb\\(\\)}}\\); s.isTTY=false; console.log\\(JSON.stringify\\(styleText\\(\\\\\\\\\\\\\"red\\\\\\\\\\\\\",\\\\\\\\\\\\\"x\\\\\\\\\\\\\",{stream:s}\\)\\)\\)\\\\\"',\n {env: {...process.env, FORCE_COLOR: '1'}}\n\\).toString\\(\\).trim\\(\\);\nconsole.log\\('non-TTY + FORCE_COLOR=1:', result2\\);\n\")",
7
+ "Bash(NO_COLOR=1 node -e \"\nconst {styleText} = require\\('node:util'\\);\nconst {Writable} = require\\('stream'\\);\nconst s = new Writable\\({write\\(c,e,cb\\){cb\\(\\)}}\\);\ns.isTTY = true;\nconst result = styleText\\('red', 'x', {stream: s}\\);\nconsole.log\\('TTY + NO_COLOR=1:', JSON.stringify\\(result\\)\\);\n\")"
8
+ ]
9
+ }
10
+ }
package/.eslintrc.json CHANGED
File without changes
@@ -9,6 +9,7 @@ jobs:
9
9
  env:
10
10
  TEST_BASE_URL: http://localhost:8080
11
11
  SELENIUM_HOST: http://localhost:4444/wd/hub
12
+ FORCE_COLOR: "1"
12
13
 
13
14
  steps:
14
15
  - name: Install/Update Google Chrome browser
package/.gitlab-ci.yml CHANGED
@@ -6,6 +6,7 @@ services:
6
6
 
7
7
  variables:
8
8
  NODE_OPTIONS: "--openssl-legacy-provider"
9
+ FORCE_COLOR: "1"
9
10
 
10
11
  before_script:
11
12
  - sudo apt-get update -qq
@@ -16,7 +16,19 @@ module.exports = {
16
16
  options: {
17
17
  feature_path: 'tests/features/*.feature',
18
18
  additional_config: '',
19
- parallel: 2,
19
+ parallel: 1,
20
+ 'format-options': JSON.stringify({
21
+ colorsEnabled: true,
22
+ theme: {
23
+ 'feature keyword': ['bold', 'blue'],
24
+ 'feature name': ['blue', 'underline'],
25
+ 'feature description': ['blueBright'],
26
+ 'scenario keyword': ['bold', 'magenta'],
27
+ 'scenario name': ['magenta', 'underline'],
28
+ 'step keyword': ['bold', 'green'],
29
+ 'step text': ['greenBright', 'italic'],
30
+ },
31
+ }),
20
32
  },
21
33
  },
22
34
  globals: {
@@ -26,7 +26,19 @@ module.exports = {
26
26
  options: {
27
27
  feature_path: 'tests/features/*.feature',
28
28
  additional_config: '',
29
- parallel: 2,
29
+ parallel: 1,
30
+ 'format-options': JSON.stringify({
31
+ colorsEnabled: true,
32
+ theme: {
33
+ 'feature keyword': ['bold', 'blue'],
34
+ 'feature name': ['blue', 'underline'],
35
+ 'feature description': ['blueBright'],
36
+ 'scenario keyword': ['bold', 'magenta'],
37
+ 'scenario name': ['magenta', 'underline'],
38
+ 'step keyword': ['bold', 'green'],
39
+ 'step text': ['greenBright', 'italic'],
40
+ },
41
+ }),
30
42
  },
31
43
 
32
44
  },
@@ -9,12 +9,10 @@ pipelines:
9
9
  caches:
10
10
  - node
11
11
  script:
12
- - npm install
13
- - npm test
12
+ - npm install
13
+ - FORCE_COLOR=1 npm test
14
14
 
15
15
  definitions:
16
16
  services:
17
17
  selenium:
18
18
  image: selenium/standalone-chrome:latest
19
- ports:
20
- - 4444:4444
File without changes
@@ -0,0 +1,147 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AJAX Wait Examples - Webship Testing</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ max-width: 1200px;
11
+ margin: 0 auto;
12
+ padding: 20px;
13
+ background: #f5f5f5;
14
+ }
15
+ .example-section {
16
+ background: white;
17
+ padding: 20px;
18
+ margin: 20px 0;
19
+ border-radius: 8px;
20
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
21
+ }
22
+ button {
23
+ background: #007bff;
24
+ color: white;
25
+ border: none;
26
+ padding: 10px 20px;
27
+ border-radius: 4px;
28
+ cursor: pointer;
29
+ margin: 5px;
30
+ }
31
+ button:hover {
32
+ background: #0056b3;
33
+ }
34
+ input {
35
+ padding: 8px;
36
+ margin: 5px;
37
+ border: 1px solid #ddd;
38
+ border-radius: 4px;
39
+ width: 300px;
40
+ }
41
+ table {
42
+ width: 100%;
43
+ border-collapse: collapse;
44
+ margin: 10px 0;
45
+ }
46
+ th, td {
47
+ border: 1px solid #ddd;
48
+ padding: 10px;
49
+ text-align: left;
50
+ }
51
+ th {
52
+ background: #f8f9fa;
53
+ }
54
+ .success-message {
55
+ color: green;
56
+ padding: 10px;
57
+ margin: 10px 0;
58
+ background: #d4edda;
59
+ border-radius: 4px;
60
+ }
61
+ </style>
62
+ </head>
63
+ <body>
64
+ <h1>AJAX Wait Testing Examples</h1>
65
+ <p>This page demonstrates scenarios that require waiting for AJAX requests to complete.</p>
66
+
67
+ <!-- Example 1: AJAX Search -->
68
+ <div class="example-section">
69
+ <h2>Example 1: AJAX Search</h2>
70
+ <input type="text" id="search-input" placeholder="Enter search term">
71
+ <button onclick="performSearch()">Search</button>
72
+ <div id="search-results-container"></div>
73
+ </div>
74
+
75
+ <!-- Example 2: AJAX Form Submission -->
76
+ <div class="example-section">
77
+ <h2>Example 2: AJAX Form Submission</h2>
78
+ <input type="text" id="name-input" placeholder="Your Name"><br>
79
+ <input type="email" id="email-input" placeholder="Your Email"><br>
80
+ <button onclick="submitForm()">Submit</button>
81
+ <div id="form-results-container"></div>
82
+ </div>
83
+
84
+ <script>
85
+ // Example 1: AJAX Search with XMLHttpRequest
86
+ function performSearch() {
87
+ const query = document.getElementById('search-input').value;
88
+ document.getElementById('search-results-container').innerHTML = '<p>Loading...</p>';
89
+
90
+ // Simulate AJAX request
91
+ const xhr = new XMLHttpRequest();
92
+ xhr.open('GET', 'data:text/plain,success', true);
93
+
94
+ xhr.onload = function() {
95
+ setTimeout(() => {
96
+ document.getElementById('search-results-container').innerHTML = `
97
+ <h3>Search Results</h3>
98
+ <table>
99
+ <tr>
100
+ <th>Product</th>
101
+ <th>Actions</th>
102
+ </tr>
103
+ <tr>
104
+ <td>Laptop Pro 15</td>
105
+ <td><button onclick="viewDetails('Laptop Pro 15')">View Details</button></td>
106
+ </tr>
107
+ </table>
108
+ `;
109
+ }, 500);
110
+ };
111
+
112
+ xhr.send();
113
+ }
114
+
115
+ function viewDetails(product) {
116
+ document.getElementById('search-results-container').innerHTML = `
117
+ <h3>Product Details</h3>
118
+ <p>Showing details for ${product}</p>
119
+ `;
120
+ }
121
+
122
+ // Example 2: AJAX Form Submission with XMLHttpRequest
123
+ function submitForm() {
124
+ const name = document.getElementById('name-input').value;
125
+ const email = document.getElementById('email-input').value;
126
+ document.getElementById('form-results-container').innerHTML = '<p>Submitting...</p>';
127
+
128
+ // Simulate AJAX request
129
+ const xhr = new XMLHttpRequest();
130
+ xhr.open('POST', 'data:text/plain,success', true);
131
+
132
+ xhr.onload = function() {
133
+ setTimeout(() => {
134
+ document.getElementById('form-results-container').innerHTML = `
135
+ <div class="success-message">
136
+ <p>Form submitted successfully</p>
137
+ <p>Thank you, ${name}</p>
138
+ </div>
139
+ `;
140
+ }, 800);
141
+ };
142
+
143
+ xhr.send();
144
+ }
145
+ </script>
146
+ </body>
147
+ </html>
File without changes