|
| 1 | +import { expect, test } from '@playwright/test'; |
| 2 | + |
| 3 | +test('test', async ({ page }) => { |
| 4 | + await page.goto('http://localhost:6006/iframe.html?globals=&args=&id=pid-component--default&viewMode=story'); |
| 5 | + await expect(page.locator('body')).toMatchAriaSnapshot(` |
| 6 | + - text: /This component displays information about the identifier \\d+\\.\\d+\\/B88E78D4-E1EE-40F7-96CE-EC1AFCFF6343\\. It can be expanded to show more details\\./ |
| 7 | + - group: |
| 8 | + - text: /\\d+\\.\\d+ \\/ B88E78D4-E1EE-40F7-96CE-EC1AFCFF6343/ |
| 9 | + - button "Copy content to clipboard" |
| 10 | + `); |
| 11 | + await expect(page.locator('body')).toBeVisible(); |
| 12 | + await page.locator('summary svg').click(); |
| 13 | + await expect(page.locator('.flex-grow').first()).toBeVisible(); |
| 14 | + await page.locator('.flex.items-center.justify-between.gap-2.p-2').click(); |
| 15 | + await page.getByRole('navigation', { name: 'Pagination controls and' }).click(); |
| 16 | + await expect(page.getByLabel('Pagination controls for 21.11152/B88E78D4-E1EE-40F7-96CE-EC1AFCFF6343 data').getByLabel('Pagination controls and')).toMatchAriaSnapshot(` |
| 17 | + - navigation "Pagination controls and display settings": |
| 18 | + - group "Items per page options": |
| 19 | + - toolbar "Items per page:": |
| 20 | + - button "Show 5 items per page" |
| 21 | + - button /Show \\d+ items per page/ [pressed] |
| 22 | + - button /Show \\d+ items per page/ |
| 23 | + - button /Show \\d+ items per page/ |
| 24 | + - button /Show \\d+ items per page/ |
| 25 | + - status: /Showing 1-\\d+ of \\d+/ |
| 26 | + - navigation "Pagination": |
| 27 | + - button "Previous page" [disabled] |
| 28 | + - button "Page 1" |
| 29 | + - button "Page 2" |
| 30 | + - button "Next page" |
| 31 | + `); |
| 32 | + await page.locator('.flex.items-center.justify-between.gap-2.p-2').click(); |
| 33 | + await page.getByLabel('Collapsible section for [').locator('summary svg').click(); |
| 34 | + await expect(page.getByLabel('Collapsible section for [').locator('div').filter({ hasText: 'Could not display JSON data.' }).first()).toBeVisible(); |
| 35 | + await expect(page.getByLabel('Collapsible section for [').locator('details')).toMatchAriaSnapshot(` |
| 36 | + - group: |
| 37 | + - text: "Object { 2 items }" |
| 38 | + - region "JSON Viewer": |
| 39 | + - text: JSON Viewer (1 property) |
| 40 | + - button "Switch to code view" |
| 41 | + - group "JSON data in tree view": |
| 42 | + - button "Copy JSON to clipboard" |
| 43 | + - 'treeitem "sha160sum: \\"sha160 6f1f5d3c9540b85f47ae08c7a5b9aa151b818a97\\" (string)"' |
| 44 | + `); |
| 45 | +}); |
0 commit comments