fix(e2e): run keyword research specs without a DataForSEO API key - #182
Open
BittuBarnwal7479 wants to merge 1 commit into
Open
fix(e2e): run keyword research specs without a DataForSEO API key#182BittuBarnwal7479 wants to merge 1 commit into
BittuBarnwal7479 wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The keyword research E2E tests use fixture data when
VITE_E2E_KEYWORD_FIXTURESis enabled, so they shouldn't require DataForSEO credentials. However, two code paths still requiredDATAFORSEO_API_KEY, causingpnpm test:e2eto fail on a fresh checkout.getSerpAnalysishad no fixture supportUnlike
researchKeywords, it always calledKeywordResearchService.Without
DATAFORSEO_API_KEY, the server failed with:getSeoApiKeyStatusreported the API key as missingEven 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:
All three tests timed out on tab clicks because the modal was covering the page.
Fix
getSerpAnalysisFixturealongsidegetKeywordResearchFixture.getSerpAnalysisto use fixture data when E2E fixtures are enabled.getSeoApiKeyStatusto returnconfigured: truewhen either E2E fixture flag is enabled.This follows the existing pattern used in
serverFunctions/keywords.tsandserverFunctions/domain.ts.Production behavior is unchanged because the fixture flags are only enabled by
playwright.config.ts.Verification
Ran without
DATAFORSEO_API_KEY:Result:
Also verified:
pnpm test:ci(768 passed)tsc --noEmitoxlint . --type-awareNotes for Maintainers
While working on this, I noticed two unrelated issues that I can send as separate PRs:
Windows E2E startup
playwright.config.tsuses POSIX-style inline environment variables:NODE_OPTIONS= AUTH_MODE=... pnpm exec vite devThis doesn't work in
cmd.exe, sopnpm test:e2ecannot start on Windows.Moving these variables into Playwright's
envblock makes it work cross-platform.Line endings on Windows
.gitattributesfile.core.autocrlf=true,prettier --checkreports changes for 811 files, makingpnpm ci:checkdifficult to use locally..gitattributesfile would keep line endings consistent across platforms.