chore: setup testing frameworks #19

Merged
Pertempto merged 8 commits from claude/setup-testing-framework-01P3F7RUyGNimJM32YiSAGxm into main 2025-11-15 11:33:51 -05:00
Pertempto commented 2025-11-15 10:44:33 -05:00 (Migrated from github.com)
No description provided.
cloudflare-workers-and-pages[bot] commented 2025-11-15 10:44:41 -05:00 (Migrated from github.com)

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
Deployment successful!
View logs
market 1f75271b Commit Preview URL

Branch Preview URL
Nov 15 2025, 04:31 PM
## Deploying with &nbsp;<a href="https://workers.dev"><img alt="Cloudflare Workers" src="https://workers.cloudflare.com/logo.svg" width="16"></a> &nbsp;Cloudflare Workers The latest updates on your project. Learn more about [integrating Git with Workers](https://developers.cloudflare.com/workers/ci-cd/builds/git-integration/). | Status | Name | Latest Commit | Preview URL | Updated (UTC) | | -|-|-|-|-| | ✅ Deployment successful! <br>[View logs](https://dash.cloudflare.com/?to=/ef1b3f6f45e7d16874284a2637bec85b/workers/services/view/market/production/builds/3ff188c7-713e-45a7-9f65-95d549fa0463) | market | 1f75271b | <a href='https://f042c514-market.kwila-cloud.workers.dev'>Commit Preview URL</a><br><br><a href='https://claude-setup-testing-framework-01p3f7ruygnimjm32yisagxm-market.kwila-cloud.workers.dev'>Branch Preview URL</a> | Nov 15 2025, 04:31 PM |
github-actions[bot] commented 2025-11-15 10:47:38 -05:00 (Migrated from github.com)

Changes Requested

Please address the following before merging:

  • .github/workflows/ci.yml: Make Playwright installation robust

    • Run npx playwright install-deps (system packages) unconditionally as its own step before E2E tests.
    • Install browser binaries only when cache miss using e.g. npx playwright install --with-deps chromium firefox webkit (keep the cache step).
    • Ensure the cache path (~/.cache/ms-playwright) + key are correct so browser downloads are cached.
  • playwright.config.ts: CI stability improvements

    • Increase webServer.timeout from 120000 to at least 180000 (300000 recommended for slow runners).
    • Add CI-friendly launch args under use (e.g. launchOptions: { args: ['--no-sandbox', '--disable-dev-shm-usage'] }) to reduce sandbox/runner failures.
  • E2E test robustness (tests/e2e/theme-selector.spec.ts / src/components/react/ThemeSelector.tsx)

    • Add a stable test attribute to the ThemeSelector trigger (e.g. data-testid="theme-selector-button") and use that in tests instead of relying on the exact accessible name Select theme.
    • Confirm the ThemeSelector actually renders on the route used in tests (/) or update page.goto() to the correct page where the component exists.
    • Verify the dropdown uses expected roles (role="menu" / role="menuitem") or update tests to select by stable attributes.

