Skip to content

fix(e2e): address Copilot review comments from PR #7768#7775

Merged
clubanderson merged 1 commit intomainfrom
fix/e2e-copilot-review-comments
Apr 14, 2026
Merged

fix(e2e): address Copilot review comments from PR #7768#7775
clubanderson merged 1 commit intomainfrom
fix/e2e-copilot-review-comments

Conversation

@clubanderson
Copy link
Copy Markdown
Collaborator

Summary

Follow-up to PR #7768 to address 4 Copilot review comments that were flagged after merge.

Changes

1. Remove unused import (find-and-search.spec.ts)

collectConsoleErrors was imported but not used after PR #7768 changes. Removed to fix TypeScript/ESLint no-unused-vars.

2. Fix keyboard shortcut test (find-and-search.spec.ts)

The keyboard shortcut test was checking global-search-input.isVisible() to determine if Ctrl/Meta+K worked, but that input is always visible in the navbar. Updated to check global-search-results (the dropdown panel) instead — this correctly reflects whether the shortcut activated search.

3. Fix Escape-closes-search test (keyboard-navigation.spec.ts)

Same root cause — the test checked expect(searchInput).not.toBeVisible() after Escape, which always passes since the input is always visible. Updated to check global-search-results for both open/close detection.

4. Narrow CORS allowlist regex (ux-assertions.ts)

The /Access-Control-Allow-Origin/i pattern was too broad and would mask unrelated issues mentioning that header. Replaced with three specific patterns matching only known demo/local origins: localhost, 127.0.0.1, and kubestellar.io.

Test plan

  • Build passes (npm run build)
  • E2E tests run (Playwright; non-blocking)

Fixes #7772

Four issues flagged in post-merge review:

1. find-and-search.spec.ts: remove unused collectConsoleErrors import
   (causes TypeScript/ESLint no-unused-vars)

2. find-and-search.spec.ts: keyboard shortcut test now validates the
   search results dropdown (global-search-results) instead of the
   navbar input (global-search-input), which is always visible and
   gave a false pass regardless of Ctrl/Meta+K behavior

3. keyboard-navigation.spec.ts: same fix — Escape-closes-search test
   now checks that global-search-results becomes hidden after Escape
   instead of the always-visible search input

4. ux-assertions.ts: narrow the /Access-Control-Allow-Origin/i allowlist
   pattern to only match known demo/local origins (localhost, 127.0.0.1,
   kubestellar.io) to avoid masking unrelated CORS issues

Fixes #7772

Signed-off-by: Andy Anderson <[email protected]>
@clubanderson clubanderson added the ai-generated Pull request generated by AI label Apr 13, 2026
Copilot AI review requested due to automatic review settings April 13, 2026 20:52
@clubanderson clubanderson added the ai-generated Pull request generated by AI label Apr 13, 2026
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Apr 13, 2026
@kubestellar-prow
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 13, 2026

Deploy Preview for kubestellarconsole ready!

Name Link
🔨 Latest commit 1fb9df6
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/69dd5798c8a7c30008500c67
😎 Deploy Preview https://deploy-preview-7775.console-deploy-preview.kubestellar.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Copy Markdown
Contributor

👋 Hey @clubanderson — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 13, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Follow-up to PR #7768 to address Copilot review feedback by cleaning up E2E tests around global search keyboard interactions and tightening console-error allowlist regexes used in Playwright UX assertions.

Changes:

  • Remove an unused collectConsoleErrors import in find-and-search.spec.ts.
  • Update global search keyboard/Escape E2E checks to use global-search-results instead of the always-visible navbar input.
  • Narrow the console-error allowlist regex for Access-Control-Allow-Origin in ux-assertions.ts to known demo/local origins.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
web/e2e/user-flows/keyboard-navigation.spec.ts Changes how the “Escape closes search” test detects open/closed state.
web/e2e/user-flows/find-and-search.spec.ts Removes unused import; changes keyboard shortcut validation for global search.
web/e2e/helpers/ux-assertions.ts Narrows the Access-Control allowlist patterns to reduce over-filtering.

