Skip to content

Commit 555bddd

Browse files
test: fix
1 parent ba0a2fc commit 555bddd

File tree

4 files changed

+33
-22
lines changed

4 files changed

+33
-22
lines changed

test/e2e/__snapshots__/overlay.test.js.snap.webpack5

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,8 +2312,7 @@ exports[`overlay should show error for uncaught runtime error: overlay html 1`]
23122312
"
23132313
>
23142314
Injected error at throwError (<anonymous>:2:15) at
2315-
<anonymous>:3:9 at addScriptContent
2316-
(__puppeteer_evaluation_script__:9:27)
2315+
<anonymous>:3:9
23172316
</div>
23182317
</div>
23192318
</div>

test/e2e/__snapshots__/web-socket-server-url.test.js.snap.webpack5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ exports[`web socket server URL should work and throw an error on invalid web soc
3333

3434
exports[`web socket server URL should work and throw an error on invalid web socket URL ("sockjs"): page errors 1`] = `
3535
[
36-
"SyntaxError: The URL's scheme must be either 'http:' or 'https:'. 'unknown:' is not allowed.",
36+
"The URL's scheme must be either 'http:' or 'https:'. 'unknown:' is not allowed.",
3737
]
3838
`;
3939

@@ -45,7 +45,7 @@ exports[`web socket server URL should work and throw an error on invalid web soc
4545

4646
exports[`web socket server URL should work and throw an error on invalid web socket URL ("ws"): page errors 1`] = `
4747
[
48-
"DOMException: Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. 'unknown' is not allowed.",
48+
"Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. 'unknown' is not allowed.",
4949
]
5050
`;
5151

test/e2e/on-listening.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ describe("onListening option", () => {
9696
pageErrors.push(error);
9797
})
9898
.on("request", (interceptedRequest) => {
99+
if (interceptedRequest.isInterceptResolutionHandled()) return;
100+
99101
interceptedRequest.continue({ method: "POST" });
100102
});
101103

test/e2e/options-middleware.test.js

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,33 @@ describe("handle options-request correctly", () => {
5858
const prefixUrl = "http://127.0.0.1";
5959
const htmlUrl = `${prefixUrl}:${portForServer}/test.html`;
6060
const appUrl = `${prefixUrl}:${portForApp}`;
61-
await page.goto(appUrl);
62-
const responseStatus = [];
63-
page.on("response", (res) => {
64-
responseStatus.push(res.status());
65-
});
66-
await page.evaluate(
67-
(url) =>
68-
window.fetch(url, {
69-
headers: {
70-
"another-header": "1",
71-
},
72-
}),
73-
htmlUrl,
74-
);
75-
await browser.close();
76-
await server.stop();
77-
await closeApp();
78-
expect(responseStatus).toEqual([204, 200]);
61+
62+
try {
63+
await page.goto(appUrl);
64+
65+
const responseStatus = [];
66+
67+
page.on("response", (res) => {
68+
responseStatus.push(res.status());
69+
});
70+
71+
await page.evaluate(
72+
(url) =>
73+
window.fetch(url, {
74+
headers: {
75+
"another-header": "1",
76+
},
77+
}),
78+
htmlUrl,
79+
);
80+
81+
expect(responseStatus).toEqual([200, 204, 200]);
82+
} catch (error) {
83+
throw error;
84+
} finally {
85+
await browser.close();
86+
await server.stop();
87+
await closeApp();
88+
}
7989
});
8090
});

0 commit comments

Comments
 (0)