Summary of Changes

  • Added CI jobs: unit-tests and e2e-tests in .github/workflows/ci.yml.
  • Added Playwright config: playwright.config.ts with multi-browser projects, HTML reporter (playwright-report), and webServer settings.
  • Added Vitest config: vitest.config.ts and test setup tests/setup.ts.
  • Added E2E tests tests/e2e/theme-selector.spec.ts and unit tests tests/unit/* for theme manager and themes.
  • Updated package.json scripts and devDependencies to include Vitest, Playwright, testing-library, and related tooling.
  • Small UI tweaks: src/pages/ui-preview.astro heading class changes and ThemeSelector.tsx backdrop data-testid added.

Overall Feedback

Negative:

  • The CI E2E flow is likely to be flaky as written because the Playwright install logic and web server timeout are not CI-friendly. The install-deps step is currently conditional in a way that can leave runners without required system libraries, and the webServer.timeout is low for slower runners.
  • E2E tests are brittle: they depend on exact accessible copy and on the component being present at /. That will lead to false negatives as UI copy or routes change.

Positive:

  • The test scaffolding is thorough and well-structured. Splitting unit and E2E, adding playwright.config.ts and vitest.config.ts, and providing focused tests for the theme system is excellent work and will significantly improve confidence once the CI flow is hardened. Great job! 🚀

@Pertempto — after you push the CI install/deps fix and add a stable test selector (or update the tests to use it), I will re-run the review focused on remaining flakiness.

# Changes Requested Please address the following before merging: - `.github/workflows/ci.yml`: Make Playwright installation robust - Run `npx playwright install-deps` (system packages) unconditionally as its own step before E2E tests. - Install browser binaries only when cache miss using e.g. `npx playwright install --with-deps chromium firefox webkit` (keep the cache step). - Ensure the cache path (`~/.cache/ms-playwright`) + key are correct so browser downloads are cached. - `playwright.config.ts`: CI stability improvements - Increase `webServer.timeout` from `120000` to at least `180000` (300000 recommended for slow runners). - Add CI-friendly launch args under `use` (e.g. `launchOptions: { args: ['--no-sandbox', '--disable-dev-shm-usage'] }`) to reduce sandbox/runner failures. - E2E test robustness (`tests/e2e/theme-selector.spec.ts` / `src/components/react/ThemeSelector.tsx`) - Add a stable test attribute to the ThemeSelector trigger (e.g. `data-testid="theme-selector-button"`) and use that in tests instead of relying on the exact accessible name `Select theme`. - Confirm the ThemeSelector actually renders on the route used in tests (`/`) or update `page.goto()` to the correct page where the component exists. - Verify the dropdown uses expected roles (`role="menu"` / `role="menuitem"`) or update tests to select by stable attributes. ## Summary of Changes - Added CI jobs: `unit-tests` and `e2e-tests` in `.github/workflows/ci.yml`. - Added Playwright config: `playwright.config.ts` with multi-browser projects, HTML reporter (`playwright-report`), and webServer settings. - Added Vitest config: `vitest.config.ts` and test setup `tests/setup.ts`. - Added E2E tests `tests/e2e/theme-selector.spec.ts` and unit tests `tests/unit/*` for theme manager and themes. - Updated `package.json` scripts and devDependencies to include Vitest, Playwright, testing-library, and related tooling. - Small UI tweaks: `src/pages/ui-preview.astro` heading class changes and `ThemeSelector.tsx` backdrop `data-testid` added. ## Overall Feedback Negative: - The CI E2E flow is likely to be flaky as written because the Playwright install logic and web server timeout are not CI-friendly. The install-deps step is currently conditional in a way that can leave runners without required system libraries, and the `webServer.timeout` is low for slower runners. - E2E tests are brittle: they depend on exact accessible copy and on the component being present at `/`. That will lead to false negatives as UI copy or routes change. Positive: - The test scaffolding is thorough and well-structured. Splitting unit and E2E, adding `playwright.config.ts` and `vitest.config.ts`, and providing focused tests for the theme system is excellent work and will significantly improve confidence once the CI flow is hardened. Great job! 🚀 @Pertempto — after you push the CI install/deps fix and add a stable test selector (or update the tests to use it), I will re-run the review focused on remaining flakiness.
github-actions[bot] commented 2025-11-15 11:25:56 -05:00 (Migrated from github.com)

File: .github/workflows/ci.yml

  • Install step currently uses npx playwright install --with-deps (good), but be explicit about the browsers you expect to run in CI so it's robust if config changes. Replace with or add an explicit install:
    npx playwright install --with-deps chromium firefox webkit

  • Consider caching Playwright browser downloads to speed CI. Example cache step (insert before Install Playwright browsers):

    - name: Cache Playwright browsers
      uses: actions/cache@v4
      with:
        path: ~/.cache/ms-playwright
        key: playwright-browsers-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
    
  • Confirm the artifact upload path playwright-report/ matches the Playwright reporter output folder in playwright.config.ts. If you rely on the default HTML reporter, make the reporter explicit in the config: [['html', { outputFolder: 'playwright-report' }]] so the artifact step always finds the report.

File: `.github/workflows/ci.yml` - Install step currently uses `npx playwright install --with-deps` (good), but be explicit about the browsers you expect to run in CI so it's robust if config changes. Replace with or add an explicit install: `npx playwright install --with-deps chromium firefox webkit` - Consider caching Playwright browser downloads to speed CI. Example cache step (insert before `Install Playwright browsers`): ```yaml - name: Cache Playwright browsers uses: actions/cache@v4 with: path: ~/.cache/ms-playwright key: playwright-browsers-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} ``` - Confirm the artifact upload path `playwright-report/` matches the Playwright `reporter` output folder in `playwright.config.ts`. If you rely on the default HTML reporter, make the reporter explicit in the config: `[['html', { outputFolder: 'playwright-report' }]]` so the artifact step always finds the report.
github-actions[bot] commented 2025-11-15 11:31:19 -05:00 (Migrated from github.com)

tests/e2e/theme-selector.spec.ts — tests depend on getByRole('button', { name: 'Select theme' }). That label is brittle and will break if copy or i18n changes. Please either:

  • Add a stable attribute on the ThemeSelector button (e.g. data-testid="theme-selector-button") and update tests to use getByTestId, or
  • Keep the accessible name but add a comment in the component explaining it’s relied on by tests.

Adding a testid is the safest short-term fix.

`tests/e2e/theme-selector.spec.ts` — tests depend on `getByRole('button', { name: 'Select theme' })`. That label is brittle and will break if copy or i18n changes. Please either: - Add a stable attribute on the ThemeSelector button (e.g. `data-testid="theme-selector-button"`) and update tests to use `getByTestId`, or - Keep the accessible name but add a comment in the component explaining it’s relied on by tests. Adding a testid is the safest short-term fix.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kwila/market!19
No description provided.