Comment on lines +18 to +29
// global-search-input is always visible in the navbar; we validate the
// shortcut by checking that the search dropdown (results panel) becomes
// visible after the keypress.
const searchResults = page.getByTestId('global-search-results')
// Try Ctrl+K (Linux/Windows CI)
await page.keyboard.press('Control+k')
const searchInput = page.getByTestId('global-search-input')
const opened = await searchInput.isVisible({ timeout: 2_000 }).catch(() => false)
if (!opened) {
const openedCtrl = await searchResults.isVisible({ timeout: 2_000 }).catch(() => false)
if (!openedCtrl) {
// Fallback: try Meta+K (Mac)
await page.keyboard.press('Meta+k')
}
await expect(searchInput).toBeVisible({ timeout: ELEMENT_VISIBLE_TIMEOUT_MS })
await expect(searchResults).toBeVisible({ timeout: ELEMENT_VISIBLE_TIMEOUT_MS })
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

global-search-results isn’t a reliable indicator that Ctrl/Meta+K opened global search. In SearchDropdown, the results panel only mounts when isSearchOpen && !!searchQuery.trim() (non-empty query), and the data-testid="global-search-results" node only exists when there are results (flatResults.length > 0). With an empty query after Ctrl/Meta+K, this expectation will fail even if the shortcut worked. Prefer asserting the input becomes focused (or type a known query like "cluster" after the shortcut and then assert results visible).

Copilot uses AI. Check for mistakes.
Comment on lines +90 to +113
// global-search-input is always visible in the navbar; track the dropdown
// results panel (global-search-results) to determine open/closed state.
const searchResults = page.getByTestId('global-search-results')

// Try both Ctrl+K and Meta+K to open search (platform-dependent)
await page.keyboard.press('Control+k')
const searchInput = page.getByTestId('global-search-input')
let opened = await searchInput.isVisible({ timeout: 2_000 }).catch(() => false)
let opened = await searchResults.isVisible({ timeout: 2_000 }).catch(() => false)
if (!opened) {
await page.keyboard.press('Meta+k')
opened = await searchInput.isVisible({ timeout: 2_000 }).catch(() => false)
opened = await searchResults.isVisible({ timeout: 2_000 }).catch(() => false)
}
if (!opened) {
// Fallback: click the search area directly
const searchArea = page.getByTestId('global-search')
const hasSearch = await searchArea.isVisible({ timeout: 2_000 }).catch(() => false)
if (hasSearch) {
await searchArea.click()
opened = await searchInput.isVisible({ timeout: 2_000 }).catch(() => false)
opened = await searchResults.isVisible({ timeout: 2_000 }).catch(() => false)
}
}
if (!opened) { test.skip(true, 'Could not open search via keyboard or click'); return }
if (!opened) { test.skip(true, 'Could not open search dropdown via keyboard or click'); return }

await page.keyboard.press('Escape')
await expect(searchInput).not.toBeVisible({ timeout: MODAL_TIMEOUT_MS })
await expect(searchResults).not.toBeVisible({ timeout: MODAL_TIMEOUT_MS })
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

Using global-search-results to detect whether search opened/closed is incorrect here: the results panel is only mounted when the query is non-empty, and the global-search-results test id only renders when there are actual results. As written, opened will remain false on an empty query and the test will skip (or the final assertion will be meaningless). Instead, validate open/close via focus state on global-search-input (focused after Ctrl/Meta+K/click, blurred after Escape) or type a known query before checking results visibility.

Copilot uses AI. Check for mistakes.
// to avoid masking unrelated issues that mention this header.
/Access-Control-Allow-Origin.*localhost/i,
/Access-Control-Allow-Origin.*127\.0\.0\.1/i,
/Access-Control-Allow-Origin.*kubestellar\.io/i,
@clubanderson clubanderson merged commit d4d68e2 into main Apr 14, 2026
70 of 72 checks passed
@clubanderson clubanderson deleted the fix/e2e-copilot-review-comments branch April 14, 2026 00:41
@github-actions
Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

@github-actions
Copy link
Copy Markdown
Contributor

Post-merge build verification passed

Both Go and frontend builds compiled successfully against merge commit d4d68e2fabf61543274937a3471e5dcf1e9c33f9.

@github-actions
Copy link
Copy Markdown
Contributor

❌ Post-Merge Verification: failed

Commit: d4d68e2fabf61543274937a3471e5dcf1e9c33f9
Specs run: smoke.spec.ts
Report: https://github.com/kubestellar/console/actions/runs/24374577971

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Pull request generated by AI dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Copilot Review] 4 comment(s) on merged PR #7768

3 participants