Skip to content

chore: reduce ux conflicts with toasts in playwright#6367

Merged
bijin-bruno merged 1 commit intomainfrom
feat/dev-toast-duration
Dec 9, 2025
Merged

chore: reduce ux conflicts with toasts in playwright#6367
bijin-bruno merged 1 commit intomainfrom
feat/dev-toast-duration

Conversation

@bijin-bruno
Copy link
Collaborator

@bijin-bruno bijin-bruno commented Dec 9, 2025

Description

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • Chores
    • Added environment detection mechanism with modified notification timing configurations for different runtime contexts.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 9, 2025

Walkthrough

Implements Playwright environment detection by setting a PLAYWRIGHT environment variable when launching Electron, exposing it via preload bridge, and consuming it to adjust toast notification duration to 500ms (versus 2000ms) during tests.

Changes

Cohort / File(s) Summary
Playwright Environment Detection
playwright/index.ts,
packages/bruno-electron/src/preload.js,
packages/bruno-app/src/utils/common/index.js,
packages/bruno-app/src/providers/Toaster/index.js
Adds PLAYWRIGHT environment variable to Electron launch; exposes it globally via contextBridge; creates isPlaywright() utility function to detect Playwright context; conditionally sets toast duration to 500ms in Playwright environment, 2000ms otherwise.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify PLAYWRIGHT environment variable properly propagates through the Electron launch process
  • Confirm isPlaywright() safely handles cases where window.isPlaywright may be undefined
  • Validate that 500ms toast duration is appropriate and doesn't impact test reliability

Poem

🎭 A playwright takes the stage with flags held high,
Notifications now dart—no time to comply,
Context bridges gleam, detection flows true,
Five hundred milliseconds for tests shiny new! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main objective: reducing toast duration conflicts in Playwright tests by implementing context detection.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/dev-toast-duration

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cf4c896 and cddb78c.

📒 Files selected for processing (4)
  • packages/bruno-app/src/providers/Toaster/index.js (1 hunks)
  • packages/bruno-app/src/utils/common/index.js (1 hunks)
  • packages/bruno-electron/src/preload.js (1 hunks)
  • playwright/index.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • playwright/index.ts
  • packages/bruno-app/src/utils/common/index.js
  • packages/bruno-app/src/providers/Toaster/index.js
  • packages/bruno-electron/src/preload.js
🧠 Learnings (1)
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.{jsx,tsx} : Use styled component's theme prop to manage CSS colors and not CSS variables when in the context of a styled component or any React component using the styled component

Applied to files:

  • packages/bruno-app/src/providers/Toaster/index.js
🧬 Code graph analysis (1)
packages/bruno-app/src/providers/Toaster/index.js (1)
packages/bruno-app/src/utils/common/index.js (2)
  • isPlaywright (8-10)
  • isPlaywright (8-10)
⏰ 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). (6)
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: CLI Tests
  • GitHub Check: Unit Tests
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: SSL Tests - Linux
🔇 Additional comments (5)
packages/bruno-app/src/providers/Toaster/index.js (2)

4-4: LGTM!

The import is clean and follows the project's style guidelines.


12-12: Verify the 500ms duration is sufficient for test stability.

The conditional logic correctly reduces toast duration during Playwright tests. However, ensure that 500ms provides adequate time for tests to interact with or dismiss toasts without causing flakiness.

If you've already validated this timing through test runs, no action is needed.

packages/bruno-app/src/utils/common/index.js (1)

8-10: LGTM!

The implementation is safe and defensive, properly checking for window existence before accessing window.isPlaywright. The strict equality check ensures type safety.

playwright/index.ts (1)

93-93: LGTM!

The environment variable is correctly set and aligns with the detection logic in preload.js. The implementation is consistent with existing environment variable patterns in this file.

packages/bruno-electron/src/preload.js (1)

3-3: LGTM!

Properly uses contextBridge to securely expose the Playwright flag to the renderer process. The strict equality check ensures the boolean value is correctly derived from the environment variable.


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

@github-actions
Copy link

github-actions bot commented Dec 9, 2025

CLI Test Results

  1 files  ±0  140 suites  ±0   56s ⏱️ -12s
235 tests ±0  235 ✅ ±0  0 💤 ±0  0 ❌ ±0 
301 runs  ±0  300 ✅ ±0  1 💤 ±0  0 ❌ ±0 

Results for commit cddb78c. ± Comparison against base commit cf4c896.

@bijin-bruno bijin-bruno merged commit 4d1c3f9 into main Dec 9, 2025
9 checks passed
@bijin-bruno bijin-bruno deleted the feat/dev-toast-duration branch December 12, 2025 06:04
@coderabbitai coderabbitai bot mentioned this pull request Jan 2, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant