Skip to content

Commit 012357a

Browse files
committed
test: fix test
1 parent a75f527 commit 012357a

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

test/e2e/client.test.js

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const webpack = require("webpack");
44
const Server = require("../../lib/Server");
55
const config = require("../fixtures/simple-config-other/webpack.config");
66
const runBrowser = require("../helpers/run-browser");
7+
const sessionSubscribe = require("../helpers/session-subscribe");
78
const port = require("../ports-map")["client-option"];
89

910
describe("client option", () => {
@@ -119,14 +120,28 @@ describe("client option", () => {
119120
pageErrors.push(error);
120121
});
121122

122-
const response = await page.goto(
123-
`http://localhost:${port}/foo/test/bar`,
124-
{
125-
waitUntil: "networkidle0",
126-
},
127-
);
123+
const webSocketRequests = [];
128124

129-
expect(response.status()).toMatchSnapshot("response status");
125+
const session = await page.target().createCDPSession();
126+
session.on("Network.webSocketCreated", (test) => {
127+
webSocketRequests.push(test);
128+
});
129+
130+
await session.send("Target.setAutoAttach", {
131+
autoAttach: true,
132+
flatten: true,
133+
waitForDebuggerOnStart: true,
134+
});
135+
136+
sessionSubscribe(session);
137+
138+
await page.goto(`http://localhost:${port}/foo/test/bar`, {
139+
waitUntil: "networkidle0",
140+
});
141+
142+
const [webSocketRequest] = webSocketRequests;
143+
144+
expect(webSocketRequest.status()).toMatchSnapshot("response status");
130145

131146
expect(consoleMessages.map((message) => message.text())).toMatchSnapshot(
132147
"console messages",

0 commit comments

Comments
 (0)