Skip to content

Conversation

@chamny20
Copy link
Contributor

@chamny20 chamny20 commented Aug 11, 2025

๐Ÿ“์š”์•ฝ(Summary)

์ด์Šˆ ๋ฒˆํ˜ธ : #187

๐Ÿ”จ๋ณ€๊ฒฝ ์‚ฌํ•ญ(Changes)

  • playwright๋ฅผ ๊ตฌ์ถ•ํ•ฉ๋‹ˆ๋‹ค.

[์šฐ์„ ์ˆœ์œ„]

๋น„์ฆˆ๋‹ˆ์Šค ํ•ต์‹ฌ ๋กœ์ง > ๋…ธ์ถœ ๋นˆ๋„ > ์ด๋ฏธ์ง€, ํ•„ํ„ฐ ๋“ฑ ์ˆœ์œผ๋กœ e2e test ์ง„ํ–‰

=> ํ•ด๋‹น PR์—์„œ๋Š” ํ™ˆํŽ˜์ด์ง€ ๋กœ๋“œ ๋ถ€๋ถ„์— ๋Œ€ํ•ด์„œ๋งŒ ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ ํ›„ checkout ํ›„ main test ์ง„ํ–‰ํ•  ์˜ˆ์ •

๐Ÿ˜‰๋ฆฌ๋ทฐ ์š”๊ตฌ์‚ฌํ•ญ

๐Ÿ’Žํ™•์ธ ๋ฐฉ๋ฒ• (์„ ํƒ)

image

๐Ÿ“Œ PR ์ง„ํ–‰ ์‹œ ์ด๋Ÿฌํ•œ ์ ๋“ค์„ ์ฐธ๊ณ ํ•ด ์ฃผ์„ธ์š”

* P1 : ๊ผญ ๋ฐ˜์˜ํ•ด ์ฃผ์„ธ์š” (Request Changes) - ์ด์Šˆ๊ฐ€ ๋ฐœ์ƒํ•˜๊ฑฐ๋‚˜ ์ทจ์•ฝ์ ์ด ๋ฐœ๊ฒฌ๋˜๋Š” ์ผ€์ด์Šค ๋“ฑ
* P2 : ๋ฐ˜์˜์„ ์ ๊ทน์ ์œผ๋กœ ๊ณ ๋ คํ•ด ์ฃผ์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š” (Comment)
* P3 : ์ด๋Ÿฐ ๋ฐฉ๋ฒ•๋„ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”~ ๋“ฑ์˜ ์‚ฌ์†Œํ•œ ์˜๊ฒฌ์ž…๋‹ˆ๋‹ค (Chore)

Summary by CodeRabbit

  • Tests
    • Added Playwright end-to-end tests with cross-browser coverage, parallel runs, retries, and HTML reports; includes sample suites validating navigation and home-page flows.
  • Chores
    • CI now runs E2E tests on push and pull requests, installs browsers, and uploads test reports (30-day retention).
    • Added local/CI npm scripts to run E2E tests and updated ignore rules to exclude Playwright artifacts.

@chamny20 chamny20 self-assigned this Aug 11, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 11, 2025

Walkthrough

Adds Playwright end-to-end testing: GitHub Actions workflow (uses secret for NEXT_PUBLIC_IMAGE_HOSTNAME), Playwright config, two E2E test suites, npm scripts + devDependency, and .gitignore entries for Playwright artifacts/caches.

Changes

