Skip to content

fix(e2e): run keyword research specs without a DataForSEO API key - #182

Open
BittuBarnwal7479 wants to merge 1 commit into
every-app:mainfrom
BittuBarnwal7479:fix/e2e-run-without-dataforseo-key
Open

fix(e2e): run keyword research specs without a DataForSEO API key#182
BittuBarnwal7479 wants to merge 1 commit into
every-app:mainfrom
BittuBarnwal7479:fix/e2e-run-without-dataforseo-key

Conversation

@BittuBarnwal7479

@BittuBarnwal7479 BittuBarnwal7479 commented Jul 31, 2026

Copy link
Copy Markdown

Problem

The keyword research E2E tests use fixture data when VITE_E2E_KEYWORD_FIXTURES is enabled, so they shouldn't require DataForSEO credentials. However, two code paths still required DATAFORSEO_API_KEY, causing pnpm test:e2e to fail on a fresh checkout.

  1. getSerpAnalysis had no fixture support

    • Unlike researchKeywords, it always called KeywordResearchService.

    • Without DATAFORSEO_API_KEY, the server failed with:

      Missing required environment variable: DATAFORSEO_API_KEY
      
  2. getSeoApiKeyStatus reported the API key as missing

    • Even with fixtures enabled, it returned configured: false.

    • This showed the "One quick setup step / Add your DataForSEO API key" modal.

    • The modal's full-screen overlay blocked Playwright from clicking the page:

      <div ... class="fixed inset-0 z-50 ..."> subtree intercepts pointer events
      
    • All three tests timed out on tab clicks because the modal was covering the page.

Fix

  • Added getSerpAnalysisFixture alongside getKeywordResearchFixture.
  • Updated getSerpAnalysis to use fixture data when E2E fixtures are enabled.
  • Updated getSeoApiKeyStatus to return configured: true when either E2E fixture flag is enabled.

This follows the existing pattern used in serverFunctions/keywords.ts and serverFunctions/domain.ts.

Production behavior is unchanged because the fixture flags are only enabled by playwright.config.ts.

Verification

Ran without DATAFORSEO_API_KEY:

pnpm exec playwright test e2e/keyword-research-navigation.spec.ts

Result:

3 passed (44.7s)

Also verified:

  • pnpm test:ci (768 passed)
  • tsc --noEmit
  • oxlint . --type-aware

Notes for Maintainers

While working on this, I noticed two unrelated issues that I can send as separate PRs:

  1. Windows E2E startup

    • playwright.config.ts uses POSIX-style inline environment variables:

      NODE_OPTIONS= AUTH_MODE=... pnpm exec vite dev
    • This doesn't work in cmd.exe, so pnpm test:e2e cannot start on Windows.

    • Moving these variables into Playwright's env block makes it work cross-platform.

  2. Line endings on Windows

    • The repository has no .gitattributes file.
    • On Windows with core.autocrlf=true, prettier --check reports changes for 811 files, making pnpm ci:check difficult to use locally.
    • Adding a .gitattributes file would keep line endings consistent across platforms.

The keyword research e2e specs opt into fixtures via
VITE_E2E_KEYWORD_FIXTURES, but two paths still depended on real
credentials, so `pnpm test:e2e` failed on any checkout without a
DataForSEO key:

- `getSerpAnalysis` had no fixture branch and called DataForSEO live,
  throwing "Missing required environment variable".
- `getSeoApiKeyStatus` reported the key as unconfigured, which raised
  the blocking "add your API key" modal. Its full-screen overlay
  intercepted every click, so all three specs timed out on tab
  interactions rather than on the behaviour under test.

Add a SERP fixture alongside the existing keyword research one and
short-circuit the key-status check in fixture mode, matching the
pattern already used in serverFunctions/keywords.ts and domain.ts.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant