Skip to content

test: Playwright UI tests for #2809 — feat: add expandable section component#2826

Closed
yordanove wants to merge 1 commit intodevelopfrom
test/partneros-pr-2809
Closed

test: Playwright UI tests for #2809 — feat: add expandable section component#2826
yordanove wants to merge 1 commit intodevelopfrom
test/partneros-pr-2809

Conversation

@yordanove
Copy link
Copy Markdown

@yordanove yordanove commented Apr 21, 2026

Playwright UI Tests — Auto-generated by Partneros

Parent PR: #2809

Coverage

  • Expandable section expands on click — confirms items become visible
  • Expandable section collapses on second click
  • Non-expandable section (shouldExpand=false) does not respond to click
  • Expand icon absent when showExpandIcon=false

How to use

Run: npx playwright test tests/partneros-pr-2809.spec.ts

Qase IDs are set to 0 — assign before merging.
Generated by Partneros. Review selectors and assertions before merging.

Summary by CodeRabbit

  • Tests
    • Added comprehensive UI test suite for the ExpandableSection component across mobile and desktop viewports
    • Verifies critical functionality including expand/collapse interactions, non-expandable variant behavior, and icon visibility handling
    • Ensures component behaves correctly across different viewport sizes and configurations

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
jumper-exchange Ready Ready Preview, Comment Apr 21, 2026 0:18am
jumper-exchange-storybook Ready Ready Preview, Comment Apr 21, 2026 0:18am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

Walkthrough

A new Playwright test specification file was added to test the ExpandableSection component's UI behavior. The test suite verifies expand/collapse functionality, non-expandable section behavior, and icon visibility across mobile and desktop viewports, with four test cases reporting to Qase.

Changes

Cohort / File(s) Summary
ExpandableSection Component Test Suite
tests/partneros-pr-2809.spec.ts
New Playwright test file with four UI test cases verifying expand/collapse behavior, non-expandable variant handling, and expand icon visibility across mobile and desktop viewports.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • laurentsenta
  • callMeTheQA
  • mmioana

Poem

