Skip to content

Commit ea20ee7

Browse files
committed
feat: update labels, add a flaky and a mistake in snapshot
1 parent 73db1e0 commit ea20ee7

File tree

1 file changed

+41
-36
lines changed

1 file changed

+41
-36
lines changed

test/e2e/compress.test.js

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { expect } = require("../helpers/playwright-custom-expects");
77
const config = require("../fixtures/simple-config-other/webpack.config");
88
const port = require("../ports-map")["compress-option"];
99

10-
describe("compress option", { tag: "@flaky" }, () => {
10+
describe("compress option", { tag: ["@flaky", "@fails"] }, () => {
1111
describe("enabled by default when not specified", () => {
1212
let compiler;
1313
let server;
@@ -44,13 +44,11 @@ describe("compress option", { tag: "@flaky" }, () => {
4444

4545
expect(response.status()).toMatchSnapshotWithArray();
4646

47-
expect(
48-
response.headers()["content-encoding"])
49-
.toMatchSnapshotWithArray();
47+
expect(response.headers()["content-encoding"]).toMatchSnapshotWithArray();
5048

5149
expect(
52-
consoleMessages.map((message) => message.text()))
53-
.toMatchSnapshotWithArray();
50+
consoleMessages.map((message) => message.text()),
51+
).toMatchSnapshotWithArray();
5452

5553
expect(pageErrors).toMatchSnapshotWithArray();
5654
});
@@ -98,13 +96,11 @@ describe("compress option", { tag: "@flaky" }, () => {
9896

9997
expect(response.status()).toMatchSnapshotWithArray();
10098

101-
expect(
102-
response.headers()["content-encoding"])
103-
.toMatchSnapshotWithArray();
99+
expect(response.headers()["content-encoding"]).toMatchSnapshotWithArray();
104100

105101
expect(
106-
consoleMessages.map((message) => message.text()))
107-
.toMatchSnapshotWithArray();
102+
consoleMessages.map((message) => message.text()),
103+
).toMatchSnapshotWithArray();
108104

109105
expect(pageErrors).toMatchSnapshotWithArray();
110106
});
@@ -137,35 +133,44 @@ describe("compress option", { tag: "@flaky" }, () => {
137133
await server.stop();
138134
});
139135

140-
test("should handle GET request to bundle file", {
141-
annotation: {
142-
type: "fails",
143-
description: "https://github.com/webpack/webpack-dev-server/issues/4630#issuecomment-1588211112"
144-
}
145-
}, async ({ page }) => {
146-
page
147-
.on("console", (message) => {
148-
consoleMessages.push(message);
149-
})
150-
.on("pageerror", (error) => {
151-
pageErrors.push(error);
136+
test(
137+
"should handle GET request to bundle file",
138+
{
139+
tag: ["@flaky"],
140+
annotation: {
141+
type: "issue",
142+
description:
143+
"https://github.com/webpack/webpack-dev-server/blob/master/test/e2e/__snapshots__/compress.test.js.snap.webpack5#L7",
144+
},
145+
},
146+
async ({ page }) => {
147+
page
148+
.on("console", (message) => {
149+
consoleMessages.push(message);
150+
})
151+
.on("pageerror", (error) => {
152+
pageErrors.push(error);
153+
});
154+
155+
const response = await page.goto(`http://127.0.0.1:${port}/main.js`, {
156+
waitUntil: "networkidle0",
152157
});
153158

154-
const response = await page.goto(`http://127.0.0.1:${port}/main.js`, {
155-
waitUntil: "networkidle0",
156-
});
159+
expect(response.status()).toMatchSnapshotWithArray();
157160

158-
expect(response.status()).toMatchSnapshotWithArray();
161+
// the response sometimes is []
162+
// and sometimes {"accept-ranges": "bytes", "connection": "keep-alive", "content-length": "276518", "content-type": "application/javascript; charset=utf-8", "date": "Wed, 24 Jul 2024 12:49:54 GMT", "keep-alive": "timeout=5", "x-powered-by": "Express"}
163+
// the thing is that the content-encoding does not exist in the response headers object
164+
expect(
165+
response.headers()["content-encoding"],
166+
).toMatchSnapshotWithArray();
159167

160-
expect(
161-
response.headers()["content-encoding"])
162-
.toMatchSnapshotWithArray();
168+
expect(
169+
consoleMessages.map((message) => message.text()),
170+
).toMatchSnapshotWithArray();
163171

164-
expect(
165-
consoleMessages.map((message) => message.text()))
166-
.toMatchSnapshotWithArray();
167-
168-
expect(pageErrors).toMatchSnapshotWithArray();
169-
});
172+
expect(pageErrors).toMatchSnapshotWithArray();
173+
},
174+
);
170175
});
171176
});

0 commit comments

Comments
 (0)