Skip to content

Upload Electron E2E failure artifacts#533

Open
yusufm wants to merge 3 commits intosiddharthvaddem:mainfrom
yusufm:codex/e2e-artifacts
Open

Upload Electron E2E failure artifacts#533
yusufm wants to merge 3 commits intosiddharthvaddem:mainfrom
yusufm:codex/e2e-artifacts

Conversation

@yusufm
Copy link
Copy Markdown
Contributor

@yusufm yusufm commented May 3, 2026

Summary

  • add an Electron E2E CI job for the Playwright app test
  • upload Playwright test-results and report artifacts when Electron E2E fails
  • make Electron app shutdown deterministic in the GIF E2E test
  • fix the linted hook dependency used by CI

Testing

  • npm run lint
  • npm run build-vite
  • npm run test:e2e
  • npm run test:browser

Summary by CodeRabbit

  • Chores

    • CI now builds the app and runs Electron end-to-end tests for improved release reliability; test artifacts are uploaded on failures.
  • Bug Fixes

    • Improved error handling to reliably hide the countdown overlay during cleanup.
  • Tests

    • Stabilized end-to-end tests with deterministic Electron process shutdown and more reliable test result collection.

@yusufm yusufm requested a review from siddharthvaddem as a code owner May 3, 2026 21:17
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 009bbeb1-2625-4d7b-8cf7-9b7d6ca04ab9

📥 Commits

Reviewing files that changed from the base of the PR and between 5bed560 and 8fcdc4f.

📒 Files selected for processing (1)
  • tests/e2e/gif-export.spec.ts
✅ Files skipped from review due to trivial changes (1)
  • tests/e2e/gif-export.spec.ts

📝 Walkthrough

Walkthrough

Adds CI jobs: a build job that runs npx vite build and an electron-e2e job that installs Playwright, builds the app, runs Electron E2E tests under xvfb, and uploads Playwright artifacts on failure. Memoizes cleanup helper in useScreenRecorder and makes E2E tests deterministically shut down the Electron process.

Changes

E2E Testing Infrastructure

Layer / File(s) Summary
CI Jobs
.github/workflows/ci.yml
Adds build job (runs npm ci then npx vite build) and an electron-e2e job that installs Playwright (with system deps), runs npm run build-vite, installs browsers (npx playwright install --with-deps), executes E2E via xvfb-run -a npm run test:e2e, and uploads test-results/ and playwright-report/ on failure.
Test Helpers
tests/e2e/gif-export.spec.ts
Adds waitForProcessExit(child, timeoutMs) and closeElectronApp(app) helpers that await the Electron child process exit (with timeout) and SIGKILL fallback. Replaces await app.close() with await closeElectronApp(app) in finally for deterministic shutdown.

Hook Cleanup Refactoring

Layer / File(s) Summary
Memoized Cleanup
src/hooks/useScreenRecorder.ts
Introduces safeHideCountdownOverlay as a useCallback that calls window.electronAPI.hideCountdownOverlay(runId) inside try/catch and logs a warning on failure; updated useEffect cleanup to call the memoized helper using countdownRunId.current and added it to dependencies.
Tidy
src/hooks/useScreenRecorder.ts
Removes the previous non-memoized safeHideCountdownOverlay definition.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • siddharthvaddem

Poem

at 2am the CI hums and pipes the light,
playwright runs headless while xvfb holds tight,
callbacks get memoized, cleanup says “i’ll try”,
a stubborn child process gets a gentle SIGKILL goodbye,
tests sleep easier now — lowkey less cursed, more right.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly summarizes the main change—uploading Electron E2E failure artifacts—which aligns with the primary CI/workflow update and artifact upload feature.
Description check ✅ Passed Description covers key changes (E2E CI job, artifact uploads, deterministic shutdown, hook dependencies) and testing approach; aligns with template expectations for purpose and testing validation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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
Review rate limit: 5/8 reviews remaining, refill in 22 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/e2e/gif-export.spec.ts`:
- Around line 12-21: In waitForProcessExit (the async function using child:
ReturnType<ElectronApplication["process"]>) remove all checks of child.killed
and only treat child.exitCode !== null as the indicator the process has exited;
implement proper listener/timeout cleanup by registering concrete handlers
(e.g., onExit and onTimeout), using clearTimeout and child.removeListener in the
Promise.race resolution so no dangling listeners remain. Also update the SIGKILL
logic that currently gates on !child.killed (the guard around the kill attempt
referenced near the SIGKILL call) to instead check that child.exitCode === null
before sending SIGKILL so you always attempt to kill processes that haven't
actually exited.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0157bcfd-4958-4417-9beb-0925159ec055

📥 Commits

Reviewing files that changed from the base of the PR and between 7e00cdb and 760794d.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • src/hooks/useScreenRecorder.ts
  • tests/e2e/gif-export.spec.ts

Comment thread tests/e2e/gif-export.spec.ts Outdated
Copy link
Copy Markdown
Contributor

@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.

🧹 Nitpick comments (1)
tests/e2e/gif-export.spec.ts (1)

12-50: ⚡ Quick win

Make the timeout distinguishable from a clean exit.

Lowkey risky: waitForProcessExit() resolves on timeout exactly the same way it resolves after an actual exit, so closeElectronApp() can't tell whether Electron shut down or we just gave up and moved on. That can mask a stuck process and leave CI in a weird state.

Consider returning a boolean or throwing when the forced-kill path still doesn't observe exit.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/e2e/gif-export.spec.ts` around lines 12 - 50, waitForProcessExit
currently resolves both on real process exit and on timeout indistinguishably;
change waitForProcessExit to return a boolean (true = observed exit before
timeout, false = timed out) or to throw on timeout so callers can react. Update
waitForProcessExit's internal promise to resolve(false) on the onTimeout path
and resolve(true) on the onExit/finish path (or reject with an Error on
timeout), and then update closeElectronApp to check the boolean/try-catch the
rejection: if waitForProcessExit indicates a timeout, attempt
child.kill("SIGKILL") and then throw if the second waitForProcessExit also fails
(or propagate the timeout error) so stuck processes are surfaced instead of
silently continuing; reference waitForProcessExit, closeElectronApp,
child.exitCode, setTimeout, and child.kill in your changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/e2e/gif-export.spec.ts`:
- Around line 12-50: waitForProcessExit currently resolves both on real process
exit and on timeout indistinguishably; change waitForProcessExit to return a
boolean (true = observed exit before timeout, false = timed out) or to throw on
timeout so callers can react. Update waitForProcessExit's internal promise to
resolve(false) on the onTimeout path and resolve(true) on the onExit/finish path
(or reject with an Error on timeout), and then update closeElectronApp to check
the boolean/try-catch the rejection: if waitForProcessExit indicates a timeout,
attempt child.kill("SIGKILL") and then throw if the second waitForProcessExit
also fails (or propagate the timeout error) so stuck processes are surfaced
instead of silently continuing; reference waitForProcessExit, closeElectronApp,
child.exitCode, setTimeout, and child.kill in your changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1e489961-5438-4992-b85d-231c9a676898

📥 Commits

Reviewing files that changed from the base of the PR and between 760794d and 5bed560.

📒 Files selected for processing (1)
  • tests/e2e/gif-export.spec.ts

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