This repository was archived by the owner on Jul 23, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 206
Expand file tree
/
Copy pathpartneros-pr-2809.spec.ts
More file actions
89 lines (83 loc) · 3.71 KB
/
Copy pathpartneros-pr-2809.spec.ts
File metadata and controls
89 lines (83 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { expect, test } from '@playwright/test';
import { qase } from 'playwright-qase-reporter';
import { closeWelcomeScreen } from './testData/landingPageFunctions';
[
{ name: 'Mobile', size: { width: 375, height: 812 } },
{ name: 'Desktop', size: { width: 1920, height: 1080 } },
].forEach(({ name, size }) => {
test.describe(`ExpandableSection — Portfolio Assets [Viewport: ${name}]`, () => {
test.use({ viewport: { width: size.width, height: size.height } });
test.beforeEach(async ({ page }) => {
await page.goto('/');
await closeWelcomeScreen(page);
});
test(
qase(0 /* TODO: assign Qase ID */, 'expandable section expands to reveal asset items on click'),
async ({ page }) => {
await test.step('navigate to portfolio page', async () => {
await page.goto('/portfolio');
});
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' });
});
},
);
test(
qase(0 /* TODO: assign Qase ID */, 'expandable section collapses on second click'),
async ({ page }) => {
await test.step('navigate to portfolio page', async () => {
await page.goto('/portfolio');
});
await test.step('expand then collapse section', async () => {
const expandableHeader = page.locator('[data-testid="expandable-section-summary"]').first();
await expandableHeader.waitFor({ state: 'visible' });
await expandableHeader.click();
await expandableHeader.click();
});
await test.step('items are hidden after collapse', async () => {
const items = page.locator('[data-testid="expandable-section-item"]');
await expect(items.first()).toBeHidden();
});
},
);
test(
qase(0 /* TODO: assign Qase ID */, 'non-expandable section does not respond to header click'),
async ({ page }) => {
await test.step('navigate to portfolio page', async () => {
await page.goto('/portfolio');
});
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();
}
});
},
);
test(
qase(0 /* TODO: assign Qase ID */, 'expand icon is absent when showExpandIcon is false'),
async ({ page }) => {
await test.step('navigate to portfolio page', async () => {
await page.goto('/portfolio');
});
await test.step('check that no expand icon is rendered on icon-hidden sections', async () => {
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();
}
});
},
);
});
});