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
|
@@ -1,207 +1,149 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html>
|
|
3
|
-
|
|
4
3
|
<head>
|
|
5
4
|
<meta charset='utf-8'>
|
|
6
|
-
<title>
|
|
5
|
+
<title>Scrolling Functionality Test</title>
|
|
7
6
|
<style>
|
|
8
7
|
body {
|
|
9
8
|
margin: 0;
|
|
10
9
|
padding: 20px;
|
|
11
10
|
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
11
|
}
|
|
34
|
-
|
|
35
12
|
.indicator {
|
|
36
|
-
|
|
13
|
+
display: none;
|
|
14
|
+
font-size: 22px;
|
|
37
15
|
font-weight: bold;
|
|
38
16
|
color: #007bff;
|
|
39
|
-
padding:
|
|
40
|
-
margin: 10px;
|
|
17
|
+
padding: 12px 20px;
|
|
18
|
+
margin: 10px 0;
|
|
41
19
|
border: 2px solid #007bff;
|
|
42
20
|
background-color: #e7f3ff;
|
|
43
|
-
|
|
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;
|
|
21
|
+
border-radius: 4px;
|
|
60
22
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
23
|
+
.content-block {
|
|
24
|
+
height: 300px;
|
|
25
|
+
background: #f0f4f8;
|
|
26
|
+
border: 1px solid #ccc;
|
|
27
|
+
margin: 10px 0;
|
|
66
28
|
padding: 20px;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
.scroll-marker {
|
|
72
|
-
position: absolute;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
73
32
|
font-size: 18px;
|
|
74
|
-
|
|
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;
|
|
33
|
+
color: #555;
|
|
83
34
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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;
|
|
35
|
+
#scrollable-container {
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: 150px;
|
|
38
|
+
overflow-y: scroll;
|
|
39
|
+
border: 2px solid #333;
|
|
40
|
+
margin: 20px 0;
|
|
41
|
+
padding: 10px;
|
|
42
|
+
background-color: #f9f9f9;
|
|
43
|
+
box-sizing: border-box;
|
|
105
44
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
45
|
+
.scrollable-inner {
|
|
46
|
+
height: 500px;
|
|
47
|
+
background: linear-gradient(to bottom, #ff9999, #99ff99, #9999ff);
|
|
48
|
+
padding: 10px;
|
|
110
49
|
}
|
|
50
|
+
#element-scroll-top { display: none; font-size: 18px; font-weight: bold; padding: 8px; }
|
|
51
|
+
#element-scroll-bottom { display: none; font-size: 18px; font-weight: bold; padding: 8px; }
|
|
111
52
|
</style>
|
|
112
53
|
</head>
|
|
113
|
-
|
|
114
54
|
<body>
|
|
115
|
-
<
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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>
|
|
55
|
+
<h1>Scrolling Functionality Test Page</h1>
|
|
56
|
+
|
|
57
|
+
<div id="basic-scroll-down" class="indicator">Basic scroll down works</div>
|
|
58
|
+
<div id="basic-scroll-up" class="indicator">Basic scroll up works</div>
|
|
59
|
+
<div id="custom-scroll-down" class="indicator">Custom scroll down works</div>
|
|
60
|
+
<div id="custom-scroll-up" class="indicator">Custom scroll up works</div>
|
|
61
|
+
<div id="scroll-to-top" class="indicator">Scroll to top works</div>
|
|
62
|
+
<div id="scroll-to-bottom" class="indicator">Scroll to bottom works</div>
|
|
63
|
+
|
|
64
|
+
<div class="content-block">Section 1 - Scroll down to see more</div>
|
|
65
|
+
<div class="content-block">Section 2</div>
|
|
66
|
+
<div class="content-block">Section 3</div>
|
|
67
|
+
<div class="content-block">Section 4</div>
|
|
68
|
+
<div class="content-block">Section 5</div>
|
|
69
|
+
<div class="content-block">Section 6</div>
|
|
70
|
+
<div class="content-block">Section 7</div>
|
|
71
|
+
<div class="content-block">Section 8</div>
|
|
72
|
+
<div class="content-block">Section 9</div>
|
|
73
|
+
<div class="content-block">Section 10 - Near the bottom</div>
|
|
74
|
+
|
|
75
|
+
<h2>Scrollable Element Container</h2>
|
|
76
|
+
<div id="scrollable-container">
|
|
77
|
+
<div class="scrollable-inner">
|
|
78
|
+
<div id="element-scroll-top">Element scroll to top works</div>
|
|
79
|
+
<p>Scrollable content - scroll this container to see indicators</p>
|
|
80
|
+
<div id="element-scroll-bottom">Element scroll to bottom works</div>
|
|
145
81
|
</div>
|
|
146
82
|
</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
83
|
|
|
172
|
-
|
|
173
|
-
|
|
84
|
+
<div class="content-block">End of page content</div>
|
|
85
|
+
|
|
86
|
+
<script>
|
|
87
|
+
var lastScrollY = 0;
|
|
88
|
+
var wasAtBottom = false;
|
|
89
|
+
var everScrolledDown = false;
|
|
90
|
+
|
|
91
|
+
window.addEventListener('scroll', function () {
|
|
92
|
+
var scrollY = window.scrollY;
|
|
93
|
+
var docHeight = document.documentElement.scrollHeight;
|
|
94
|
+
var winHeight = window.innerHeight;
|
|
95
|
+
var maxScroll = docHeight - winHeight;
|
|
96
|
+
var atBottom = scrollY >= maxScroll - 10;
|
|
97
|
+
var atTop = scrollY <= 0;
|
|
98
|
+
var goingDown = scrollY > lastScrollY;
|
|
99
|
+
|
|
100
|
+
document.getElementById('basic-scroll-down').style.display = 'none';
|
|
101
|
+
document.getElementById('basic-scroll-up').style.display = 'none';
|
|
102
|
+
document.getElementById('custom-scroll-down').style.display = 'none';
|
|
103
|
+
document.getElementById('custom-scroll-up').style.display = 'none';
|
|
104
|
+
document.getElementById('scroll-to-top').style.display = 'none';
|
|
105
|
+
document.getElementById('scroll-to-bottom').style.display = 'none';
|
|
106
|
+
|
|
107
|
+
if (atTop && everScrolledDown) {
|
|
108
|
+
document.getElementById('scroll-to-top').style.display = 'block';
|
|
109
|
+
} else if (atBottom) {
|
|
110
|
+
document.getElementById('scroll-to-bottom').style.display = 'block';
|
|
111
|
+
wasAtBottom = true;
|
|
112
|
+
everScrolledDown = true;
|
|
113
|
+
} else if (wasAtBottom && !goingDown) {
|
|
114
|
+
var distFromBottom = maxScroll - scrollY;
|
|
115
|
+
if (distFromBottom >= 340) {
|
|
116
|
+
document.getElementById('basic-scroll-up').style.display = 'block';
|
|
117
|
+
} else {
|
|
118
|
+
document.getElementById('custom-scroll-up').style.display = 'block';
|
|
119
|
+
}
|
|
120
|
+
} else if (scrollY >= 450) {
|
|
121
|
+
document.getElementById('custom-scroll-down').style.display = 'block';
|
|
122
|
+
} else if (scrollY > 0) {
|
|
123
|
+
document.getElementById('basic-scroll-down').style.display = 'block';
|
|
124
|
+
everScrolledDown = true;
|
|
174
125
|
}
|
|
175
126
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
document.getElementById('complete').style.display = 'inline-block';
|
|
179
|
-
} else {
|
|
180
|
-
document.getElementById('complete').style.display = 'none';
|
|
181
|
-
}
|
|
127
|
+
lastScrollY = scrollY;
|
|
128
|
+
});
|
|
182
129
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
} else if (scrollX + windowWidth >= documentWidth - 50) {
|
|
186
|
-
if (window.lastScrollDirection === 'left') {
|
|
187
|
-
document.getElementById('custom-scroll-up').style.display = 'inline-block';
|
|
188
|
-
}
|
|
189
|
-
}
|
|
130
|
+
var scrollContainer = document.getElementById('scrollable-container');
|
|
131
|
+
var containerWasAtBottom = false;
|
|
190
132
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
} else {
|
|
195
|
-
window.lastScrollDirection = 'left';
|
|
196
|
-
}
|
|
197
|
-
window.lastScrollX = scrollX;
|
|
198
|
-
}, 100);
|
|
199
|
-
});
|
|
133
|
+
scrollContainer.addEventListener('scroll', function () {
|
|
134
|
+
var scrollTop = this.scrollTop;
|
|
135
|
+
var maxScrollTop = this.scrollHeight - this.clientHeight;
|
|
200
136
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
console.log('Scrollable container scrolled to (horizontal):', this.scrollLeft);
|
|
204
|
-
});
|
|
205
|
-
</script>
|
|
137
|
+
document.getElementById('element-scroll-top').style.display = 'none';
|
|
138
|
+
document.getElementById('element-scroll-bottom').style.display = 'none';
|
|
206
139
|
|
|
140
|
+
if (scrollTop >= maxScrollTop - 5) {
|
|
141
|
+
document.getElementById('element-scroll-bottom').style.display = 'block';
|
|
142
|
+
containerWasAtBottom = true;
|
|
143
|
+
} else if (scrollTop <= 0 && containerWasAtBottom) {
|
|
144
|
+
document.getElementById('element-scroll-top').style.display = 'block';
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
</script>
|
|
148
|
+
</body>
|
|
207
149
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webship-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha1",
|
|
4
4
|
"description": "Webship JS automated functional testing.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"directories": {
|
|
@@ -10,11 +10,10 @@
|
|
|
10
10
|
"node": ">= 20.0"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
|
-
"test": "
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"start": "
|
|
17
|
-
"devServer": "webpack serve --port 8080"
|
|
13
|
+
"test": "cucumber-js --config cucumber.js; node generate-reports.js;",
|
|
14
|
+
"test:firefox": "BROWSER=firefox cucumber-js --config cucumber.js; node generate-reports.js;",
|
|
15
|
+
"test:webkit": "BROWSER=webkit cucumber-js --config cucumber.js; node generate-reports.js;",
|
|
16
|
+
"start": "http-server examples -p 8080 -s"
|
|
18
17
|
},
|
|
19
18
|
"repository": {
|
|
20
19
|
"type": "git",
|
|
@@ -29,22 +28,12 @@
|
|
|
29
28
|
"dependencies": {
|
|
30
29
|
"@cucumber/cucumber": "*",
|
|
31
30
|
"@cucumber/pretty-formatter": "~1",
|
|
32
|
-
"argparse": "~2",
|
|
33
|
-
"args-parser": "~1",
|
|
34
31
|
"axios": "~1",
|
|
35
|
-
"chromedriver": "*",
|
|
36
32
|
"cucumber-html-reporter": "^6.0.0",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"nightwatch": "^3.12.2",
|
|
43
|
-
"webpack": "~5",
|
|
44
|
-
"webpack-cli": "~5",
|
|
45
|
-
"webpack-dev-server": "^5.2.2"
|
|
46
|
-
},
|
|
47
|
-
"bin": {
|
|
48
|
-
"steplist": "./steplist.js"
|
|
33
|
+
"http-server": "^14.1.1",
|
|
34
|
+
"playwright": "^1.58.2",
|
|
35
|
+
"@types/node": "~20",
|
|
36
|
+
"ts-node": "~10",
|
|
37
|
+
"typescript": "~5"
|
|
49
38
|
}
|
|
50
39
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { LaunchOptions, BrowserContextOptions } from 'playwright';
|
|
2
|
+
|
|
3
|
+
type BrowserName = 'chromium' | 'firefox' | 'webkit';
|
|
4
|
+
|
|
5
|
+
const browser = (process.env.BROWSER || 'chromium') as BrowserName;
|
|
6
|
+
|
|
7
|
+
const chromiumArgs: string[] = [
|
|
8
|
+
'--no-sandbox',
|
|
9
|
+
'--disable-dev-shm-usage',
|
|
10
|
+
'--disable-setuid-sandbox',
|
|
11
|
+
'--disable-web-security',
|
|
12
|
+
'--ignore-certificate-errors',
|
|
13
|
+
'--disable-extensions',
|
|
14
|
+
'--incognito',
|
|
15
|
+
'--disable-infobars',
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
interface PlaywrightConfig {
|
|
19
|
+
browser: BrowserName;
|
|
20
|
+
launchOptions: LaunchOptions;
|
|
21
|
+
contextOptions: BrowserContextOptions;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const config: PlaywrightConfig = {
|
|
25
|
+
browser,
|
|
26
|
+
launchOptions: {
|
|
27
|
+
headless: true,
|
|
28
|
+
slowMo: 300,
|
|
29
|
+
args: browser === 'chromium' ? chromiumArgs : [],
|
|
30
|
+
},
|
|
31
|
+
contextOptions: {
|
|
32
|
+
viewport: { width: 1600, height: 1200 },
|
|
33
|
+
ignoreHTTPSErrors: true,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export = config;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
%PDF-1.4
|
|
2
|
+
1 0 obj<</Type/Catalog/Pages 2 0 R>>endobj
|
|
3
|
+
2 0 obj<</Type/Pages/Kids[3 0 R]/Count 1>>endobj
|
|
4
|
+
3 0 obj<</Type/Page/MediaBox[0 0 612 792]/Parent 2 0 R>>endobj
|
|
5
|
+
xref
|
|
6
|
+
0 4
|
|
7
|
+
0000000000 65535 f
|
|
8
|
+
0000000009 00000 n
|
|
9
|
+
0000000058 00000 n
|
|
10
|
+
0000000115 00000 n
|
|
11
|
+
trailer<</Size 4/Root 1 0 R>>
|
|
12
|
+
startxref
|
|
13
|
+
190
|
|
14
|
+
%%EOF
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const { Given, When, Then } = require('@cucumber/cucumber');
|
|
2
|
-
const { Before, After, BeforeStep, AfterStep } = require('@cucumber/cucumber');
|
|
1
|
+
const { Given, When, Then, Before } = require('@cucumber/cucumber');
|
|
3
2
|
const axios = require('axios');
|
|
4
3
|
const assert = require('assert');
|
|
5
4
|
|
|
@@ -11,19 +10,7 @@ let baseURL = '';
|
|
|
11
10
|
let authorization = '';
|
|
12
11
|
let placeHolders = {};
|
|
13
12
|
|
|
14
|
-
/**
|
|
15
|
-
* Safely pauses based on global config for API calls.
|
|
16
|
-
* @param {string} key
|
|
17
|
-
*/
|
|
18
|
-
function safePause(key) {
|
|
19
|
-
const time = (global.browser?.globals?.minimum_wait_time?.[key]) || 0;
|
|
20
|
-
if (time > 0) {
|
|
21
|
-
return new Promise(resolve => setTimeout(resolve, time));
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
13
|
Before(async function () {
|
|
26
|
-
await safePause('before_scenario');
|
|
27
14
|
// Reset API state before each scenario
|
|
28
15
|
apiResponse = null;
|
|
29
16
|
apiRequestData = null;
|
|
@@ -32,18 +19,6 @@ Before(async function () {
|
|
|
32
19
|
placeHolders = {};
|
|
33
20
|
});
|
|
34
21
|
|
|
35
|
-
After(async function () {
|
|
36
|
-
await safePause('after_scenario');
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
BeforeStep(async function () {
|
|
40
|
-
await safePause('before_step');
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
AfterStep(async function () {
|
|
44
|
-
await safePause('after_step');
|
|
45
|
-
});
|
|
46
|
-
|
|
47
22
|
/**
|
|
48
23
|
* Helper function to replace placeholders in text
|
|
49
24
|
*/
|
|
@@ -105,11 +80,10 @@ Given(/^(?:the API base URL is|I set the API base URL to|the base URL is) "([^"]
|
|
|
105
80
|
if (url.match(/^https?:\/\//)) {
|
|
106
81
|
baseURL = url.replace(/\/$/, ''); // Remove trailing slash
|
|
107
82
|
} else {
|
|
108
|
-
// If not a full URL, combine with
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
baseURL =
|
|
112
|
-
baseURL = baseURL.replace(':/', '://'); // Fix protocol separator
|
|
83
|
+
// If not a full URL, combine with the LAUNCH_URL env variable or default
|
|
84
|
+
const launchUrl = (process.env.LAUNCH_URL || 'http://localhost:8080').replace(/\/$/, '');
|
|
85
|
+
baseURL = (launchUrl + '/' + url).replace(/\/+/g, '/').replace(/\/$/, '');
|
|
86
|
+
baseURL = baseURL.replace(':/', '://');
|
|
113
87
|
}
|
|
114
88
|
});
|
|
115
89
|
|