Skip to content

Commit d478b02

Browse files
authored
Merge pull request #278 from Financial-Times/fix/make-smoke-test-run-sequentially
fix: make smoke tests run sequentially
2 parents 35c8777 + b40ea07 commit d478b02

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ To run a test suite for a type of FT subscriber, add a `user` property to the su
167167

168168
For the test to get the user session tokens from [`next-test-sessions-lambda`](http://github.com/financial-times/next-test-sessions-lambda), it needs to rewrite the URL being tested to an ft.com host. The original URL is set in the `FT-Test-Host` header, which tells `next-router` to proxy the test URL rather than production.
169169

170-
The test output will display the original URL.
170+
The test output will display the original URL.
171171

172172
*Options:* `premium`, `standard`, `expired`.
173173

@@ -202,11 +202,20 @@ n-test smoke -H https://05bd2344ebca.ngrok.io
202202

203203
Needs to set TEST_SESSIONS_URL (url to [`next-test-sessions-lambda`](http://github.com/financial-times/next-test-sessions-lambda)) and TEST_SESSIONS_API_KEY environment variables when running the tests.
204204

205+
```
206+
TEST_SESSIONS_API_KEY=<TEST_SESSIONS_API_KEY> TEST_SESSIONS_URL=<TEST_SESSIONS_URL> n-test smoke -H https://05bd2344ebca.ngrok.io
207+
```
208+
209+
Ngrok has added a warning page to block phishing attack, so an additional header `ngrok-skip-browser-warning` is needed to be truthy to bypass the page, or the warning page is always shown.
210+
205211
*Example*
206212
```
207213
[
208214
{
209215
user: 'premium',
216+
header: {
217+
'ngrok-skip-browser-warning': 1,
218+
},
210219
urls: [
211220
'/these-will': 200,
212221
'/run-with-a': 200,

lib/smoke/smoke-test.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,15 @@ class SmokeTest {
109109

110110
try {
111111

112-
const allTests = [directly(15, puppetTests)];
113-
if (crossBrowserTests.length > 0) {
114-
allTests.push(directly(5, crossBrowserTests));
115-
} else {
116-
allTests.push(Promise.resolve([]));
112+
const puppetResults = [];
113+
const crossBrowserResults = [];
114+
for (let test of puppetTests) {
115+
puppetResults.push(await test());
116+
}
117+
for (let test of crossBrowserTests) {
118+
crossBrowserResults.push(await test());
117119
}
118120

119-
const [puppetResults, crossBrowserResults] = await Promise.all(allTests);
120121
const timeTaken = new Date(new Date().getTime() - startTime).toISOString().substr(14, 5);
121122

122123
return await this.displayResults(puppetResults, crossBrowserResults, timeTaken, puppetTests.length + crossBrowserTests.length);

0 commit comments

Comments
 (0)