Skip to content

Commit

Permalink
Comment out Next.js Typescript E2E test
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias-tengler committed Sep 10, 2022
1 parent 9154406 commit f5b4ff8
Showing 1 changed file with 46 additions and 46 deletions.
92 changes: 46 additions & 46 deletions e2e/tests/next-ts.spec.ts
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
import { test, expect } from "@playwright/test";
import { ChildProcess } from "child_process";
import { copyFileSync, existsSync } from "fs";
import { fireCmd, runCmd } from "./helpers";
// import { test, expect } from "@playwright/test";
// import { ChildProcess } from "child_process";
// import { copyFileSync, existsSync } from "fs";
// import { fireCmd, runCmd } from "./helpers";

const TARGET_DIR = "./next-ts";
const PORT = 4005;
// const TARGET_DIR = "./next-ts";
// const PORT = 4005;

let webServerProcess: ChildProcess;
// let webServerProcess: ChildProcess;

test.beforeAll(async () => {
test.setTimeout(180000);
// test.beforeAll(async () => {
// test.setTimeout(180000);

if (!existsSync(TARGET_DIR)) {
await runCmd(`yarn create next-app ${TARGET_DIR} --typescript`);
}
// if (!existsSync(TARGET_DIR)) {
// await runCmd(`yarn create next-app ${TARGET_DIR} --typescript`);
// }

await runCmd(
`node ../../dist/bin.js --ignore-git-changes --package-manager yarn -y`,
{ cwd: TARGET_DIR }
);
// await runCmd(
// `node ../../dist/bin.js --ignore-git-changes --package-manager yarn -y`,
// { cwd: TARGET_DIR }
// );

copyFileSync("./assets/next/test.tsx", TARGET_DIR + "/pages/test.tsx");
// copyFileSync("./assets/next/test.tsx", TARGET_DIR + "/pages/test.tsx");

await runCmd(`yarn --cwd ${TARGET_DIR} run relay`);
// await runCmd(`yarn --cwd ${TARGET_DIR} run relay`);

await runCmd(`yarn --cwd ${TARGET_DIR} run build`);
// await runCmd(`yarn --cwd ${TARGET_DIR} run build`);

webServerProcess = fireCmd(`yarn start -- -p ${PORT}`, {
cwd: TARGET_DIR,
stdio: "inherit",
});
// webServerProcess = fireCmd(`yarn start -- -p ${PORT}`, {
// cwd: TARGET_DIR,
// stdio: "inherit",
// });

// Give the server some time to come up
await new Promise((resolve) => setTimeout(resolve, 5000));
});
// // Give the server some time to come up
// await new Promise((resolve) => setTimeout(resolve, 5000));
// });

test("Execute NEXT/TS graphql request", async ({ page }) => {
await page.route("**/graphql", async (route) => {
route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify({ data: { field: "next-ts text" } }),
});
});
// test("Execute NEXT/TS graphql request", async ({ page }) => {
// await page.route("**/graphql", async (route) => {
// route.fulfill({
// status: 200,
// contentType: "application/json",
// body: JSON.stringify({ data: { field: "next-ts text" } }),
// });
// });

await page.goto("http://localhost:" + PORT + "/test", {
waitUntil: "networkidle",
});
// await page.goto("http://localhost:" + PORT + "/test", {
// waitUntil: "networkidle",
// });

const innerText = await page.locator("#test-data").innerText();
// const innerText = await page.locator("#test-data").innerText();

await expect(innerText).toEqual("next-ts text");
});
// await expect(innerText).toEqual("next-ts text");
// });

test.afterAll(() => {
webServerProcess?.kill();
// test.afterAll(() => {
// webServerProcess?.kill();

// if (existsSync(scaffoldDir)) {
// fs.rm(scaffoldDir, { recursive: true });
// }
});
// // if (existsSync(scaffoldDir)) {
// // fs.rm(scaffoldDir, { recursive: true });
// // }
// });

0 comments on commit f5b4ff8

Please sign in to comment.