Skip to content

Commit 194efc8

Browse files
committed
feat: move tests from e2e-playwright to e2e
1 parent efed0ab commit 194efc8

File tree

900 files changed

+568
-256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

900 files changed

+568
-256
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"<html><head><meta name=\"color-scheme\" content=\"light dark\"></head><body><pre style=\"word-wrap: break-word; white-space: pre-wrap;\">Invalid Host header</pre></body></html>"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"<html><head><meta name=\"color-scheme\" content=\"light dark\"></head><body><pre style=\"word-wrap: break-word; white-space: pre-wrap;\">Invalid Host header</pre></body></html>"

test/e2e-playwright/api-refactored.test.js test/e2e/api.ignore.test.js

+59-23
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
const path = require("path");
44
const webpack = require("webpack");
5-
const { test} = require("@playwright/test");
5+
const { test } = require("@playwright/test");
66
const { expect } = require("@playwright/test");
77
const { describe } = require("@playwright/test");
8-
const { afterEach } = require("@playwright/test")
8+
const { afterEach } = require("@playwright/test");
99
const { beforeEach } = require("@playwright/test");
1010
const { jest } = require("@jest/globals");
1111
// eslint-disable-next-line import/no-extraneous-dependencies
@@ -15,7 +15,7 @@ const config = require("../fixtures/client-config/webpack.config");
1515
const sessionSubscribe = require("../helpers/session-subscribe");
1616
const port = require("../ports-map").api;
1717

