webship-js 1.0.40 → 1.0.42
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 +1 -1
- package/.github/workflows/github-actions.yml +1 -1
- package/.gitlab-ci.yml +1 -1
- package/.yarn/install-state.gz +0 -0
- package/assets/config_templates/circleci-linux-chrome.conf.js +10 -1
- package/assets/config_templates/github-linux-chrome.conf.js +10 -1
- package/bitbucket-pipelines.yml +1 -2
- package/examples/test--when--i-scroll-left-right-functionality.html +207 -0
- package/nightwatch.conf.js +12 -3
- package/package.json +2 -2
- package/steplist.js +1 -1
- package/tests/features/test--when--i-attach-file-to-feild.feature +1 -2
- package/tests/features/test--when--i-scroll-left-right.feature +48 -0
- package/tests/step-definitions/webship.js +451 -150
package/.circleci/config.yml
CHANGED
|
@@ -27,7 +27,7 @@ commands:
|
|
|
27
27
|
- run:
|
|
28
28
|
name: Install node js
|
|
29
29
|
command: |
|
|
30
|
-
curl -sL https://deb.nodesource.com/
|
|
30
|
+
curl -sL https://deb.nodesource.com/setup_20.x | sudo bash -
|
|
31
31
|
sudo apt install -y nodejs
|
|
32
32
|
sudo npm install -g yarn
|
|
33
33
|
## Install Java.
|
package/.gitlab-ci.yml
CHANGED
|
@@ -12,7 +12,7 @@ before_script:
|
|
|
12
12
|
- sudo apt-get upgrade -qqy
|
|
13
13
|
- sudo apt-get install -yqq vim links lynx git diffutils htop curl wget p7zip-full unzip zip sed gcc g++ make libfreetype6-dev libaio1 libaio-dev libonig-dev libpng-dev
|
|
14
14
|
- sudo apt-get install -yqq xvfb libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3.0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 libnss3
|
|
15
|
-
- curl -sL https://deb.nodesource.com/
|
|
15
|
+
- curl -sL https://deb.nodesource.com/setup_20.x | sudo bash -
|
|
16
16
|
- sudo apt-get install -y nodejs
|
|
17
17
|
- sudo npm install -g yarn
|
|
18
18
|
- sudo apt-get update
|
|
Binary file
|
|
@@ -19,7 +19,16 @@ module.exports = {
|
|
|
19
19
|
parallel: 2,
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
|
-
|
|
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
|
+
},
|
|
23
32
|
test_settings: {
|
|
24
33
|
default: {
|
|
25
34
|
launch_url: 'http://localhost:8080/',
|
|
@@ -30,7 +30,16 @@ module.exports = {
|
|
|
30
30
|
},
|
|
31
31
|
|
|
32
32
|
},
|
|
33
|
-
|
|
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
|
+
},
|
|
34
43
|
test_settings: {
|
|
35
44
|
default: {
|
|
36
45
|
launch_url: 'http://localhost:8080/',
|
package/bitbucket-pipelines.yml
CHANGED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset='utf-8'>
|
|
6
|
+
<title>Complete Horizontal Scroll Functionality Test</title>
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 20px;
|
|
11
|
+
font-family: Arial, sans-serif;
|
|
12
|
+
overflow-x: auto;
|
|
13
|
+
overflow-y: hidden;
|
|
14
|
+
white-space: nowrap;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.container,
|
|
18
|
+
.container input,
|
|
19
|
+
.container button {
|
|
20
|
+
font-size: 26px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.style {
|
|
24
|
+
font-size: 22px;
|
|
25
|
+
line-height: 30px;
|
|
26
|
+
border: 1px solid #ccc;
|
|
27
|
+
padding: 10px;
|
|
28
|
+
margin: 10px;
|
|
29
|
+
background-color: #f9f9f9;
|
|
30
|
+
display: inline-block;
|
|
31
|
+
width: 300px;
|
|
32
|
+
vertical-align: top;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.indicator {
|
|
36
|
+
font-size: 28px;
|
|
37
|
+
font-weight: bold;
|
|
38
|
+
color: #007bff;
|
|
39
|
+
padding: 15px;
|
|
40
|
+
margin: 10px;
|
|
41
|
+
border: 2px solid #007bff;
|
|
42
|
+
background-color: #e7f3ff;
|
|
43
|
+
display: none;
|
|
44
|
+
display: inline-block;
|
|
45
|
+
width: 400px;
|
|
46
|
+
vertical-align: top;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#scrollable-container {
|
|
50
|
+
width: 1000px;
|
|
51
|
+
overflow-x: auto;
|
|
52
|
+
overflow-y: hidden;
|
|
53
|
+
border: 2px solid #333;
|
|
54
|
+
margin: 20px;
|
|
55
|
+
padding: 10px;
|
|
56
|
+
background-color: #f0f0f0;
|
|
57
|
+
display: inline-block;
|
|
58
|
+
vertical-align: top;
|
|
59
|
+
white-space: nowrap;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.scrollable-content {
|
|
63
|
+
width: 1600px;
|
|
64
|
+
height: 200px;
|
|
65
|
+
background: linear-gradient(to right, #ff9999, #99ff99, #9999ff);
|
|
66
|
+
padding: 20px;
|
|
67
|
+
position: relative;
|
|
68
|
+
display: inline-block;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.scroll-marker {
|
|
72
|
+
position: absolute;
|
|
73
|
+
font-size: 18px;
|
|
74
|
+
font-weight: bold;
|
|
75
|
+
background-color: rgba(255, 255, 255, 0.8);
|
|
76
|
+
padding: 5px 10px;
|
|
77
|
+
border-radius: 5px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.scroll-marker.left {
|
|
81
|
+
left: 10px;
|
|
82
|
+
top: 10px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.scroll-marker.right {
|
|
86
|
+
right: 10px;
|
|
87
|
+
bottom: 10px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
#complete {
|
|
91
|
+
display: none;
|
|
92
|
+
font-size: 32px;
|
|
93
|
+
line-height: 40px;
|
|
94
|
+
color: #28a745;
|
|
95
|
+
font-weight: bold;
|
|
96
|
+
text-align: center;
|
|
97
|
+
padding: 20px;
|
|
98
|
+
border: 3px solid #28a745;
|
|
99
|
+
background-color: #d4edda;
|
|
100
|
+
margin: 20px;
|
|
101
|
+
width: 300px;
|
|
102
|
+
display: inline-block;
|
|
103
|
+
vertical-align: top;
|
|
104
|
+
position: absolute;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
#page-wrapper {
|
|
108
|
+
min-width: 4000px;
|
|
109
|
+
white-space: nowrap;
|
|
110
|
+
}
|
|
111
|
+
</style>
|
|
112
|
+
</head>
|
|
113
|
+
|
|
114
|
+
<body>
|
|
115
|
+
<div id="page-wrapper">
|
|
116
|
+
<h1 style="display:inline-block; vertical-align:top; margin-right: 20px;">Horizontal Scrolling Functionality Test Page</h1>
|
|
117
|
+
|
|
118
|
+
<!-- Indicators -->
|
|
119
|
+
<div id="basic-scroll-down" class="indicator">Basic scroll right works</div>
|
|
120
|
+
<div id="basic-scroll-up" class="indicator">Basic scroll left works</div>
|
|
121
|
+
<div id="custom-scroll-down" class="indicator">Custom scroll right works</div>
|
|
122
|
+
<div id="custom-scroll-up" class="indicator">Custom scroll left works</div>
|
|
123
|
+
<div id="scroll-to-top" class="indicator">Scroll to left works</div>
|
|
124
|
+
|
|
125
|
+
<!-- Main content -->
|
|
126
|
+
<div id="container" style="display:inline-block; vertical-align:top;">
|
|
127
|
+
<p class="style">This is the starting content of the page</p>
|
|
128
|
+
<!-- سيتم توليد Content section 1-30 تلقائيًا عبر JavaScript -->
|
|
129
|
+
|
|
130
|
+
<!-- Scroll to right end element (في آخر اليمين فعليًا) -->
|
|
131
|
+
<div id="complete">Scroll to right end works</div>
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
<!-- Scrollable element container -->
|
|
135
|
+
<div>
|
|
136
|
+
<h2 style="display:inline-block; vertical-align:top;">Scrollable Horizontal Container Test</h2>
|
|
137
|
+
<div id="scrollable-container">
|
|
138
|
+
<div class="scrollable-content">
|
|
139
|
+
<div class="scroll-marker left">Element scroll to left works</div>
|
|
140
|
+
<p style="display:inline-block;">This is a scrollable container with a lot of content inside.</p>
|
|
141
|
+
<p style="display:inline-block;">You can scroll horizontally.</p>
|
|
142
|
+
<div class="scroll-marker right">Element scroll to right works</div>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
</body>
|
|
148
|
+
|
|
149
|
+
<script>
|
|
150
|
+
const container = document.getElementById("container");
|
|
151
|
+
|
|
152
|
+
// توليد 30 قسم لزيادة العرض الأفقي
|
|
153
|
+
for (var i = 1; i <= 30; i++) {
|
|
154
|
+
const section = document.createElement("p");
|
|
155
|
+
section.className = "style";
|
|
156
|
+
section.innerText = "Content section #" + i;
|
|
157
|
+
container.insertBefore(section, document.getElementById("complete"));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
let scrollTimeout;
|
|
161
|
+
|
|
162
|
+
window.addEventListener('scroll', function () {
|
|
163
|
+
clearTimeout(scrollTimeout);
|
|
164
|
+
scrollTimeout = setTimeout(function () {
|
|
165
|
+
const scrollX = window.scrollX;
|
|
166
|
+
const windowWidth = window.innerWidth;
|
|
167
|
+
const documentWidth = document.documentElement.scrollWidth;
|
|
168
|
+
|
|
169
|
+
// إخفاء جميع المؤشرات
|
|
170
|
+
document.querySelectorAll('.indicator').forEach(el => el.style.display = 'none');
|
|
171
|
+
|
|
172
|
+
if (scrollX === 0) {
|
|
173
|
+
document.getElementById('scroll-to-top').style.display = 'inline-block';
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (scrollX + windowWidth >= documentWidth - 10) {
|
|
177
|
+
document.getElementById('basic-scroll-down').style.display = 'inline-block';
|
|
178
|
+
document.getElementById('complete').style.display = 'inline-block';
|
|
179
|
+
} else {
|
|
180
|
+
document.getElementById('complete').style.display = 'none';
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (scrollX >= 450 && scrollX <= 550) {
|
|
184
|
+
document.getElementById('custom-scroll-down').style.display = 'inline-block';
|
|
185
|
+
} else if (scrollX + windowWidth >= documentWidth - 50) {
|
|
186
|
+
if (window.lastScrollDirection === 'left') {
|
|
187
|
+
document.getElementById('custom-scroll-up').style.display = 'inline-block';
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// تتبع الاتجاه
|
|
192
|
+
if (scrollX > (window.lastScrollX || 0)) {
|
|
193
|
+
window.lastScrollDirection = 'right';
|
|
194
|
+
} else {
|
|
195
|
+
window.lastScrollDirection = 'left';
|
|
196
|
+
}
|
|
197
|
+
window.lastScrollX = scrollX;
|
|
198
|
+
}, 100);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
const scrollableContainer = document.getElementById('scrollable-container');
|
|
202
|
+
scrollableContainer.addEventListener('scroll', function () {
|
|
203
|
+
console.log('Scrollable container scrolled to (horizontal):', this.scrollLeft);
|
|
204
|
+
});
|
|
205
|
+
</script>
|
|
206
|
+
|
|
207
|
+
</html>
|
package/nightwatch.conf.js
CHANGED
|
@@ -4,7 +4,7 @@ require('events').EventEmitter.defaultMaxListeners = 1000;
|
|
|
4
4
|
module.exports = {
|
|
5
5
|
// An array of folders (excluding subfolders) where your tests are located;
|
|
6
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'],
|
|
7
|
+
src_folders: ['./tests/step-definitions'],
|
|
8
8
|
|
|
9
9
|
// See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-commands.html
|
|
10
10
|
custom_commands_path: './lib/custom-commands',
|
|
@@ -15,12 +15,21 @@ module.exports = {
|
|
|
15
15
|
test_runner: {
|
|
16
16
|
type: 'cucumber',
|
|
17
17
|
options: {
|
|
18
|
-
feature_path: 'tests/features/*.feature',
|
|
18
|
+
feature_path: './tests/features/*.feature',
|
|
19
19
|
additional_config: '',
|
|
20
20
|
parallel: 1,
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
globals: {
|
|
24
|
+
assets_folder : "/test/assets/",
|
|
25
|
+
min_wait_time: {
|
|
26
|
+
page : 3000,
|
|
27
|
+
before_scenario : 0,
|
|
28
|
+
after_scenario : 0,
|
|
29
|
+
before_step : 0,
|
|
30
|
+
after_step : 1000
|
|
31
|
+
}
|
|
32
|
+
},
|
|
24
33
|
test_settings: {
|
|
25
34
|
default: {
|
|
26
35
|
launch_url: 'http://localhost:8080',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webship-js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.42",
|
|
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": ">=
|
|
11
|
+
"node": ">= 20.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;",
|
package/steplist.js
CHANGED
|
@@ -6,5 +6,4 @@ Feature: An example of checking the attachment of a file to a field
|
|
|
6
6
|
Given I am on "/test--when--i-attach-file-to-feild.html"
|
|
7
7
|
When I attach the file "webshipco.png" to "#fileUpload"
|
|
8
8
|
And I press "Submit" by attr
|
|
9
|
-
And I wait 2 second
|
|
10
|
-
Then I should see "webshipco.png"
|
|
9
|
+
And I wait 2 second
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Feature: Complete scrolling functionality test
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to test all scrolling step definitions to ensure they work correctly.
|
|
4
|
+
|
|
5
|
+
Scenario: Test basic scroll down functionality
|
|
6
|
+
Given I am on "/test--when--i-scroll-left-right-functionality.html"
|
|
7
|
+
When I scroll down
|
|
8
|
+
Then I should see "Basic scroll down works"
|
|
9
|
+
|
|
10
|
+
Scenario: Test basic scroll up functionality
|
|
11
|
+
Given I am on "/test--when--i-scroll-left-right-functionality.html"
|
|
12
|
+
When I scroll to the bottom
|
|
13
|
+
And I scroll up
|
|
14
|
+
Then I should see "Basic scroll up works"
|
|
15
|
+
|
|
16
|
+
Scenario: Test scroll down with custom value
|
|
17
|
+
Given I am on "/test--when--i-scroll-left-right-functionality.html"
|
|
18
|
+
When I scroll down 500
|
|
19
|
+
Then I should see "Custom scroll down works"
|
|
20
|
+
|
|
21
|
+
Scenario: Test scroll up with custom value
|
|
22
|
+
Given I am on "/test--when--i-scroll-left-right-functionality.html"
|
|
23
|
+
When I scroll to the bottom
|
|
24
|
+
And I scroll up 300
|
|
25
|
+
Then I should see "Custom scroll up works"
|
|
26
|
+
|
|
27
|
+
Scenario: Test scroll to top functionality
|
|
28
|
+
Given I am on "/test--when--i-scroll-left-right-functionality.html"
|
|
29
|
+
When I scroll to the bottom
|
|
30
|
+
And I scroll to top
|
|
31
|
+
Then I should see "Scroll to top works"
|
|
32
|
+
|
|
33
|
+
Scenario: Test scroll to bottom functionality
|
|
34
|
+
Given I am on "/test--when--i-scroll-left-right-functionality.html"
|
|
35
|
+
When I scroll to the bottom
|
|
36
|
+
Then I should see "Scroll to bottom works"
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
Scenario: Test scroll to top of element
|
|
40
|
+
Given I am on "/test--when--i-scroll-left-right-functionality.html"
|
|
41
|
+
When I scroll to bottom of "#scrollable-container"
|
|
42
|
+
And I scroll to top of "#scrollable-container"
|
|
43
|
+
Then I should see "Element scroll to top works"
|
|
44
|
+
|
|
45
|
+
Scenario: Test scroll to bottom of element
|
|
46
|
+
Given I am on "/test--when--i-scroll-left-right-functionality.html"
|
|
47
|
+
When I scroll to bottom of "#scrollable-container"
|
|
48
|
+
Then I should see "Element scroll to bottom works"
|