🐰 A new spec file hops into place,
Testing sections with expandable grace,
Mobile and desktop both get their say,
Icons and toggles work just right today!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding Playwright UI tests for an expandable section component feature (#2809). It accurately summarizes the primary purpose of the changeset.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/partneros-pr-2809

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions
Copy link
Copy Markdown

✅ All snapshot tests passed

@github-actions
Copy link
Copy Markdown

🎨 The following files missed linting:

 tests/partneros-pr-2809.spec.ts | 48 +++++++++++++++++++++++++++++++----------

To fix this issue, use git fetch && pnpm lint-staged --diff="origin/develop...test/partneros-pr-2809" to lint changed files.

🚧 Your commit hooks might be missing 🚧

Copy link
Copy Markdown
Contributor

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

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

Inline comments:
In `@tests/partneros-pr-2809.spec.ts`:
- Around line 60-68: The test is turning into a no-op when the target selectors
are missing or hidden; before interacting assert the fixture exists (e.g., check
nonExpandableHeader.count()/isVisible via an expect on the locator) so the test
fails if the selector is absent, then proceed to click and assert items (locator
'[data-testid="expandable-section-item"]') remain hidden; for the icon/absence
case replace hidden assertions with a presence count assertion (use
toHaveCount(0) on the appropriate locator) to explicitly verify absence. Apply
the same pattern to the other test covering lines 79-84 (assert fixture exists
first, then use toHaveCount(0) for absence checks).
- Around line 17-18: Several tests still use the placeholder qase(0, ...) call
which must be replaced with the real Qase IDs; find each test that wraps its
description with qase(0, ...) (e.g., the test whose title starts "expandable
section expands to reveal asset items on click" and the other three qase-wrapped
tests) and update the first argument of qase(...) from 0 to the correct numeric
Qase case ID for each test so reporting maps to the proper cases; ensure you
update all four occurrences of qase(0, ...) in this spec file.
- Around line 23-30: Scope the click and assertions to the same
ExpandableSection parent instead of using global locators: locate the section
element (e.g. the parent with a stable test id like 'expandable-section' or add
one to the ExpandableSection component), then use that section locator to find
the summary used in the click (expandableHeader) and the child items
(expandable-section-item) for assertions; apply this change in both the expand
test (where expandableHeader and items are used) and the collapse test so the
click and waits operate on the same section instance.
🪄 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: Pro

Run ID: 3e955b3f-6f3a-4672-8e16-280a11c0b28c

📥 Commits

Reviewing files that changed from the base of the PR and between 6c1bbde and 9855e88.

📒 Files selected for processing (1)
  • tests/partneros-pr-2809.spec.ts

Comment on lines +17 to +18
test(
qase(0 /* TODO: assign Qase ID */, 'expandable section expands to reveal asset items on click'),
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.

⚠️ Potential issue | 🟡 Minor

Replace placeholder Qase IDs before merging.

All four tests still report as qase(0, ...), which matches the PR note but will make reporting ambiguous if this lands as-is.

Also applies to: 35-36, 54-55, 73-74

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/partneros-pr-2809.spec.ts` around lines 17 - 18, Several tests still
use the placeholder qase(0, ...) call which must be replaced with the real Qase
IDs; find each test that wraps its description with qase(0, ...) (e.g., the test
whose title starts "expandable section expands to reveal asset items on click"
and the other three qase-wrapped tests) and update the first argument of
qase(...) from 0 to the correct numeric Qase case ID for each test so reporting
maps to the proper cases; ensure you update all four occurrences of qase(0, ...)
in this spec file.

Comment on lines +23 to +30
await test.step('click expandable section header', async () => {
const expandableHeader = page.locator('[data-testid="expandable-section-summary"]').first();
await expandableHeader.waitFor({ state: 'visible' });
await expandableHeader.click();
});
await test.step('confirm items are visible after expansion', async () => {
const items = page.locator('[data-testid="expandable-section-item"]');
await items.first().waitFor({ state: 'visible' });
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.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cd tests && wc -l partneros-pr-2809.spec.ts

Repository: jumperexchange/jumper-exchange

Length of output: 102


🏁 Script executed:

head -60 tests/partneros-pr-2809.spec.ts

Repository: jumperexchange/jumper-exchange

Length of output: 2658


🏁 Script executed:

cat -n tests/partneros-pr-2809.spec.ts

Repository: jumperexchange/jumper-exchange

Length of output: 4492


🏁 Script executed:

find . -type f -name "*.tsx" -o -name "*.ts" | grep -i "portfolio" | head -20

Repository: jumperexchange/jumper-exchange

Length of output: 1077


🏁 Script executed:

rg "expandable-section-summary|expandable-section-item" --type tsx --type ts -l

Repository: jumperexchange/jumper-exchange

Length of output: 101


🏁 Script executed:

rg "expandable-section-summary|expandable-section-item" -l

Repository: jumperexchange/jumper-exchange

Length of output: 105


🏁 Script executed:

grep -r "portfolio-assets-expandable-section" . 2>/dev/null | head -5

Repository: jumperexchange/jumper-exchange

Length of output: 56


🏁 Script executed:

cat -n src/app/ui/portfolio/PortfolioAssetsSection.tsx

Repository: jumperexchange/jumper-exchange

Length of output: 2451


🏁 Script executed:

rg "data-testid.*expandable" -B 2 -A 2

Repository: jumperexchange/jumper-exchange

Length of output: 3135


🏁 Script executed:

rg "ExpandableSection|expandable-section" --type-list

Repository: jumperexchange/jumper-exchange

Length of output: 463


🏁 Script executed:

find . -type f -name "*.tsx" -o -name "*.jsx" | xargs grep -l "expandable-section-summary\|ExpandableSection" 2>/dev/null

Repository: jumperexchange/jumper-exchange

Length of output: 58


🏁 Script executed:

find . -type f \( -name "*.tsx" -o -name "*.jsx" \) -exec grep -l "expandable-section-summary\|ExpandableSection" {} \;

Repository: jumperexchange/jumper-exchange

Length of output: 56


🏁 Script executed:

rg "class.*ExpandableSection|function.*ExpandableSection|const.*ExpandableSection" -A 3

Repository: jumperexchange/jumper-exchange

Length of output: 56


🏁 Script executed:

rg "expandable-section-summary" --no-filename -B 5 -A 5

Repository: jumperexchange/jumper-exchange

Length of output: 1937


🏁 Script executed:

rg "expandable-section-item" --no-filename -B 5 -A 5

Repository: jumperexchange/jumper-exchange

Length of output: 1557


🏁 Script executed:

rg "expandable-section" --no-filename

Repository: jumperexchange/jumper-exchange

Length of output: 755


🏁 Script executed:

cat -n src/app/[lng]/portfolio/page.tsx

Repository: jumperexchange/jumper-exchange

Length of output: 1190


🏁 Script executed:

ls -la src/app/ui/portfolio/

Repository: jumperexchange/jumper-exchange

Length of output: 1605


🏁 Script executed:

grep -r "data-testid.*expandable" src/ 2>/dev/null

Repository: jumperexchange/jumper-exchange

Length of output: 56


🏁 Script executed:

find . -type f -name "*.tsx" -o -name "*.ts" | xargs grep -l "expandable-section" 2>/dev/null | grep -v node_modules | grep -v ".next"

Repository: jumperexchange/jumper-exchange

Length of output: 107


🏁 Script executed:

cat -n src/app/ui/portfolio/PortfolioTokensList.tsx

Repository: jumperexchange/jumper-exchange

Length of output: 2271


🏁 Script executed:

find . -type f \( -name "*.tsx" -o -name "*.ts" -o -name "*.jsx" -o -name "*.js" \) ! -path "*/node_modules/*" ! -path "*/.next/*" -exec grep -l "expandable\|Expandable" {} \;

Repository: jumperexchange/jumper-exchange

Length of output: 107


🏁 Script executed:

cat -n src/app/ui/portfolio/PortfolioPositionsList.tsx

Repository: jumperexchange/jumper-exchange

Length of output: 2943


🏁 Script executed:

find . -type f \( -name "*.tsx" -o -name "*.ts" \) ! -path "*/node_modules/*" ! -path "*/.next/*" | xargs grep -l "data-testid" | head -20

Repository: jumperexchange/jumper-exchange

Length of output: 1207


🏁 Script executed:

grep -r "Expandable" . --include="*.tsx" --include="*.ts" 2>/dev/null | grep -v node_modules | grep -v ".next"

Repository: jumperexchange/jumper-exchange

Length of output: 526


🏁 Script executed:

rg "expandable-section" src/ 2>/dev/null

Repository: jumperexchange/jumper-exchange

Length of output: 56


🏁 Script executed:

git log --oneline --all | head -20

Repository: jumperexchange/jumper-exchange

Length of output: 1244


🏁 Script executed:

git diff HEAD~5 --name-only 2>/dev/null | head -20

Repository: jumperexchange/jumper-exchange

Length of output: 56


🏁 Script executed:

git show --stat 9855e888

Repository: jumperexchange/jumper-exchange

Length of output: 50387


🏁 Script executed:

git show 9855e888 | head -100

Repository: jumperexchange/jumper-exchange

Length of output: 2403


🏁 Script executed:

git show 9855e888 --name-only | grep -i expandable

Repository: jumperexchange/jumper-exchange

Length of output: 150


🏁 Script executed:

git show 9855e888 | grep -A 30 "expandable-section"

Repository: jumperexchange/jumper-exchange

Length of output: 3749


Scope assertions to the section being clicked.

The tests click the first matching summary but assert against global [data-testid="expandable-section-item"] locators. If the page renders multiple expandable sections, these assertions can pass or fail based on another section's items. Scope both the click and the assertion to the same section parent.

Note: The suggested fix in the original comment references test IDs that don't currently exist in the codebase (portfolio-assets-expandable-section). Ensure the ExpandableSection component has appropriate stable section-level test IDs before applying the fix.

This applies to both the expand test (lines 23–30) and collapse test (lines 41–49).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/partneros-pr-2809.spec.ts` around lines 23 - 30, Scope the click and
assertions to the same ExpandableSection parent instead of using global
locators: locate the section element (e.g. the parent with a stable test id like
'expandable-section' or add one to the ExpandableSection component), then use
that section locator to find the summary used in the click (expandableHeader)
and the child items (expandable-section-item) for assertions; apply this change
in both the expand test (where expandableHeader and items are used) and the
collapse test so the click and waits operate on the same section instance.

Comment on lines +60 to +68
await test.step('click non-expandable section header and verify no items appear', async () => {
// A section with shouldExpand=false should not open
const nonExpandableHeader = page.locator('[data-testid="expandable-section-summary"][data-expandable="false"]').first();
if (await nonExpandableHeader.isVisible()) {
await nonExpandableHeader.click();
const items = page.locator('[data-testid="expandable-section-item"]');
// Should still be hidden
await expect(items.first()).toBeHidden();
}
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.

⚠️ Potential issue | 🟠 Major

Do not let missing target variants turn these tests into no-ops.

Both tests pass without making any assertion when the selector is absent or hidden. Since these cases are part of the stated coverage, assert the fixture exists first; for the icon test, use toHaveCount(0) to verify absence rather than merely hidden state.

Proposed fix
           // A section with shouldExpand=false should not open
           const nonExpandableHeader = page.locator('[data-testid="expandable-section-summary"][data-expandable="false"]').first();
-          if (await nonExpandableHeader.isVisible()) {
-            await nonExpandableHeader.click();
-            const items = page.locator('[data-testid="expandable-section-item"]');
-            // Should still be hidden
-            await expect(items.first()).toBeHidden();
-          }
+          await expect(nonExpandableHeader).toBeVisible();
+          await nonExpandableHeader.click();
+          const items = page.locator('[data-testid="expandable-section-item"]');
+          // Should still be hidden
+          await expect(items.first()).toBeHidden();
           const noIconSection = page.locator('[data-testid="expandable-section-no-icon"]').first();
-          if (await noIconSection.isVisible()) {
-            const expandIcon = noIconSection.locator('svg[data-testid="ExpandMoreIcon"]');
-            await expect(expandIcon).toBeHidden();
-          }
+          await expect(noIconSection).toBeVisible();
+          const expandIcon = noIconSection.locator('svg[data-testid="ExpandMoreIcon"]');
+          await expect(expandIcon).toHaveCount(0);

Also applies to: 79-84

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/partneros-pr-2809.spec.ts` around lines 60 - 68, The test is turning
into a no-op when the target selectors are missing or hidden; before interacting
assert the fixture exists (e.g., check nonExpandableHeader.count()/isVisible via
an expect on the locator) so the test fails if the selector is absent, then
proceed to click and assert items (locator
'[data-testid="expandable-section-item"]') remain hidden; for the icon/absence
case replace hidden assertions with a presence count assertion (use
toHaveCount(0) on the appropriate locator) to explicitly verify absence. Apply
the same pattern to the other test covering lines 79-84 (assert fixture exists
first, then use toHaveCount(0) for absence checks).

@github-actions
Copy link
Copy Markdown

Playwright test results

passed  47 passed
flaky  3 flaky
skipped  1 skipped

Details

stats  51 tests across 11 suites
duration  6 minutes
commit  9855e88

Flaky tests

chromium › mainMenu.spec.ts › Main Menu flows › Should be able to navigate to LI.FI Scan (Qase ID: 21)
chromium › mainMenu.spec.ts › Main Menu flows › Should be able to navigate to X (Qase ID: 16)
chromium › mainMenu.spec.ts › Main Menu flows › Should be able to navigate to Telegram (Qase ID: 18)

Skipped tests

chromium › themeManipulation.spec.ts › Switch between dark and light theme and check the background color › Partner theme should appear in theme menu and apply background color (Qase ID: 49)

📋 View Detailed Qase Report

@yordanove yordanove closed this Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant