Skip to content

fix(e2e): fix themes_management test selectors for theme name inputs#2728

Merged
wwwillchen merged 1 commit intomainfrom
agent--1771112167838-1771111341
Feb 15, 2026
Merged

fix(e2e): fix themes_management test selectors for theme name inputs#2728
wwwillchen merged 1 commit intomainfrom
agent--1771112167838-1771111341

Conversation

@wwwillchen-bot
Copy link
Copy Markdown
Collaborator

@wwwillchen-bot wwwillchen-bot commented Feb 14, 2026

Summary

  • Fixed ambiguous getByLabel("Theme Name") selectors in themes management E2E tests
  • Used specific element IDs (#manual-name, #ai-name) for create dialogs where multiple matching inputs exist
  • Scoped edit dialog selectors to the dialog context to avoid matching create form inputs

Test plan

  • Run the themes_management E2E tests: npx playwright test e2e-tests/themes_management.spec.ts
  • Verify all theme CRUD operations, chat input creation, and AI generator flows pass

πŸ€– Generated with Claude Code


Open with Devin

Use specific element IDs (#manual-name, #ai-name) instead of ambiguous
getByLabel("Theme Name") selectors. Also scope edit dialog selectors
to the dialog context to avoid matching create form inputs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@wwwillchen
Copy link
Copy Markdown
Collaborator

@BugBot run

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @wwwillchen-bot, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness of the themes management end-to-end tests by refining the Playwright selectors used for theme name input fields. The changes ensure that tests accurately target the intended elements, particularly in scenarios involving multiple dialogs or forms with similar labels, thereby preventing flakiness and improving test stability.

Highlights

  • E2E Test Selector Fixes: Addressed ambiguous getByLabel("Theme Name") selectors in the themes management E2E tests to improve reliability.
  • Specific Element IDs for Create Dialogs: Implemented specific element IDs (#manual-name, #ai-name) for theme name inputs within create dialogs where multiple matching inputs previously existed.
  • Scoped Selectors for Edit Dialogs: Scoped selectors for the edit theme dialog to the dialog context, preventing unintended matches with create form inputs.
Changelog
  • e2e-tests/themes_management.spec.ts
    • Updated theme name input selector from getByLabel("Theme Name") to locator("#manual-name") for manual configuration.
    • Modified theme name input selector for edit dialogs to be scoped within the dialog using getByRole("dialog").getByLabel("Theme Name").
    • Changed theme name input selector from getByLabel("Theme Name") to locator("#ai-name") for AI generator flows.
Activity
  • The pull request was created by wwwillchen-bot to fix E2E test selectors. No human activity has occurred yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with πŸ‘ and πŸ‘Ž on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively addresses the issue of ambiguous selectors in the themes management E2E tests by replacing getByLabel("Theme Name") with more specific ID-based locators or by scoping the selector to a dialog. The changes improve the robustness of the tests. The suggestion to further improve conciseness and consistency of one of the updated selectors has been retained.

Comment on lines +57 to +61
await po.page.getByRole("dialog").getByLabel("Theme Name").clear();
await po.page
.getByRole("dialog")
.getByLabel("Theme Name")
.fill("Updated Theme");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The .fill() method in Playwright already clears the input field before filling it, so the .clear() call is redundant.

Also, instead of scoping by dialog and then selecting by label, you can use the unique ID #edit-theme-name for this input. This is more direct and consistent with the other selector changes in this PR (e.g., #manual-name, #ai-name).

Suggested change
await po.page.getByRole("dialog").getByLabel("Theme Name").clear();
await po.page
.getByRole("dialog")
.getByLabel("Theme Name")
.fill("Updated Theme");
await po.page.locator("#edit-theme-name").fill("Updated Theme");

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 14, 2026

Greptile Overview

Greptile Summary

Fixed ambiguous getByLabel("Theme Name") selectors that could match multiple inputs when both create and edit dialogs are present. Uses specific element IDs (#manual-name, #ai-name) for create dialog tabs and scopes edit dialog selectors to dialog context.

Confidence Score: 4/5

  • Safe to merge with minor inconsistency in selector scoping
  • The changes correctly fix ambiguous selectors that could cause test flakiness. Element IDs are verified in the UI components. Minor style issue with inconsistent dialog scoping for edit dialog fields doesn't affect test functionality.
  • No files require special attention

Important Files Changed

Filename Overview
e2e-tests/themes_management.spec.ts Fixed ambiguous selectors by using specific IDs for create dialogs and scoping edit dialog selectors, though edit dialog scoping is inconsistent

Last reviewed commit: 92ac37c

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

Comment on lines 32 to 33
.getByLabel("Description (optional)")
.fill("A test theme description");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟑 Incomplete fix: getByLabel("Description (optional)") has the same ambiguity as the fixed getByLabel("Theme Name")

The PR fixes the ambiguous getByLabel("Theme Name") selector by switching to #manual-name / #ai-name IDs because both tab panels (AI and Manual) render inputs with the same label in the Create dialog. However, the getByLabel("Description (optional)") selector was not similarly fixed, even though it has the exact same ambiguity β€” both AIGeneratorTab.tsx:338 (<Label htmlFor="ai-description">Description (optional)</Label>) and CustomThemeDialog.tsx:163 (<Label htmlFor="manual-description">Description (optional)</Label>) are present in the DOM simultaneously.

Root Cause

Base UI's TabsPrimitive.Panel keeps inactive tab content mounted in the DOM (with a hidden attribute) by default. This is exactly why the PR needed to fix getByLabel("Theme Name") β€” both the AI and Manual tab panels are in the DOM at the same time.

The same situation applies to "Description (optional)":

  • AIGeneratorTab.tsx:338-344: <Label htmlFor="ai-description">Description (optional)</Label> + <Input id="ai-description" ...>
  • CustomThemeDialog.tsx:163-169: <Label htmlFor="manual-description">Description (optional)</Label> + <Input id="manual-description" ...>

Playwright's getByLabel() matches both inputs, causing a strict-mode violation when .fill() is called. This affects four locations in the test file:

  • Line 32 (CRUD create, Manual tab)
  • Line 130 (chat input create, Manual tab)
  • Line 244 (AI generator flow, AI tab)
  • Line 314 (AI generator URL flow, AI tab)

Each should use #manual-description or #ai-description respectively, matching the fix pattern used for the name inputs.

Prompt for agents
Fix the ambiguous getByLabel("Description (optional)") selectors in all four locations in e2e-tests/themes_management.spec.ts, using the same ID-based approach as the Theme Name fix:

1. Line 32: Change `po.page.getByLabel("Description (optional)")` to `po.page.locator("#manual-description")` (CRUD test, Manual tab)
2. Line 130: Change `po.page.getByLabel("Description (optional)")` to `po.page.locator("#manual-description")` (chat input test, Manual tab)
3. Line 244: Change `po.page.getByLabel("Description (optional)")` to `po.page.locator("#ai-description")` (AI generator flow, AI tab)
4. Line 314: Change `po.page.getByLabel("Description (optional)")` to `po.page.locator("#ai-description")` (AI generator URL flow, AI tab)

The Edit dialog selectors (line 63) are fine because the Create dialog is closed when the Edit dialog is open.
Open in Devin Review

Was this helpful? React with πŸ‘ or πŸ‘Ž to provide feedback.

@github-actions
Copy link
Copy Markdown
Contributor

πŸ” Dyadbot Code Review Summary

Verdict: βœ… YES - Ready to merge

Reviewed by 3 independent agents: Correctness Expert, Code Health Expert, UX Wizard.

Issues Summary

No HIGH or MEDIUM issues found.

🟒 Low Priority Notes (1 item)
  • Inconsistent dialog scoping in edit test - e2e-tests/themes_management.spec.ts:62-66 - Lines 57-61 correctly scope "Theme Name" to getByRole("dialog"), but "Description (optional)" and "Theme Prompt" on lines 62-66 are not scoped to the dialog. While this works (only one dialog is open at a time), it's inconsistent with the pattern this PR establishes.
🚫 Dropped False Positives (1 item)
  • Non-unique accessible labels across dialogs - Dropped: This is a pre-existing accessibility concern in application component code, not in the test code modified by this PR. Out of scope.

Generated by Dyadbot multi-agent code review

@github-actions github-actions bot added the needs-human:review-issue ai agent flagged an issue that requires human review label Feb 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

❌ Some tests failed

OS Passed Failed Flaky Skipped
🍎 macOS 231 2 9 6

Summary: 231 passed, 2 failed, 9 flaky, 6 skipped

Failed Tests

🍎 macOS

  • github-import.spec.ts > should allow empty commands to use defaults
    • Error: expect(locator).toBeEnabled() failed
  • template-create-nextjs.spec.ts > create next.js app
    • Error: expect(locator).toBeVisible() failed

πŸ“‹ Re-run Failing Tests (macOS)

Copy and paste to re-run all failing spec files locally:

npm run e2e \
  e2e-tests/github-import.spec.ts \
  e2e-tests/template-create-nextjs.spec.ts

⚠️ Flaky Tests

🍎 macOS

  • approve.spec.ts > write to index, approve, check preview (passed after 1 retry)
  • fix_error.spec.ts > fix error with AI (passed after 1 retry)
  • import.spec.ts > advanced options: both cleared are valid and use defaults (passed after 1 retry)
  • plan_mode.spec.ts > plan mode - accept plan redirects to new chat and saves to disk (passed after 1 retry)
  • refresh.spec.ts > refresh preserves current route (passed after 1 retry)
  • select_component.spec.ts > deselect individual component from multiple (passed after 1 retry)
  • select_component.spec.ts > select component next.js (passed after 1 retry)
  • setup_flow.spec.ts > Setup Flow > setup banner shows correct state when node.js is installed (passed after 1 retry)
  • setup_flow.spec.ts > Setup Flow > node.js install flow (passed after 1 retry)

πŸ“Š View full report

@wwwillchen wwwillchen merged commit 8f9e535 into main Feb 15, 2026
12 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-human:review-issue ai agent flagged an issue that requires human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants