Skip to content

test: migrate support case tests from IQE (RHCLOUD-44391)#304

Open
catastrophe-brandon wants to merge 10 commits intoRedHatInsights:masterfrom
catastrophe-brandon:btweed/iqe-support-case-tests
Open

test: migrate support case tests from IQE (RHCLOUD-44391)#304
catastrophe-brandon wants to merge 10 commits intoRedHatInsights:masterfrom
catastrophe-brandon:btweed/iqe-support-case-tests

Conversation

@catastrophe-brandon
Copy link
Copy Markdown
Contributor

Summary

Migrates support case help panel tests from iqe-platform-ui-plugin/tests/test_support_case.py to Playwright.

Changes

  • ✅ New test file: playwright/support-case.spec.ts
  • Migrates 2 of 3 tests from IQE (tests 1 & 2 - help panel related)

Test Coverage (3 test cases)

Tests verify support case functionality in the help panel:

  1. "Open a support case" button appears - Verifies button is displayed in help panel support tab
  2. Button opens Customer Portal - Clicking button opens access.redhat.com/support in new tab
  3. Support cases table displays - When user has open cases, table and pagination are shown

Smart Conditional Testing

The tests handle both UI states gracefully:

  • Empty state (no open cases) - Shows "Open a support case" button
  • Populated state (has cases) - Shows support cases table with pagination

Tests use conditional skipping based on what's actually rendered, making them resilient to different user account states.

Notes

  • ✅ Tests updated for current UI (original IQE tests were all skipped/failing)
  • ✅ Uses existing OUIA component IDs for stable selectors
  • ✅ Properly handles tab/window management for external link testing
  • ⏭️ Test Initial setup #3 (test_support_case_from_apps) not migrated - complex cross-app test better suited for insights-chrome repo

Original IQE Tests

The original IQE tests were all marked as @pytest.mark.skip(reason="skip all failing tests") and required updates for current UI.

Requirements

  • PLATFORM_UI-INSIGHTS_CHROME
  • PLATFORM_UI-SUPPORT_CASES

Related

  • IQE Source: iqe_platform_ui/tests/test_support_case.py

🤖 Generated with Claude Code

Migrates support case help panel tests from iqe-platform-ui-plugin
test_support_case.py to Playwright.

Tests verify:
- "Open a support case" button appears in help panel support tab
- Clicking button opens Red Hat Customer Portal in new tab
- Support cases table displays when user has open cases

The tests handle both empty state (no cases) and populated state (with cases)
gracefully using conditional skipping based on what's rendered.

Note: The complex test_support_case_from_apps (testing pre-filled support case
data from different apps) was not migrated as it requires cross-domain testing
and is better suited for the insights-chrome repository.

Requirements:
- PLATFORM_UI-INSIGHTS_CHROME
- PLATFORM_UI-SUPPORT_CASES

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: e700f153-c43c-4a2c-b693-80a7f393478c

📥 Commits

Reviewing files that changed from the base of the PR and between f16df2b and c43951b.

📒 Files selected for processing (1)
  • playwright/support-case.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • playwright/support-case.spec.ts

Summary by CodeRabbit

  • Tests
    • Added E2E tests for the Help panel’s "My support cases" flow: opening the panel, verifying UI readiness, and handling either empty state or a populated cases list.
    • Added a test that validates the "Open a support case" action opens the external support site in a new tab.
    • Tests conditionally skip or assert pagination and row presence when no cases exist.

Walkthrough

Adds a new Playwright E2E test suite for the Help Panel's "My support cases" subtab: opens the panel, waits for empty state or cases table, verifies the "Open a support case" control, validates table/pagination when present, and confirms external tab navigation to access.redhat.com.

Changes

Cohort / File(s) Summary
Support Case E2E Tests
playwright/support-case.spec.ts
New Playwright test file with setup hooks and 3 tests: (1) open help panel and verify "Open a support case" visibility after detecting empty state or cases table; (2) click "Open a support case", assert new tab navigates to access.redhat.com; (3) if not empty, assert cases table, pagination, and at least one row.

Sequence Diagram(s)

