Skip to content

Commit 18a8f3a

Browse files
authored
fix(e2e): Use button instead of checkbox in parallel test (#1034)
* fix(e2e): Use button instead of checkbox in parallel test * Revert "fix(e2e): Workaround for parallel.test.ts (#1031)" This reverts commit a334ff2.
1 parent d667cf9 commit 18a8f3a

File tree

5 files changed

+19
-61
lines changed

5 files changed

+19
-61
lines changed

examples/app-pages-router/app/parallel/layout.tsx

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,13 @@ export default function Layout({
1717

1818
return (
1919
<div>
20-
<div className="flex flex-col mb-10">
21-
<label htmlFor="a">
22-
Enable A
23-
<input
24-
name="a"
25-
type="checkbox"
26-
checked={routeA}
27-
onChange={(e) => {
28-
setRouteA(e.target.checked);
29-
}}
30-
/>
31-
</label>
32-
<label htmlFor="b">
33-
Enable B
34-
<input
35-
name="b"
36-
type="checkbox"
37-
checked={routeB}
38-
onChange={(e) => {
39-
setRouteB(e.target.checked);
40-
}}
41-
/>
42-
</label>
20+
<div className="flex flex-col items-start mb-10">
21+
<button onClick={() => setRouteA(!routeA)} data-testid="enable-a">
22+
{routeA ? "Disable A" : "Enable A"}
23+
</button>
24+
<button onClick={() => setRouteB(!routeB)} data-testid="enable-b">
25+
{routeB ? "Disable B" : "Enable B"}
26+
</button>
4327
</div>
4428

4529
{routeA && a}

examples/app-router/app/parallel/layout.tsx

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,13 @@ export default function Layout({
1717

1818
return (
1919
<div>
20-
<div className="flex flex-col mb-10">
21-
<label htmlFor="a">
22-
Enable A
23-
<input
24-
name="a"
25-
type="checkbox"
26-
checked={routeA}
27-
onChange={(e) => {
28-
setRouteA(e.target.checked);
29-
}}
30-
/>
31-
</label>
32-
<label htmlFor="b">
33-
Enable B
34-
<input
35-
name="b"
36-
type="checkbox"
37-
checked={routeB}
38-
onChange={(e) => {
39-
setRouteB(e.target.checked);
40-
}}
41-
/>
42-
</label>
20+
<div className="flex flex-col items-start mb-10">
21+
<button onClick={() => setRouteA(!routeA)} data-testid="enable-a">
22+
{routeA ? "Disable A" : "Enable A"}
23+
</button>
24+
<button onClick={() => setRouteB(!routeB)} data-testid="enable-b">
25+
{routeB ? "Disable B" : "Enable B"}
26+
</button>
4327
</div>
4428

4529
{routeA && a}

packages/tests-e2e/playwright.config.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,4 @@ export default defineConfig({
3131
},
3232
},
3333
],
34-
// Workaround for https://github.com/microsoft/playwright/issues/36371
35-
// It seems to be failing in our Github action
36-
// https://github.com/opennextjs/opennextjs-aws/actions/runs/19116336570/job/54627469525#step:15:171
37-
use: {
38-
launchOptions: {
39-
args: [
40-
"--disable-features=AcceptCHFrame,AutoExpandDetailsElement,AvoidUnnecessaryBeforeUnloadCheckSync,CertificateTransparencyComponentUpdater,DestroyProfileOnBrowserClose,DialMediaRouteProvider,ExtensionManifestV2Disabled,GlobalMediaControls,HttpsUpgrades,ImprovedCookieControls,LazyFrameLoading,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate,DeferRendererTasksAfterInput",
41-
],
42-
},
43-
},
4434
});

packages/tests-e2e/tests/appPagesRouter/parallel.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { expect, test } from "@playwright/test";
22

33
test("Parallel routes", async ({ page }) => {
44
await page.goto("/");
5-
await page.locator('[href="/parallel"]').click();
5+
await page.getByRole("link", { name: "Parallel" }).click();
66

77
await page.waitForURL("/parallel");
88

@@ -13,13 +13,13 @@ test("Parallel routes", async ({ page }) => {
1313
await expect(routeB).not.toBeVisible();
1414

1515
// Enable A, which should be visible but not B
16-
await page.locator('input[name="a"]').check();
16+
await page.getByTestId("enable-a").click();
1717
routeA = page.getByText("Parallel Route A");
1818
await expect(routeA).toBeVisible();
1919
await expect(routeB).not.toBeVisible();
2020

2121
// Enable B, both should be visible
22-
await page.locator('input[name="b"]').check();
22+
await page.getByTestId("enable-b").click();
2323
routeB = page.getByText("Parallel Route B");
2424
await expect(routeA).toBeVisible();
2525
await expect(routeB).toBeVisible();

packages/tests-e2e/tests/appRouter/parallel.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ test("Parallel routes", async ({ page }) => {
1313
await expect(routeB).not.toBeVisible();
1414

1515
// Enable A, which should be visible but not B
16-
await page.locator('input[name="a"]').check();
16+
await page.getByTestId("enable-a").click();
1717
routeA = page.getByText("Parallel Route A");
1818
await expect(routeA).toBeVisible();
1919
await expect(routeB).not.toBeVisible();
2020

2121
// Enable B, both should be visible
22-
await page.locator('input[name="b"]').check();
22+
await page.getByTestId("enable-b").click();
2323
routeB = page.getByText("Parallel Route B");
2424
await expect(routeA).toBeVisible();
2525
await expect(routeB).toBeVisible();

0 commit comments

Comments
 (0)