-
Notifications
You must be signed in to change notification settings - Fork 24
test: migrate support case tests from IQE (RHCLOUD-44391) #304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
catastrophe-brandon
wants to merge
10
commits into
RedHatInsights:master
Choose a base branch
from
catastrophe-brandon:btweed/iqe-support-case-tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+142
−0
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4c180c2
test: migrate support case tests from IQE
catastrophe-brandon b92d60f
fix: use symbolic timeout constants and improve async waiting
catastrophe-brandon 95411fa
refactor: simplify support case tests to follow clear user flow
catastrophe-brandon 956c6f1
fix: handle both button and link for 'Open a support case'
catastrophe-brandon b4c5041
fix: wait for loading skeleton to complete before checking for button…
catastrophe-brandon 02a5abb
refactor(tests): simplify support case link locator
catastrophe-brandon 8939cce
fix(tests): validate hostname only for external Customer Portal link
catastrophe-brandon a1c940d
docs: add detailed TODO note for unmigrated test #3
catastrophe-brandon f16df2b
fix(tests): wait for URL navigation and improve skip logic
catastrophe-brandon c43951b
fix(tests): use specific URL pattern for Customer Portal navigation
catastrophe-brandon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| import { test, expect } from '@playwright/test'; | ||
| import { disableCookiePrompt } from './test-utils'; | ||
|
|
||
| /** | ||
| * Support Case Tests | ||
| * | ||
| * Migrated from IQE: iqe_platform_ui/tests/test_support_case.py | ||
| * | ||
| * These tests verify that support case functionality is accessible from the help panel: | ||
| * - "Open a support case" button appears in the help menu | ||
| * - Clicking the button opens the Red Hat Customer Portal support case page | ||
| * | ||
| * TODO: Test #3 (test_support_case_from_apps) - Not yet migrated | ||
| * This test verifies that support case data is pre-filled correctly when opened from | ||
| * different apps. It requires: | ||
| * - Complex setup with actual support cases created via API | ||
| * - Cross-domain interaction with Customer Portal | ||
| * - Authentication on the external portal to validate pre-filled data | ||
| * - May be better suited for insights-chrome repository or separate E2E suite | ||
| * | ||
| * Requirements: | ||
| * - PLATFORM_UI-INSIGHTS_CHROME | ||
| * - PLATFORM_UI-SUPPORT_CASES | ||
| */ | ||
|
|
||
| // Timeout constants | ||
| const SUPPORT_API_LOAD_TIMEOUT = 15000; // Time to wait for support cases API to load | ||
|
|
||
| test.describe('Support Case - Help Panel', () => { | ||
| test.beforeEach(async ({ page }) => { | ||
| // Block trustarc cookie prompts | ||
| await disableCookiePrompt(page); | ||
|
|
||
| // Navigate to home page - authentication state is already loaded from global setup | ||
| await page.goto('/', { waitUntil: 'load', timeout: 60000 }); | ||
|
|
||
| // Wait for chrome header to be fully loaded | ||
| await expect(page.getByText('Hi,')).toBeVisible(); | ||
| }); | ||
|
|
||
| test('should display "Open a support case" link in help panel', async ({ page }) => { | ||
| // Step 1: Click help button to open help panel | ||
| await page.getByLabel('Toggle help panel').click(); | ||
|
|
||
| // Step 2: Wait for help panel to load | ||
| const helpPanelTitle = page.locator('[data-ouia-component-id="help-panel-title"]'); | ||
| await expect(helpPanelTitle).toBeVisible(); | ||
|
|
||
| // Step 3: Click on "My support cases" tab | ||
| const supportTab = page.locator('[data-ouia-component-id="help-panel-subtab-support"]'); | ||
| await supportTab.click(); | ||
|
|
||
| // Step 4: Wait for the support panel to finish loading | ||
| // The panel shows a skeleton loader while fetching support cases from API | ||
| // Wait for either empty state or table to appear (skeleton disappears) | ||
| const emptyState = page.locator('[data-ouia-component-id="help-panel-support-empty-state"]'); | ||
| const supportTable = page.locator('[data-ouia-component-id="help-panel-support-cases-table"]'); | ||
| await expect(emptyState.or(supportTable)).toBeVisible({ timeout: SUPPORT_API_LOAD_TIMEOUT }); | ||
|
|
||
| // Step 5: The "Open a support case" button/link should now be visible | ||
| await expect(page.getByText(/open a support case/i)).toBeVisible(); | ||
| }); | ||
|
|
||
| test('should open Customer Portal when clicking "Open a support case" link', async ({ page, context }) => { | ||
| // Step 1: Click help button to open help panel | ||
| await page.getByLabel('Toggle help panel').click(); | ||
|
|
||
| // Step 2: Wait for help panel to load | ||
| const helpPanelTitle = page.locator('[data-ouia-component-id="help-panel-title"]'); | ||
| await expect(helpPanelTitle).toBeVisible(); | ||
|
|
||
| // Step 3: Click on "My support cases" tab | ||
| const supportTab = page.locator('[data-ouia-component-id="help-panel-subtab-support"]'); | ||
| await supportTab.click(); | ||
|
|
||
| // Step 4: Wait for the support panel to finish loading | ||
| // The panel shows a skeleton loader while fetching support cases from API | ||
| // Wait for either empty state or table to appear (skeleton disappears) | ||
| const emptyState = page.locator('[data-ouia-component-id="help-panel-support-empty-state"]'); | ||
| const supportTable = page.locator('[data-ouia-component-id="help-panel-support-cases-table"]'); | ||
| await expect(emptyState.or(supportTable)).toBeVisible({ timeout: SUPPORT_API_LOAD_TIMEOUT }); | ||
|
|
||
| // Step 5: Set up listener for new page/tab before clicking | ||
| const pagePromise = context.waitForEvent('page'); | ||
|
|
||
| // Step 6: Click the "Open a support case" button/link | ||
| await page.getByText(/open a support case/i).click(); | ||
|
|
||
| // Step 7: Wait for new page to open and verify it navigates to Red Hat Customer Portal | ||
| const newPage = await pagePromise; | ||
|
|
||
| // Wait for navigation to Red Hat Customer Portal (page starts at about:blank) | ||
| await newPage.waitForURL(/access\.redhat\.com/); | ||
|
|
||
| // Verify the destination hostname (we can't validate page content due to auth requirements) | ||
| const url = new URL(newPage.url()); | ||
| expect(url.hostname).toBe('access.redhat.com'); | ||
|
|
||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| // Clean up - close the new tab | ||
| await newPage.close(); | ||
| }); | ||
|
|
||
| test('should display support cases table when user has open cases', async ({ page }) => { | ||
| // Step 1: Click help button to open help panel | ||
| await page.getByLabel('Toggle help panel').click(); | ||
|
|
||
| // Step 2: Wait for help panel to load | ||
| const helpPanelTitle = page.locator('[data-ouia-component-id="help-panel-title"]'); | ||
| await expect(helpPanelTitle).toBeVisible(); | ||
|
|
||
| // Step 3: Click on "My support cases" tab | ||
| const supportTab = page.locator('[data-ouia-component-id="help-panel-subtab-support"]'); | ||
| await supportTab.click(); | ||
|
|
||
| // Step 4: Wait for support panel to load and check if user has support cases | ||
| const supportTable = page.locator('[data-ouia-component-id="help-panel-support-cases-table"]'); | ||
| const emptyState = page.locator('[data-ouia-component-id="help-panel-support-empty-state"]'); | ||
|
|
||
| // Wait for either the table or empty state to appear (let it fail if timeout) | ||
| await expect(supportTable.or(emptyState)).toBeVisible({ timeout: SUPPORT_API_LOAD_TIMEOUT }); | ||
|
|
||
| // Check if empty state is visible (user has no cases) | ||
| const emptyVisible = await emptyState.isVisible().catch(() => false); | ||
| if (emptyVisible) { | ||
| // User has no cases, skip this test | ||
| test.skip(); | ||
| return; | ||
| } | ||
|
|
||
| // Verify table is visible | ||
| await expect(supportTable).toBeVisible(); | ||
|
|
||
| // Verify pagination is present | ||
| const pagination = page.locator('[data-ouia-component-id="help-panel-support-pagination"]'); | ||
| await expect(pagination).toBeVisible(); | ||
|
|
||
| // Verify table has at least one row (case) | ||
| const tableRows = supportTable.locator('tbody tr'); | ||
| const rowCount = await tableRows.count(); | ||
| expect(rowCount).toBeGreaterThan(0); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.