18-
describe("API", () => {
18+
describe.skip("API", () => {
1919
describe("WEBPACK_SERVE environment variable", () => {
2020
const OLD_ENV = process.env;
2121
let server;
@@ -25,7 +25,7 @@ describe("API", () => {
2525
beforeEach(async () => {
2626
// this is important - it clears the cache
2727
// jest.resetModules();
28-
Object.keys(require.cache).forEach(key => delete require.cache[key]);
28+
Object.keys(require.cache).forEach((key) => delete require.cache[key]);
2929

3030
process.env = { ...OLD_ENV };
3131

@@ -66,7 +66,9 @@ describe("API", () => {
6666

6767
expect(JSON.stringify(response.status())).toMatchSnapshot();
6868

69-
expect(JSON.stringify(consoleMessages.map((message) => message.text()))).toMatchSnapshot();
69+
expect(
70+
JSON.stringify(consoleMessages.map((message) => message.text())),
71+
).toMatchSnapshot();
7072

7173
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
7274
});
@@ -96,7 +98,8 @@ describe("API", () => {
9698
});
9799

98100
expect(
99-
JSON.stringify(consoleMessages.map((message) => message.text()))).toMatchSnapshot();
101+
JSON.stringify(consoleMessages.map((message) => message.text())),
102+
).toMatchSnapshot();
100103
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
101104
} catch (error) {
102105
throw error;
@@ -132,7 +135,8 @@ describe("API", () => {
132135
});
133136

134137
expect(
135-
JSON.stringify(consoleMessages.map((message) => message.text()))).toMatchSnapshot();
138+
JSON.stringify(consoleMessages.map((message) => message.text())),
139+
).toMatchSnapshot();
136140
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
137141
} catch (error) {
138142
throw error;
@@ -212,7 +216,9 @@ describe("API", () => {
212216
}
213217
});
214218

215-
test.skip(`should work and allow to rerun dev server multiple times`, async ({ page }) => {
219+
test.skip(`should work and allow to rerun dev server multiple times`, async ({
220+
page,
221+
}) => {
216222
const compiler = webpack(config);
217223
const server = new Server({ port }, compiler);
218224

@@ -310,7 +316,9 @@ describe("API", () => {
310316
await server.stop();
311317
});
312318

313-
test("should use the default `noop` callback when invalidate is called without any callback", async ({ page }) => {
319+
test("should use the default `noop` callback when invalidate is called without any callback", async ({
320+
page,
321+
}) => {
314322
const callback = jestMock.fn();
315323

316324
server.invalidate();
@@ -331,7 +339,9 @@ describe("API", () => {
331339
expect(callback).toHaveBeenCalledTimes(1);
332340
expect(JSON.stringify(response.status())).toMatchSnapshot();
333341

334-
expect(JSON.stringify(consoleMessages.map((message) => message.text()))).toMatchSnapshot();
342+
expect(
343+
JSON.stringify(consoleMessages.map((message) => message.text())),
344+
).toMatchSnapshot();
335345
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
336346
});
337347

@@ -347,7 +357,9 @@ describe("API", () => {
347357
expect(callback).toHaveBeenCalledTimes(1);
348358
expect(JSON.stringify(response.status())).toMatchSnapshot();
349359

350-
expect(JSON.stringify(consoleMessages.map((message) => message.text()))).toMatchSnapshot();
360+
expect(
361+
JSON.stringify(consoleMessages.map((message) => message.text())),
362+
).toMatchSnapshot();
351363

352364
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
353365
});
@@ -443,12 +455,16 @@ describe("API", () => {
443455

444456
expect(JSON.stringify(response.status())).toMatchSnapshot();
445457

446-
expect(JSON.stringify(consoleMessages.map((message) => message.text()))).toMatchSnapshot();
458+
expect(
459+
JSON.stringify(consoleMessages.map((message) => message.text())),
460+
).toMatchSnapshot();
447461

448462
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
449463
});
450464

451-
test("should return the port when the port is undefined", async ({ page }) => {
465+
test("should return the port when the port is undefined", async ({
466+
page,
467+
}) => {
452468
const retryCount = 3;
453469

454470
process.env.WEBPACK_DEV_SERVER_PORT_RETRY = retryCount;
@@ -475,14 +491,20 @@ describe("API", () => {
475491
waitUntil: "networkidle0",
476492
});
477493

478-
expect(JSON.stringify(response.status())).toMatchSnapshot("response status");
494+
expect(JSON.stringify(response.status())).toMatchSnapshot(
495+
"response status",
496+
);
479497

480-
expect(JSON.stringify(consoleMessages.map((message) => message.text()))).toMatchSnapshot();
498+
expect(
499+
JSON.stringify(consoleMessages.map((message) => message.text())),
500+
).toMatchSnapshot();
481501

482502
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
483503
});
484504

485-
test("should retry finding the port for up to defaultPortRetry times (number)", async ({ page }) => {
505+
test("should retry finding the port for up to defaultPortRetry times (number)", async ({
506+
page,
507+
}) => {
486508
const retryCount = 4;
487509

488510
process.env.WEBPACK_DEV_SERVER_PORT_RETRY = retryCount;
@@ -510,12 +532,16 @@ describe("API", () => {
510532

511533
expect(JSON.stringify(response.status())).toMatchSnapshot();
512534

513-
expect(JSON.stringify(consoleMessages.map((message) => message.text()))).toMatchSnapshot();
535+
expect(
536+
JSON.stringify(consoleMessages.map((message) => message.text())),
537+
).toMatchSnapshot();
514538

515539
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
516540
});
517541

518-
test("should retry finding the port for up to defaultPortRetry times (string)", async ({ page }) => {
542+
test("should retry finding the port for up to defaultPortRetry times (string)", async ({
543+
page,
544+
}) => {
519545
const retryCount = 5;
520546

521547
process.env.WEBPACK_DEV_SERVER_PORT_RETRY = retryCount;
@@ -541,14 +567,20 @@ describe("API", () => {
541567
waitUntil: "networkidle0",
542568
});
543569

544-
expect(JSON.stringify(response.status())).toMatchSnapshot("response status");
570+
expect(JSON.stringify(response.status())).toMatchSnapshot(
571+
"response status",
572+
);
545573

546-
expect(JSON.stringify(consoleMessages.map((message) => message.text()))).toMatchSnapshot();
574+
expect(
575+
JSON.stringify(consoleMessages.map((message) => message.text())),
576+
).toMatchSnapshot();
547577

548578
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
549579
});
550580

551-
test("should retry finding the port when serial ports are busy", async ({ page }) => {
581+
test("should retry finding the port when serial ports are busy", async ({
582+
page,
583+
}) => {
552584
const busyPorts = [60000, 60001, 60002, 60003, 60004, 60005];
553585

554586
process.env.WEBPACK_DEV_SERVER_PORT_RETRY = 1000;
@@ -630,7 +662,9 @@ describe("API", () => {
630662
});
631663
});
632664

633-
test('should allow URLs with scheme for checking origin when the "option.client.webSocketURL" is object', async ({ page }) => {
665+
test('should allow URLs with scheme for checking origin when the "option.client.webSocketURL" is object', async ({
666+
page,
667+
}) => {
634668
const options = {
635669
port,
636670
client: {
@@ -704,7 +738,9 @@ describe("API", () => {
704738

705739
expect(
706740
// net::ERR_NAME_NOT_RESOLVED can be multiple times
707-
JSON.stringify(consoleMessages.map((message) => message.text())).slice(0, 7),
741+
JSON.stringify(
742+
consoleMessages.map((message) => message.text()),
743+
).slice(0, 7),
708744
).toMatchSnapshot();
709745

710746
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
File renamed without changes.

test/e2e-playwright/bonjour.test.js test/e2e/bonjour.test.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ describe("bonjour option", () => {
8989

9090
expect(JSON.stringify(response.status())).toMatchSnapshot();
9191

92-
expect(JSON.stringify(consoleMessages.map((message) => message.text()))).toMatchSnapshot();
92+
expect(
93+
JSON.stringify(consoleMessages.map((message) => message.text())),
94+
).toMatchSnapshot();
9395

9496
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
9597
});
@@ -155,7 +157,9 @@ describe("bonjour option", () => {
155157

156158
expect(JSON.stringify(response.status())).toMatchSnapshot();
157159

158-
expect(JSON.stringify(consoleMessages.map((message) => message.text()))).toMatchSnapshot();
160+
expect(
161+
JSON.stringify(consoleMessages.map((message) => message.text())),
162+
).toMatchSnapshot();
159163

160164
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
161165
});
@@ -231,7 +235,9 @@ describe("bonjour option", () => {
231235

232236
expect(JSON.stringify(response.status())).toMatchSnapshot();
233237

234-
expect(JSON.stringify(consoleMessages.map((message) => message.text()))).toMatchSnapshot();
238+
expect(
239+
JSON.stringify(consoleMessages.map((message) => message.text())),
240+
).toMatchSnapshot();
235241

236242
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
237243
});
@@ -310,7 +316,9 @@ describe("bonjour option", () => {
310316

311317
expect(JSON.stringify(response.status())).toMatchSnapshot();
312318

313-
expect(JSON.stringify(consoleMessages.map((message) => message.text()))).toMatchSnapshot();
319+
expect(
320+
JSON.stringify(consoleMessages.map((message) => message.text())),
321+
).toMatchSnapshot();
314322

315323
expect(JSON.stringify(pageErrors)).toMatchSnapshot();
316324
});

0 commit comments

Comments
 (0)