Cohort / File(s) Summary
CI Workflow
.github/workflows/playwright.yml
New "Playwright Tests" GitHub Actions workflow triggered on push and pull_request to main/master; sets env NEXT_PUBLIC_IMAGE_HOSTNAME from secrets.IMAGE_HOSTNAME, checks out code, sets up Node (lts/*), installs deps (yarn), installs Playwright browsers, runs yarn playwright test, and uploads playwright-report/ artifact (30d retention).
Playwright Config & Scripts
playwright.config.ts, package.json
Adds playwright.config.ts with projects for Chromium/Firefox/WebKit, retries, HTML reporter, baseURL http://localhost:3000, webServer yarn dev, test defaults (headless, screenshots/videos on failure), tests dir ./tests. Adds npm scripts test:e2e and test:e2e:ci and devDependency @playwright/test ^1.54.2.
Git Ignore
.gitignore
Adds Playwright-specific ignore patterns: node_modules/, /test-results/, /playwright-report/, /blob-report/, /playwright/.cache/.
E2E Tests
tests/e2e/example.spec.ts, tests/e2e/home.spec.ts
Adds Playwright tests: example.spec.ts (checks Playwright site title, "Get started" link, and root page title contains "TimeToast"); home.spec.ts (home-page smoke test, token-absent flow leading to /login, token-present flow expecting redirect to /home).

Sequence Diagram(s)

sequenceDiagram
  participant Dev as Developer
  participant GH as GitHub Actions
  participant Runner as CI Runner (ubuntu-latest)
  participant Server as Web Server (yarn dev)
  participant Playwright as Playwright Test

  Dev->>GH: Push / PR to main/master
  GH->>Runner: Start "Playwright Tests" job (env from secrets.IMAGE_HOSTNAME)
  Runner->>Runner: checkout, setup-node (lts/*), install deps (yarn), playwright install
  Runner->>Server: Start webServer (yarn dev) or reuse existing
  Runner->>Playwright: Run playwright test (Chromium/Firefox/WebKit)
  Playwright-->>Runner: Generate reports (playwright-report/)
  Runner->>GH: Upload playwright-report artifact
Loading

Estimated code review effort

๐ŸŽฏ 3 (Moderate) | โฑ๏ธ ~15 minutes

Poem

I twitch my whiskers, tests take flight,
Browsers hop through day and night.
Reports tucked snug in a burrow deep,
Yarn and scripts help bunnies leap.
CI hums softly while I sleep. ๐Ÿฅ•โœจ

โœจ Finishing Touches
  • ๐Ÿ“ Generate Docstrings
๐Ÿงช Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch setting/#187/playwright

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

โค๏ธ Share
๐Ÿชง Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@chamny20 chamny20 linked an issue Aug 11, 2025 that may be closed by this pull request
2 tasks
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

๐Ÿงน Nitpick comments (5)
.gitignore (1)

41-41: Remove duplicate node_modules/ entry.

This entry duplicates the existing node_modules/ ignore pattern on line 4.

 # Playwright
-node_modules/
 /test-results/
 /playwright-report/
 /blob-report/
 /playwright/.cache/
.github/workflows/playwright.yml (1)

16-17: Consider adding dependency caching for faster CI builds.

Adding yarn cache could significantly speed up subsequent workflow runs.

     - uses: actions/setup-node@v4
       with:
         node-version: lts/*
+        cache: 'yarn'
     - name: Install dependencies
-      run: npm install -g yarn && yarn
+      run: yarn
tests/e2e/example.spec.ts (1)

22-25: LGTM! Good application-specific test structure.

This test correctly validates your application's home page functionality using the configured baseURL.

Consider adding more comprehensive tests for your application:

  • Navigation testing
  • Form interactions
  • User authentication flows
  • Core feature validation
playwright.config.ts (2)

20-24: Clean up inconsistent retry configuration.

There are conflicting retry configurations - one active and one commented.

- retries: 1, // ์‹คํŒจ ์‹œ ์žฌ์‹œ๋„ ํšŸ์ˆ˜
-
- // retries: process.env.CI ? 2 : 0,
+ retries: process.env.CI ? 1 : 0,

31-31: Consider making headless mode CI-specific.

Running tests in headed mode during local development can be useful for debugging.

- headless: true, // CI ํ™˜๊ฒฝ์—์„œ๋Š” headless ๊ถŒ์žฅ
+ headless: !!process.env.CI,
๐Ÿ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 732bbb7 and 0a4439a.

โ›” Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
๐Ÿ“’ Files selected for processing (5)
  • .github/workflows/playwright.yml (1 hunks)
  • .gitignore (1 hunks)
  • package.json (2 hunks)
  • playwright.config.ts (1 hunks)
  • tests/e2e/example.spec.ts (1 hunks)
๐Ÿ”‡ Additional comments (6)
.gitignore (1)

42-45: LGTM! Proper Playwright artifact patterns.

The ignore patterns for Playwright test results, reports, blob reports, and cache directory are correctly configured.

package.json (2)

15-16: LGTM! Well-structured E2E test scripts.

The scripts are properly configured:

  • test:e2e for local development with full reporting
  • test:e2e:ci with line reporter for CI environments

48-48: LGTM! Latest Playwright version added.

The @playwright/test dependency version ^1.54.2 is recent and appropriate for the devDependencies.

.github/workflows/playwright.yml (1)

8-27: LGTM! Well-configured Playwright CI workflow.

The workflow includes:

  • Appropriate timeout (60 minutes)
  • Latest action versions
  • Proper browser installation with dependencies
  • Conditional artifact upload with reasonable retention
playwright.config.ts (2)

76-80: LGTM! Proper web server configuration.

The webServer setup correctly:

  • Starts the dev server before tests
  • Reuses existing server in local development
  • Uses appropriate URL and command

38-52: LGTM! Comprehensive cross-browser testing setup.

The projects configuration enables testing across major browsers using appropriate device presets.

@@ -11,7 +11,9 @@
"cz": "./node_modules/cz-customizable/standalone.js",
"test": "jest",
"test:watch": "jeset --watchAll",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

โš ๏ธ Potential issue

Fix typo in test watch script.

There's a typo: "jeset" should be "jest".

-    "test:watch": "jeset --watchAll",
+    "test:watch": "jest --watchAll",
๐Ÿ“ Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"test:watch": "jeset --watchAll",
"test:watch": "jest --watchAll",
๐Ÿค– Prompt for AI Agents
In package.json around line 13, the "test:watch" script contains a typo ("jeset"
instead of "jest"); update the script value to use "jest --watchAll" so the
correct test runner is invoked when running npm run test:watch.

Comment on lines +3 to +8
test('has title', async ({ page }) => {
await page.goto('https://playwright.dev/');

// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Playwright/);
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐Ÿ› ๏ธ Refactor suggestion

Consider removing external site tests from CI.

Testing external sites like playwright.dev can cause CI failures due to network issues or site changes outside your control.

Consider moving external site tests to a separate file or removing them from the main test suite:

-test('has title', async ({ page }) => {
-  await page.goto('https://playwright.dev/');
-
-  // Expect a title "to contain" a substring.
-  await expect(page).toHaveTitle(/Playwright/);
-});
๐Ÿ“ Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test('has title', async ({ page }) => {
await page.goto('https://playwright.dev/');
// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Playwright/);
});
๐Ÿค– Prompt for AI Agents
In tests/e2e/example.spec.ts around lines 3 to 8 there is a test that navigates
to an external site (https://playwright.dev/) which can cause flaky CI; remove
or move this external-site test out of the main CI suite by either deleting the
test, relocating it to a separate e2e-external.spec.ts file that is excluded
from CI, or marking it to skip in CI using test.skip or a custom tag/env-check;
alternatively replace the external navigation with a local/stubbed page (serve a
fixture HTML or use a mocked response) so the test no longer depends on the
external network.

Comment on lines +10 to +20
test('get started link', async ({ page }) => {
await page.goto('https://playwright.dev/');

// Click the get started link.
await page.getByRole('link', { name: 'Get started' }).click();

// Expects page to have a heading with the name of Installation.
await expect(
page.getByRole('heading', { name: 'Installation' }),
).toBeVisible();
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐Ÿ› ๏ธ Refactor suggestion

Remove external site test that may cause CI instability.

This test relies on an external site that could change or be unavailable, causing false CI failures.

-test('get started link', async ({ page }) => {
-  await page.goto('https://playwright.dev/');
-
-  // Click the get started link.
-  await page.getByRole('link', { name: 'Get started' }).click();
-
-  // Expects page to have a heading with the name of Installation.
-  await expect(
-    page.getByRole('heading', { name: 'Installation' }),
-  ).toBeVisible();
-});
๐Ÿ“ Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test('get started link', async ({ page }) => {
await page.goto('https://playwright.dev/');
// Click the get started link.
await page.getByRole('link', { name: 'Get started' }).click();
// Expects page to have a heading with the name of Installation.
await expect(
page.getByRole('heading', { name: 'Installation' }),
).toBeVisible();
});
๐Ÿค– Prompt for AI Agents
In tests/e2e/example.spec.ts around lines 10 to 20, the test navigates to an
external site (playwright.dev) which can cause CI instability; remove or replace
the external-site usage by either deleting the test entirely or changing it to a
local deterministic scenario: use page.setContent(...) or serve a local static
HTML fixture containing the "Get started" link and "Installation" heading, click
the local link, and assert the heading is visible; ensure the test no longer
calls page.goto with an external URL and update any test name/comments
accordingly.

@chamny20 chamny20 added ๐Ÿ˜ˆ chaemin by chaemin โœ… Test code change related with tests cases labels Aug 11, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

๐Ÿงน Nitpick comments (2)
tests/e2e/home.spec.ts (2)

24-31: Rely on auto-waiting assertions and prefer modern locator APIs

The explicit wait followed by toBeVisible is redundant. Playwrightโ€™s expect auto-waits. Also prefer getByText (or getByRole/test IDs) over legacy "text=" selector for stability.

-    await page
-      .locator('text=์‹œ๊ฐ„์„ ๋‹ด๋Š” ์ƒˆ๋กœ์šด ๋ฐฉ๋ฒ•')
-      .first()
-      .waitFor({ state: 'visible' });
-    await expect(
-      page.locator('text=์‹œ๊ฐ„์„ ๋‹ด๋Š” ์ƒˆ๋กœ์šด ๋ฐฉ๋ฒ•').first(),
-    ).toBeVisible();
+    const heroText = page.getByText('์‹œ๊ฐ„์„ ๋‹ด๋Š” ์ƒˆ๋กœ์šด ๋ฐฉ๋ฒ•', { exact: true });
+    await expect(heroText).toBeVisible();

32-33: Prefer role-based selectors (or test IDs) over text-only locators for click targets

Text-only locators are brittle when copy changes or multiple matches exist. Role-based targeting improves resilience and readability.

-    await page.locator('text=ํƒ€์ž„ํ† ์ŠคํŠธ ์‹œ์ž‘ํ•˜๊ธฐ').last().click();
+    // ์—ญํ•  ๊ธฐ๋ฐ˜ ์„ ํƒ์ž ๊ถŒ์žฅ: ์‹ค์ œ ๋งˆํฌ์—…์— ๋งž์ถฐ 'button' ๋˜๋Š” 'link'๋กœ ์กฐ์ •ํ•˜์„ธ์š”.
+    await page.getByRole('button', { name: 'ํƒ€์ž„ํ† ์ŠคํŠธ ์‹œ์ž‘ํ•˜๊ธฐ' }).click();

If this element is a link (), change 'button' to 'link'.

๐Ÿ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 6388d87 and 1fba950.

๐Ÿ“’ Files selected for processing (1)
  • tests/e2e/home.spec.ts (1 hunks)
โฐ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test
๐Ÿ”‡ Additional comments (1)
tests/e2e/home.spec.ts (1)

10-14: LGTM on the title assertion

The smoke assertion is simple and robust. With explicit navigation added, this test should be very reliable across browsers.

Comment on lines +5 to +8
test.beforeEach(async ({ page }) => {
// ๊ธฐ๋ณธ ํ™ˆ ํŽ˜์ด์ง€๋กœ ์ด๋™
await page.goto('/');
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐Ÿ› ๏ธ Refactor suggestion

Avoid navigating in beforeEach; navigate explicitly per test to prevent flakiness and reduce overhead

Preloading the page in beforeEach forces an extra navigation, and can race with token setup/clearing inside individual tests. Itโ€™s safer and faster to navigate explicitly inside each test after youโ€™ve prepared storage state.

Apply this diff to remove the global navigation:

-  test.beforeEach(async ({ page }) => {
-    // ๊ธฐ๋ณธ ํ™ˆ ํŽ˜์ด์ง€๋กœ ์ด๋™
-    await page.goto('/');
-  });

Then add explicit navigation inside each test as shown in the targeted diffs below.

๐Ÿ“ Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test.beforeEach(async ({ page }) => {
// ๊ธฐ๋ณธ ํ™ˆ ํŽ˜์ด์ง€๋กœ ์ด๋™
await page.goto('/');
});
๐Ÿค– Prompt for AI Agents
In tests/e2e/home.spec.ts around lines 5 to 8, remove the global await
page.goto('/') call from the test.beforeEach hook and instead call
page.goto('/') explicitly inside each individual test after any storage/token
setup or clearing is done; update every test in this file to perform its own
navigation at the point it knows the app state is ready to avoid races and extra
navigation overhead.

Comment on lines +10 to +14
test('ํ™ˆ ํŽ˜์ด์ง€๊ฐ€ ์ •์ƒ ๋กœ๋“œ๋˜๊ณ  ํƒ€์ดํ‹€์— TimeToast ํฌํ•จ', async ({
page,
}) => {
await expect(page).toHaveTitle(/TimeToast/i);
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐Ÿ› ๏ธ Refactor suggestion

Add explicit navigation in the smoke test if removing beforeEach

If you remove the global navigation, ensure the smoke test navigates to the homepage first.

   test('ํ™ˆ ํŽ˜์ด์ง€๊ฐ€ ์ •์ƒ ๋กœ๋“œ๋˜๊ณ  ํƒ€์ดํ‹€์— TimeToast ํฌํ•จ', async ({
     page,
   }) => {
+    await page.goto('/');
     await expect(page).toHaveTitle(/TimeToast/i);
   });
๐Ÿ“ Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test('ํ™ˆ ํŽ˜์ด์ง€๊ฐ€ ์ •์ƒ ๋กœ๋“œ๋˜๊ณ  ํƒ€์ดํ‹€์— TimeToast ํฌํ•จ', async ({
page,
}) => {
await expect(page).toHaveTitle(/TimeToast/i);
});
test('ํ™ˆ ํŽ˜์ด์ง€๊ฐ€ ์ •์ƒ ๋กœ๋“œ๋˜๊ณ  ํƒ€์ดํ‹€์— TimeToast ํฌํ•จ', async ({
page,
}) => {
await page.goto('/');
await expect(page).toHaveTitle(/TimeToast/i);
});
๐Ÿค– Prompt for AI Agents
In tests/e2e/home.spec.ts around lines 10 to 14, the test assumes a prior
navigation (removed beforeEach) so it only asserts the title; add an explicit
navigation step at the start of the test by awaiting page.goto('/') (or the
app's base URL) before the expect call so the home page is actually loaded prior
to checking the title.

Comment on lines +17 to +23
await page.evaluate(() => {
sessionStorage.clear();
localStorage.clear();
});

await page.goto('/'); // reload ๋Œ€์‹  goto ๊ถŒ์žฅ

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐Ÿ› ๏ธ Refactor suggestion

Initialize storage state before navigation with addInitScript (more reliable than clearing after load)

Using page.addInitScript ensures storage is set/cleared before any app code runs on first load. This avoids races and eliminates the need for the initial navigation in beforeEach.

-    await page.evaluate(() => {
-      sessionStorage.clear();
-      localStorage.clear();
-    });
-
-    await page.goto('/'); // reload ๋Œ€์‹  goto ๊ถŒ์žฅ
+    await page.addInitScript(() => {
+      sessionStorage.clear();
+      localStorage.clear();
+    });
+    await page.goto('/');
๐Ÿ“ Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await page.evaluate(() => {
sessionStorage.clear();
localStorage.clear();
});
await page.goto('/'); // reload ๋Œ€์‹  goto ๊ถŒ์žฅ
await page.addInitScript(() => {
sessionStorage.clear();
localStorage.clear();
});
await page.goto('/');
๐Ÿค– Prompt for AI Agents
In tests/e2e/home.spec.ts around lines 17 to 23, the test clears
sessionStorage/localStorage via page.evaluate after the page is created which
can race with app code; replace that with page.addInitScript(() => {
sessionStorage.clear(); localStorage.clear(); }); called before any navigation
(e.g., in the beforeEach that creates the page) and then remove the
post-creation page.evaluate and the extra initial goto so storage is reliably
cleared before the app loads.

Comment on lines +38 to +41
await page.evaluate(() => {
sessionStorage.setItem('accessToken', 'dummy-access-token');
localStorage.setItem('refreshToken', 'dummy-refresh-token');
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐Ÿ› ๏ธ Refactor suggestion

Set tokens before first navigation using addInitScript to avoid race conditions

Setting storage via addInitScript guarantees tokens exist before the appโ€™s boot/redirect logic runs. This is more reliable than modifying storage on a loaded page.

-    await page.evaluate(() => {
-      sessionStorage.setItem('accessToken', 'dummy-access-token');
-      localStorage.setItem('refreshToken', 'dummy-refresh-token');
-    });
+    await page.addInitScript(() => {
+      sessionStorage.setItem('accessToken', 'dummy-access-token');
+      localStorage.setItem('refreshToken', 'dummy-refresh-token');
+    });
๐Ÿ“ Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await page.evaluate(() => {
sessionStorage.setItem('accessToken', 'dummy-access-token');
localStorage.setItem('refreshToken', 'dummy-refresh-token');
});
await page.addInitScript(() => {
sessionStorage.setItem('accessToken', 'dummy-access-token');
localStorage.setItem('refreshToken', 'dummy-refresh-token');
});
๐Ÿค– Prompt for AI Agents
In tests/e2e/home.spec.ts around lines 38 to 41, replace the runtime
page.evaluate storage writes with a page.addInitScript that sets
sessionStorage.setItem('accessToken', 'dummy-access-token') and
localStorage.setItem('refreshToken', 'dummy-refresh-token') so the tokens are in
place before the app boot/redirect logic runs; add the addInitScript call before
any page.goto/navigation so the script executes on initial document creation.

Comment on lines +44 to +46
await page.waitForURL(/\/home/, { timeout: 20000 });
await page.waitForLoadState('networkidle');
await expect(page).toHaveURL(/\/home/);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

โš ๏ธ Potential issue

Remove networkidle wait; itโ€™s flaky with SPAs and persistent connections

Waiting for 'networkidle' can hang or be flaky with apps that keep long-lived connections (e.g., Next.js, SSE, WS). Rely on URL assertions with an explicit timeout instead.

-    await page.waitForURL(/\/home/, { timeout: 20000 });
-    await page.waitForLoadState('networkidle');
-    await expect(page).toHaveURL(/\/home/);
+    await expect(page).toHaveURL(/\/home/, { timeout: 20000 });
๐Ÿ“ Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await page.waitForURL(/\/home/, { timeout: 20000 });
await page.waitForLoadState('networkidle');
await expect(page).toHaveURL(/\/home/);
await expect(page).toHaveURL(/\/home/, { timeout: 20000 });
๐Ÿค– Prompt for AI Agents
In tests/e2e/home.spec.ts around lines 44 to 46, remove the flaky await
page.waitForLoadState('networkidle') call; instead rely on the explicit URL
assertion (await page.waitForURL(/\/home/, { timeout: 20000 })) or increase its
timeout and/or add a stable DOM check (await
page.waitForSelector('selector-for-home', { timeout: X })) to ensure the SPA has
reached the expected state without using networkidle; delete the networkidle
line and either keep the existing waitForURL (optionally increase timeout) or
add a short waitForSelector for a deterministic element on the home page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

๐Ÿ˜ˆ chaemin by chaemin โœ… Test code change related with tests cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setting: playwright ํ™˜๊ฒฝ ๊ตฌ์ถ•

1 participant