sequenceDiagram
    rect rgba(220,240,255,0.5)
    participant Tester as Test Runner
    end
    rect rgba(205,255,220,0.5)
    participant Browser
    end
    rect rgba(255,235,205,0.5)
    participant App as Web App
    end
    rect rgba(255,220,220,0.5)
    participant External as access.redhat.com
    end

    Tester->>Browser: launch, disable cookie prompts, navigate to app
    Browser->>App: load UI
    App-->>Browser: render "Hi," header
    Tester->>Browser: open Help Panel -> select "My support cases"
    alt Empty state visible
        App-->>Browser: show empty state
        Tester->>Browser: verify "Open a support case" visible
    else Cases table visible
        App-->>Browser: render cases table + pagination
        Tester->>Browser: assert table rows >= 1
    end
    Tester->>Browser: click "Open a support case"
    Browser->>Browser: open new tab -> navigate to external
    External-->>Browser: respond (access.redhat.com)
    Tester->>Browser: close new tab
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: migrating support case tests from IQE to Playwright, with clear reference to the issue tracker ID.
Description check ✅ Passed The description is comprehensive and well-structured, covering the migration scope, test coverage details, implementation notes, and limitations. It exceeds template requirements with detailed context.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Review rate limit: 9/10 reviews remaining, refill in 6 minutes.

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

catastrophe-brandon and others added 7 commits April 30, 2026 16:00
- Define timeout constants at module level for better maintainability
- Replace page.waitForTimeout() with Playwright's expect().toPass() pattern
- Use auto-retry for waiting on API-loaded content
- Explicitly specify timeouts on assertions for clarity

Timeout constants:
- SUPPORT_API_LOAD_TIMEOUT (15s) - Support cases API load time
- ELEMENT_VISIBLE_TIMEOUT (10s) - Element visibility wait
- EXTERNAL_PAGE_LOAD_TIMEOUT (30s) - External page navigation

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Simplifies all three tests to follow the actual user interaction flow:
1. Click help button to open help panel
2. Wait for help panel to load
3. Click on support tab
4. Verify expected content is visible

Key improvements:
- Removed complex conditional logic and state checking
- Tests now follow clear step-by-step user flow with numbered comments
- Uses getByRole('link') to find 'Open a support case' link (works in both states)
- Removed unnecessary empty state vs table differentiation in first two tests
- Third test uses .or() locator for cleaner either/or waiting

The 'Open a support case' link is always visible:
- In empty state: as a primary action button
- With cases: as a link in the description text

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The 'Open a support case' element is rendered differently depending on state:
- Empty state (no cases): PatternFly Button with OUIA ID
- Populated state (has cases): Actual link in description text

Updated selectors to use .or() locator to find either:
- Button: [data-ouia-component-id="help-panel-open-support-case-button"]
- Link: getByRole('link', { name: /open a support case/i })

This makes tests work regardless of whether user has support cases.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…/link

The SupportPanel shows a SkeletonTable while fetching support cases from the API.
We need to wait for this loading state to complete before looking for the
'Open a support case' button/link.

Changes:
- Added step to wait for either empty state or table to appear (skeleton gone)
- Only then check for the button/link visibility
- This ensures we're not checking while the loading skeleton is still showing
- Removed timeout from final visibility check since we already waited for loading

Step flow now:
1. Click help button
2. Wait for help panel
3. Click support tab
4. Wait for loading to complete (empty state or table appears)
5. Verify button/link is visible
6-8. (Test 2 only) Click and verify new tab

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace dual locator approach (OUIA ID + role) with simple text search.
The text 'Open a support case' is the same whether rendered as a Button
or Link, so searching by text is cleaner and more maintainable.
Change URL validation to check only the hostname (access.redhat.com)
rather than the full path, since we cannot validate page content
due to authentication requirements on the external Customer Portal.

Also removed unnecessary waitForLoadState and unused timeout constants.
Clarify that test_support_case_from_apps requires complex setup:
- API-created support cases
- Cross-domain interaction
- External portal authentication
- Pre-filled data validation

May require separate E2E suite or insights-chrome repository.
@catastrophe-brandon catastrophe-brandon self-assigned this Apr 30, 2026
@catastrophe-brandon catastrophe-brandon marked this pull request as ready for review April 30, 2026 21:40
@catastrophe-brandon catastrophe-brandon changed the title test: migrate support case tests from IQE test: migrate support case tests from IQE (RHCLOUD-44391) Apr 30, 2026
Copy link
Copy Markdown

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

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

Inline comments:
In `@playwright/support-case.spec.ts`:
- Around line 90-95: The assertion reads the popup URL too early—after awaiting
pagePromise (newPage) the page may still be at about:blank; call
newPage.waitForURL(...) (or newPage.waitForURL('**/*') to wait for any
navigation) before creating the URL object and asserting hostname so the
navigation has completed; update the sequence around newPage, add the waitForURL
call, then compute new URL via newPage.url() and keep the
expect(url.hostname).toBe('access.redhat.com') check.
- Around line 117-131: The current try/catch around await
expect(supportTable.or(emptyState)).toBeVisible({ timeout:
SUPPORT_API_LOAD_TIMEOUT }) is converting readiness timeouts into test.skip()
and hiding real failures; remove the catch that calls test.skip() (or rethrow
the caught error) so readiness timeouts fail the test, and after the successful
wait check specifically if emptyState.isVisible() (or const emptyVisible = await
emptyState.isVisible().catch(() => false)) and only call test.skip() when
emptyState is actually visible (indicating zero cases); use supportTable and
emptyState checks rather than skipping on any wait failure.
🪄 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: Enterprise

Run ID: 2e2961fe-1543-47ab-870e-51f253c8bf8a

📥 Commits

Reviewing files that changed from the base of the PR and between a4e519e and a1c940d.

📒 Files selected for processing (1)
  • playwright/support-case.spec.ts

Comment thread playwright/support-case.spec.ts
Comment thread playwright/support-case.spec.ts Outdated
1. Add waitForURL before asserting hostname to ensure navigation completes
   (newPage starts at about:blank after pagePromise resolves)

2. Remove try/catch that hides real failures by converting timeouts to skips
   - Let API load failures fail the test naturally
   - Only skip when empty state is actually visible (user has no cases)
   - Removes false negatives from timeout/network issues
Copy link
Copy Markdown

@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

♻️ Duplicate comments (1)
playwright/support-case.spec.ts (1)

92-97: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use a specific popup URL wait instead of wildcard matcher.

Line 93 uses waitForURL('**/*'), which is too broad for proving the popup reached the expected destination before Line 97 hostname assertion. This can still be flaky.

Suggested fix
-    await newPage.waitForURL('**/*');
+    await newPage.waitForURL(/access\.redhat\.com/, {
+      timeout: SUPPORT_API_LOAD_TIMEOUT,
+    });
In Playwright, does page.waitForURL('**/*') reliably ensure navigation away from about:blank, and is waiting for a specific host pattern (e.g., /access\.redhat\.com/) the recommended approach for popup navigation assertions?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@playwright/support-case.spec.ts` around lines 92 - 97, The test uses a
wildcard waitForURL('**/*') which is too broad and can be flaky; replace that
call (newPage.waitForURL) with a specific host pattern or regex that targets
access.redhat.com (e.g., a glob or RegExp matching access\.redhat\.com) so the
popup navigation is awaited precisely before creating the URL object and
asserting expect(url.hostname).toBe('access.redhat.com'); update the wait to use
the specific matcher rather than '**/*'.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@playwright/support-case.spec.ts`:
- Around line 56-61: The test currently expects the "Open a support case"
control unconditionally after awaiting emptyState.or(supportTable); instead,
detect which branch rendered and only assert empty-state-only elements when
emptyState is visible: use the emptyState locator (emptyState.isVisible() or an
awaited check) to conditionally expect the "Open a support case" control,
otherwise assert supportTable-specific expectations; update both occurrences
(around the emptyState/supportTable check and the similar block at lines 79–88)
so branch-specific assertions are guarded by emptyState visibility rather than
run unconditionally.

---

Duplicate comments:
In `@playwright/support-case.spec.ts`:
- Around line 92-97: The test uses a wildcard waitForURL('**/*') which is too
broad and can be flaky; replace that call (newPage.waitForURL) with a specific
host pattern or regex that targets access.redhat.com (e.g., a glob or RegExp
matching access\.redhat\.com) so the popup navigation is awaited precisely
before creating the URL object and asserting
expect(url.hostname).toBe('access.redhat.com'); update the wait to use the
specific matcher rather than '**/*'.
🪄 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: Enterprise

Run ID: 208e021f-f51f-4dc3-a9b9-cb12e172d9f3

📥 Commits

Reviewing files that changed from the base of the PR and between a1c940d and f16df2b.

📒 Files selected for processing (1)
  • playwright/support-case.spec.ts

Comment thread playwright/support-case.spec.ts
@catastrophe-brandon catastrophe-brandon enabled auto-merge (squash) April 30, 2026 21:58
Replace broad wildcard waitForURL('**/*') with specific RegExp
/access\.redhat\.com/ to await popup navigation precisely and
fail faster if navigation goes to wrong domain.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant