Skip to content

test: migrate feedback and support case tests from IQE (RHCLOUD-44391)#305

Open
catastrophe-brandon wants to merge 1 commit into
RedHatInsights:masterfrom
catastrophe-brandon:btweed/iqe-feedback-tests
Open

test: migrate feedback and support case tests from IQE (RHCLOUD-44391)#305
catastrophe-brandon wants to merge 1 commit into
RedHatInsights:masterfrom
catastrophe-brandon:btweed/iqe-feedback-tests

Conversation

@catastrophe-brandon
Copy link
Copy Markdown
Contributor

@catastrophe-brandon catastrophe-brandon commented May 1, 2026

Summary

Migrates feedback and support case e2e tests from IQE to Playwright with comprehensive test utilities and helper functions. This PR now incorporates changes from #304 to consolidate test migration efforts and reduce review overhead.

Changes

New Test Suites

1. Feedback Tests (playwright/feedback.spec.ts)

Migrated from: iqe_platform_ui/tests/test_feedback.py

Test: should open feedback form, test navigation, and submit successfully

  • Opens help panel and navigates to Feedback tab
  • Tests Back button navigation (opens form → clicks Back → returns to home)
  • Fills in feedback with random text
  • Submits feedback
  • Verifies success message displayed
  • Verifies "Share more feedback" button appears

Markers: @pytest.mark.qa, @pytest.mark.core

Note: JIRA API verification of ticket creation is not automated. The test verifies form submission succeeds but does not query JIRA to confirm ticket details. Tickets are created in https://issues.redhat.com/projects/CRCFEEDBK/issues/ with labels learning-resources and help-panel-feedback.

2. Support Case Tests (playwright/support-case.spec.ts)

Migrated from: iqe_platform_ui/tests/test_support_case.py

Test 1: should display "Open a support case" link in help panel

  • Opens help panel and navigates to Support tab
  • Waits for support panel to load (handles both empty state and populated table)
  • Verifies "Open a support case" button is visible

Test 2: should open Customer Portal when clicking "Open a support case" link

  • Opens help panel and navigates to Support tab
  • Clicks "Open a support case" button
  • Verifies new tab opens with access.redhat.com URL

Test 3: should display support cases table when user has open cases

  • Opens help panel and navigates to Support tab
  • Conditionally skips if user has no open cases (empty state)
  • Verifies support cases table is visible
  • Verifies pagination is present
  • Verifies table has at least one row

TODO: Test #3 from IQE (test_support_case_from_apps) - Not yet migrated. This test verifies support case data is pre-filled correctly when opened from different apps. May be better suited for insights-chrome repository.

Test Infrastructure

New Helper Functions (playwright/test-utils.ts)

Extracted duplicated help panel interaction patterns into reusable helpers:

  • openHelpPanel() - Opens help panel and waits for it to load
  • switchToHelpPanelTab(tabName) - Switches to a specific tab by name
  • waitForHelpPanelTabsLoaded() - Waits for tabs container to render
  • waitForSupportTabLoaded() - Waits for support content (empty or table)
  • navigateToFeedbackTab() - Navigates to feedback tab and waits

Impact: Reduces ~60 lines of duplicated code across test files (~25% reduction)

Support Case Page Objects (playwright/support-case-helpers.ts)

Convenience helpers for support case tests:

  • openSupportPanel() - Opens help panel and navigates to Support tab
  • isEmptyState() - Checks if support panel shows empty state
  • getSupportPanelLocators() - Returns locators for common elements

Centralized Timeout Constants

All hard-coded timeout values replaced with symbolic constants:

  • PAGE_LOAD_TIMEOUT (60s) - Initial page load
  • ELEMENT_VISIBLE_TIMEOUT (10s) - Element visibility
  • RESOURCE_COUNT_TIMEOUT (20s) - Resource count extraction
  • CHROME_HEADER_LOAD_TIMEOUT (30s) - Chrome shell header (fixes flaky first test)
  • SUPPORT_API_LOAD_TIMEOUT (15s) - Support API data
  • HELP_PANEL_TABS_LOAD_TIMEOUT (10s) - Tab rendering
  • FEEDBACK_SUBMISSION_TIMEOUT (10s) - Feedback submission

Refactored Tests

  • playwright/help-panel.spec.ts - Now uses shared helper functions (42 lines, simplified)
  • playwright/all-learning-resources.spec.ts - Uses symbolic timeout constants

Requirements

  • PLATFORM_UI-FEEDBACK
  • PLATFORM_UI-INSIGHTS_CHROME
  • PLATFORM_UI-SUPPORT_CASES

Related

🤖 Generated with Claude Code

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 1, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds two Playwright E2E test specs: one automates the Help panel Feedback workflow (open form, back navigation, submit, success UI), and one verifies Help panel Support Cases flows (empty-state vs table handling, external "Open a support case" tab, and table/pagination checks).

Changes

Feedback - Help Panel

Layer / File(s) Summary
Test setup & timeouts
playwright/feedback.spec.ts
New spec declares timeouts and a beforeEach that disables cookie prompts, navigates to /, and waits for the chrome header text ("Hi,") to confirm readiness.
Help panel navigation
playwright/feedback.spec.ts
Opens the help panel, selects the "Feedback" subtab, and verifies the feedback home view is visible.
Form navigation & back behavior
playwright/feedback.spec.ts
Opens "Share general feedback" form, exercises the "Back" button to return to feedback home, and reopens the form.
Submission & success assertions
playwright/feedback.spec.ts
Fills the feedback textarea with randomized text, submits, and asserts success UI (including "thank you" and "Share more feedback") within the submission timeout. Does not verify downstream JIRA creation.

Support Cases - Help Panel

Layer / File(s) Summary
Test setup & timeouts
playwright/support-case.spec.ts
New spec defines SUPPORT_API_LOAD_TIMEOUT (~15s) and a beforeEach that disables cookie prompts, navigates to /, and waits for the chrome header ("Hi,").
Open My support cases view
playwright/support-case.spec.ts
Opens help panel, selects the "My support cases" subtab, and waits up to timeout for either an empty-state element or the support cases table to render.
Empty-state / link visibility
playwright/support-case.spec.ts
Asserts the "Open a support case" link is visible when the empty-state or table view appears.
External tab flow
playwright/support-case.spec.ts
Clicks the "Open a support case" link, uses context.waitForEvent('page') to capture the new tab, asserts the new tab navigates to access.redhat.com (hostname check), then closes the tab.
Table & pagination assertions
playwright/support-case.spec.ts
If the empty-state is visible, the test self-skips at runtime; otherwise it asserts the support cases table, pagination presence, and that at least one table row exists.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description check ✅ Passed The PR description is comprehensive and includes all required template sections with detailed information about changes, test coverage, and infrastructure improvements.
Title check ✅ Passed The pull request title clearly and concisely describes the main change: migrating feedback and support case tests from IQE to Playwright, with the reference ticket RHCLOUD-44391.

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

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

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

@catastrophe-brandon catastrophe-brandon force-pushed the btweed/iqe-feedback-tests branch from a5ae4f4 to c6cd63f Compare May 1, 2026 17:38
@catastrophe-brandon catastrophe-brandon changed the title test: migrate feedback tests from IQE test: migrate feedback tests from IQE (RHCLOUD-44391) May 1, 2026
@catastrophe-brandon catastrophe-brandon self-assigned this May 1, 2026
@catastrophe-brandon catastrophe-brandon marked this pull request as ready for review May 1, 2026 18:21
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

🤖 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 assumes the "Open a support case" CTA is always
present but the SupportPanel renders that CTA only in empty-state; update the
spec to branch on which locator is visible: use the existing emptyState and
supportTable locators (emptyState, supportTable) to await visibility, then if
emptyState.isVisible() assert page.getByText(/open a support
case/i).toBeVisible(), else assert the CTA is not present or instead assert the
supportTable has expected rows; reference the SupportPanel component behavior
(src/components/HelpPanel/HelpPanelTabs/SupportPanel) when adding the
conditional assertion so tests are deterministic for accounts with open cases.
🪄 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: 40cb5586-615c-4875-8d96-8b92e55b1701

📥 Commits

Reviewing files that changed from the base of the PR and between 4100b96 and b9399eb.

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

Comment thread playwright/support-case.spec.ts Outdated
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.

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

135-141: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Conditional skip hides the table scenario in CI.

When empty-state is shown, this test exits as skipped, so the “has open cases” path may never be validated. Prefer explicit fixture-gating (fixme with reason) or seeded data to avoid green builds with missing coverage.

Suggested adjustment
-    const emptyVisible = await emptyState.isVisible().catch(() => false);
-    if (emptyVisible) {
-      // User has no cases, skip this test
-      test.skip();
-      return;
-    }
+    const emptyVisible = await emptyState.isVisible();
+    test.fixme(
+      emptyVisible,
+      'Requires a seeded account with at least one open support case'
+    );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@playwright/support-case.spec.ts` around lines 135 - 141, The current runtime
conditional that sets emptyVisible via emptyState.isVisible() and then calls
test.skip() hides the "has open cases" path in CI; remove this runtime skip
logic (the emptyVisible variable and the test.skip() call) and instead gate the
test explicitly using a fixture or Playwright's metadata helper (e.g., use
test.fixme(condition, 'reason') at the top of the test) or ensure the test runs
against seeded data so emptyState never appears; update references to emptyState
and remove the test.skip() branch so the test either uses a deterministic seeded
dataset or is marked with test.fixme with a clear reason.
🧹 Nitpick comments (1)
playwright/support-case.spec.ts (1)

43-57: ⚡ Quick win

Extract repeated “open support tab” flow into a helper.

The same panel-open/subtab-navigation sequence appears in three tests. Centralizing it will reduce drift and future flake fixes.

Refactor sketch
+async function openMySupportCasesTab(page: Page) {
+  await page.getByLabel('Toggle help panel').click();
+  await expect(page.locator('[data-ouia-component-id="help-panel-title"]')).toBeVisible();
+  await expect(page.locator('[data-ouia-component-id="help-panel-subtabs"]')).toBeVisible({
+    timeout: SUBTABS_LOAD_TIMEOUT,
+  });
+  await page.locator('[data-ouia-component-id="help-panel-subtab-support"]').click();
+}
-    await page.getByLabel('Toggle help panel').click();
-    ...
-    await supportTab.click();
+    await openMySupportCasesTab(page);

Also applies to: 70-84, 113-126

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@playwright/support-case.spec.ts` around lines 43 - 57, Extract the repeated
sequence that opens the help panel and navigates to the "My support cases"
subtab into a reusable helper (e.g., openSupportTab or gotoSupportSubtab) and
replace the duplicated blocks found around the current locator usage
(page.getByLabel('Toggle help panel'), help-panel-title, help-panel-subtabs,
help-panel-subtab-support) with calls to that helper; the helper should click
the help toggle, await visibility of
'[data-ouia-component-id="help-panel-title"]', await visibility of
'[data-ouia-component-id="help-panel-subtabs"]' with SUBTABS_LOAD_TIMEOUT, then
click '[data-ouia-component-id="help-panel-subtab-support"]', and update the
three test sites (the blocks at lines noted in the comment) to call this helper
instead of repeating the steps.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@playwright/support-case.spec.ts`:
- Around line 135-141: The current runtime conditional that sets emptyVisible
via emptyState.isVisible() and then calls test.skip() hides the "has open cases"
path in CI; remove this runtime skip logic (the emptyVisible variable and the
test.skip() call) and instead gate the test explicitly using a fixture or
Playwright's metadata helper (e.g., use test.fixme(condition, 'reason') at the
top of the test) or ensure the test runs against seeded data so emptyState never
appears; update references to emptyState and remove the test.skip() branch so
the test either uses a deterministic seeded dataset or is marked with test.fixme
with a clear reason.

---

Nitpick comments:
In `@playwright/support-case.spec.ts`:
- Around line 43-57: Extract the repeated sequence that opens the help panel and
navigates to the "My support cases" subtab into a reusable helper (e.g.,
openSupportTab or gotoSupportSubtab) and replace the duplicated blocks found
around the current locator usage (page.getByLabel('Toggle help panel'),
help-panel-title, help-panel-subtabs, help-panel-subtab-support) with calls to
that helper; the helper should click the help toggle, await visibility of
'[data-ouia-component-id="help-panel-title"]', await visibility of
'[data-ouia-component-id="help-panel-subtabs"]' with SUBTABS_LOAD_TIMEOUT, then
click '[data-ouia-component-id="help-panel-subtab-support"]', and update the
three test sites (the blocks at lines noted in the comment) to call this helper
instead of repeating the steps.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: db7bc7f6-378b-484f-a85c-3ae09c62dcba

📥 Commits

Reviewing files that changed from the base of the PR and between ac74ed6 and 82b079d.

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

@karelhala
Copy link
Copy Markdown
Contributor

@catastrophe-brandon some of the commits look unrelated to the PR. Looks like you have commits from the #304 PR in here as well.

Copy link
Copy Markdown
Contributor

@karelhala karelhala left a comment

Choose a reason for hiding this comment

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

Split the merged test back into two separate tests

The PR description lists two IQE tests being migrated, but the code combines them into a single test:

test('should open feedback form, test navigation, and submit successfully', async ({ page }) => {

This reduces diagnostic granularity — if the submission step fails (e.g., API timeout), the navigation test is also reported as failed even though it would have passed on its own. Split back into two tests matching the original IQE structure:

test('should open and close feedback form', async ({ page }) => {
  // Open help panel, navigate to feedback tab
  // Click "Share general feedback", verify form visible
  // Click Back, verify return to feedback home
});

test('should submit feedback successfully', async ({ page }) => {
  // Open help panel, navigate to feedback form
  // Fill in feedback text, click submit
  // Verify success message and "Share more feedback" button
});

This way each test passes or fails independently, and a CI failure points you directly to what broke.

@karelhala
Copy link
Copy Markdown
Contributor

@catastrophe-brandon looking at the test, it creates actual JIRA ticket. Do we really want it? It is creating tickets on stage so might not be an issue, just making sure.

@catastrophe-brandon
Copy link
Copy Markdown
Contributor Author

Split the merged test back into two separate tests

The PR description lists two IQE tests being migrated, but the code combines them into a single test:

test('should open feedback form, test navigation, and submit successfully', async ({ page }) => {

This reduces diagnostic granularity — if the submission step fails (e.g., API timeout), the navigation test is also reported as failed even though it would have passed on its own. Split back into two tests matching the original IQE structure:

test('should open and close feedback form', async ({ page }) => {
  // Open help panel, navigate to feedback tab
  // Click "Share general feedback", verify form visible
  // Click Back, verify return to feedback home
});

test('should submit feedback successfully', async ({ page }) => {
  // Open help panel, navigate to feedback form
  // Fill in feedback text, click submit
  // Verify success message and "Share more feedback" button
});

This way each test passes or fails independently, and a CI failure points you directly to what broke.

The merge was deliberate - one e2e test covering multiple touchpoints is often more useful than lots of granular, smaller tests. In fact, granular e2e tests are considered an anti-pattern, the remedy to which is fine-grained component/integration coverage.

image

@catastrophe-brandon
Copy link
Copy Markdown
Contributor Author

@catastrophe-brandon looking at the test, it creates actual JIRA ticket. Do we really want it? It is creating tickets on stage so might not be an issue, just making sure.

This is how the previous IQE test worked, so I chose to keep the same flow. There's no known way to test ticket submission functionality e2e without creating an issue. We could look into a periodic clean-up routine to remove the created issues if it's problematic from a book-keeping standpoint.

@catastrophe-brandon catastrophe-brandon force-pushed the btweed/iqe-feedback-tests branch 3 times, most recently from 3bc19c6 to fe1040e Compare May 20, 2026 16:16
@catastrophe-brandon catastrophe-brandon changed the title test: migrate feedback tests from IQE (RHCLOUD-44391) test: migrate feedback and support case tests from IQE (RHCLOUD-44391) May 20, 2026
@catastrophe-brandon
Copy link
Copy Markdown
Contributor Author

@CodeRabbit-ai what's blocking approval?

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

Let me check the current state of my review comments on this PR.


🏁 Script executed:

#!/bin/bash
# Get all review comments from coderabbitai on this PR
gh pr view 305 --repo RedHatInsights/learning-resources --json reviews,comments

# Also get review threads
gh api repos/RedHatInsights/learning-resources/pulls/305/reviews --jq '.[] | {id, user: .user.login, state, submitted_at, body: .body[:200]}'

Length of output: 30299


@catastrophe-brandon: Here's a summary of what's currently outstanding:

From my side (CodeRabbit):

  1. 🟠 Unresolved major comment on playwright/support-case.spec.ts lines 135–141 — the runtime test.skip() silently hides the "has open cases" test path in CI, meaning green builds can mask untested coverage. The suggestion was to replace it with test.fixme(emptyVisible, 'Requires a seeded account with at least one open support case') so the skip is explicit and intentional.

  2. Note: My review is currently paused due to active development commits on this branch. If you'd like a fresh review of the latest commits, you can post @coderabbitai review to trigger one, or @coderabbitai resume to re-enable automatic reviews.

From human reviewers:

  • karelhala raised a concern about splitting the merged test back into two, which you've addressed with your rationale (deliberate merge, anti-pattern argument). That's a conversation between you and the human reviewers — karelhala hasn't approved yet and also flagged unrelated commits from #304 being included in this branch.

If you address the test.skip()test.fixme() item above, I'm happy to approve my side. You can also post @coderabbitai approve as a top-level PR comment once you're ready for me to approve.

Migrates feedback and support case e2e tests from IQE to Playwright
with comprehensive test utilities and helper functions.

New test suites:
- feedback.spec.ts: Tests feedback form submission flow including
  navigation, form interaction, and success message validation
- support-case.spec.ts: Tests support case creation flows, including
  navigation to Customer Portal and handling of various support case
  entry points across different help panel states
- support-case-helpers.ts: Page object helpers for support case tests
  (openSupportPanel, isEmptyState, getSupportPanelLocators)

Test utilities refactoring:
- Extracted duplicated help panel interaction patterns into reusable
  helper functions to reduce code duplication (~25% reduction)
- openHelpPanel(): Opens help panel and waits for it to load
- switchToHelpPanelTab(): Switches to a specific tab by name
- waitForHelpPanelTabsLoaded(): Waits for tabs container to render
- waitForSupportTabLoaded(): Waits for support content (empty or table)
- navigateToFeedbackTab(): Navigates to feedback tab and waits

Timeout constants centralized:
- PAGE_LOAD_TIMEOUT (60s) - Initial page load
- ELEMENT_VISIBLE_TIMEOUT (10s) - Element visibility
- RESOURCE_COUNT_TIMEOUT (20s) - Resource count extraction
- CHROME_HEADER_LOAD_TIMEOUT (30s) - Chrome shell header (for flaky first test)
- SUPPORT_API_LOAD_TIMEOUT (15s) - Support API data
- HELP_PANEL_TABS_LOAD_TIMEOUT (10s) - Tab rendering
- FEEDBACK_SUBMISSION_TIMEOUT (10s) - Feedback submission

Test improvements:
- Replaced runtime conditional skip with test.fixme() for deterministic
  test execution (support cases table test requires test user to have
  open support cases in stage environment)

All tests handle feature flag dependencies and environment-specific
behavior appropriately. Incorporates changes from PR RedHatInsights#304 to consolidate
test migration efforts.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@catastrophe-brandon catastrophe-brandon force-pushed the btweed/iqe-feedback-tests branch from fe1040e to 7b4f04d Compare May 20, 2026 16:36
@catastrophe-brandon
Copy link
Copy Markdown
Contributor Author

@CodeRabbit-ai Updates made. Do I have your blessing?

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

Let me check the current state of the file to confirm the fix.


🏁 Script executed:

#!/bin/bash
# Check current state of support-case.spec.ts around the previously flagged lines
cat playwright/support-case.spec.ts

Length of output: 4565


@catastrophe-brandon: Yes, you have my blessing! ✅

The test.fixme() change looks great — the detailed comment explaining why it's disabled and how to re-enable it is even more helpful than the original suggestion. The outstanding concern is fully addressed.

[approve]

🐇 ✨

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.

2 participants