-
Notifications
You must be signed in to change notification settings - Fork 0
feat(events): add the shared execution inspector, stable chronology, grouped filters, bounded optional context and traces, and explicit lifecycle correlation. #39
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
Merged
+2,745
−25
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
44da070
feat(events): add the shared execution inspector, stable chronology, …
terabytesoftw b71bafd
Raise code coverage '100%´.
terabytesoftw 29f90d8
Fix error typo.
terabytesoftw 007ea50
Apply fixed Coderabbitai review.
terabytesoftw fedb1a7
Apply fixed Coderabbitai review.
terabytesoftw 5501f8a
Refactor Event Inspector Renderer and Introduce PanelMessage Enum.
terabytesoftw 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
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
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
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,111 @@ | ||
| import AxeBuilder from "@axe-core/playwright"; | ||
| import { expect, test } from "@playwright/test"; | ||
|
|
||
| import { debugApps } from "./support/environment.js"; | ||
| import { expandToolbar, waitForToolbar } from "./support/debug-ui.js"; | ||
|
|
||
| for (const app of debugApps()) { | ||
| for (const theme of ["light", "dark"]) { | ||
| test(`${app.name} ${theme} event table preserves chronology and accessible controls`, async ({ | ||
| page, | ||
| }) => { | ||
| await page.goto(app.baseURL); | ||
| const toolbar = await waitForToolbar(page); | ||
| await expandToolbar(toolbar); | ||
| const eventLink = toolbar.locator('a[href*="panel=event"]').first(); | ||
| await expect(eventLink).toBeAttached(); | ||
| const href = await eventLink.getAttribute("href"); | ||
| expect(href).toBeTruthy(); | ||
| const url = new URL(href, app.baseURL); | ||
| url.searchParams.set("yii_debug_theme", theme); | ||
| url.searchParams.set("per-page", "10"); | ||
| await page.goto(url.href); | ||
|
|
||
| const grid = page.locator(".yii-debug-grid-event"); | ||
| const items = grid.locator(".yii-debug-event-item"); | ||
| await expect(grid).toBeVisible(); | ||
| await expect(grid.locator("table")).toHaveCount(1); | ||
| await expect(items).toHaveCount(10); | ||
| await expect( | ||
| page.locator(".yii-debug-event-raw, .yii-debug-event-flow"), | ||
| ).toHaveCount(0); | ||
| await expect(grid.locator('input[name="Event[class]"]')).toBeVisible(); | ||
| await expect(items.first()).toHaveAttribute("id", "event-1"); | ||
| await expect(grid.locator("tbody tr").first()).toContainText("+0.000 ms"); | ||
| const summary = items.first().locator(":scope > summary"); | ||
| const detail = grid.locator("#event-1-detail"); | ||
| await expect(detail).toBeHidden(); | ||
| await summary.focus(); | ||
| await page.keyboard.press("Enter"); | ||
| await expect(items.first()).toHaveAttribute("open", ""); | ||
| await expect(summary).toHaveAttribute("aria-controls", "event-1-detail"); | ||
| await expect(detail).toBeVisible(); | ||
| await expect(detail).toContainText("Context"); | ||
| await expect(detail).toContainText("Source trace"); | ||
| await expect(detail).toContainText("Not captured"); | ||
| await expect(detail).not.toContainText("Event name"); | ||
| await expect(detail).not.toContainText("Observed at"); | ||
|
|
||
| const layout = await detail.evaluate((element) => { | ||
| const context = element.querySelector(".yii-debug-event-context"); | ||
| const trace = element.querySelector(".yii-debug-event-trace"); | ||
| const table = element.closest("table"); | ||
| return { | ||
| width: element.getBoundingClientRect().width, | ||
| tableWidth: table.getBoundingClientRect().width, | ||
| context: context.getBoundingClientRect().toJSON(), | ||
| trace: trace.getBoundingClientRect().toJSON(), | ||
| stacked: window.matchMedia("(width < 768px)").matches, | ||
| }; | ||
| }); | ||
| expect(Math.abs(layout.width - layout.tableWidth)).toBeLessThan(4); | ||
| if (layout.stacked) { | ||
| expect(layout.trace.top).toBeGreaterThanOrEqual(layout.context.bottom); | ||
| } else { | ||
| expect(layout.trace.left).toBeGreaterThan(layout.context.right); | ||
| expect(layout.trace.top).toEqual(layout.context.top); | ||
| } | ||
|
|
||
| const audit = await new AxeBuilder({ page }) | ||
| .include(".yii-debug-grid-event") | ||
| .withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"]) | ||
| .analyze(); | ||
| expect(audit.violations).toEqual([]); | ||
| const overflow = await page.evaluate( | ||
| () => | ||
| document.documentElement.scrollWidth > | ||
| document.documentElement.clientWidth + 1, | ||
| ); | ||
| expect(overflow, "The event table must not overflow the document").toBe( | ||
| false, | ||
| ); | ||
| await summary.press("Enter"); | ||
| await expect(items.first()).not.toHaveAttribute("open", ""); | ||
| await expect(detail).toBeHidden(); | ||
|
|
||
| const secondPage = page.getByRole("link", { name: "2", exact: true }); | ||
| await expect(secondPage).toBeVisible(); | ||
| await secondPage.click(); | ||
| await expect( | ||
| page.locator(".yii-debug-event-item").first(), | ||
| ).toHaveAttribute("id", "event-11"); | ||
|
|
||
| await page.getByText("Group filters", { exact: true }).click(); | ||
| const firstGroup = page.locator(".yii-debug-event-group[href]").first(); | ||
| const filterURL = await firstGroup.getAttribute("href"); | ||
| expect(filterURL).toBeTruthy(); | ||
| await page.goto(new URL(filterURL, app.baseURL).href); | ||
| await expect(page.locator(".yii-debug-grid-event")).toBeVisible(); | ||
| expect(new URL(page.url()).searchParams.has("page")).toBe(false); | ||
| const classFilter = page.locator('input[name="Event[class]"]'); | ||
| await classFilter.fill("__no_such_event__"); | ||
| await classFilter.press("Enter"); | ||
| await expect(page.locator(".yii-debug-event-item")).toHaveCount(0); | ||
| await expect(page.locator(".yii-debug-active-filters")).toBeVisible(); | ||
| await page.goto(new URL(filterURL, app.baseURL).href); | ||
| await expect( | ||
| page.locator(".yii-debug-event-item").first(), | ||
| ).toHaveAttribute("id", /event-\d+/); | ||
| }); | ||
| } | ||
| } |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,135 @@ | ||
| /* Event diagnostics extend the shared table without duplicating captured rows. */ | ||
| .yii-debug .yii-debug-event-controls { | ||
| margin-block: var(--yii-debug-space-4); | ||
| font-size: var(--yii-debug-fs-xs); | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-groups { | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| align-items: center; | ||
| gap: var(--yii-debug-space-2); | ||
| margin-block: var(--yii-debug-space-4); | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-group { | ||
| display: inline-flex; | ||
| align-items: center; | ||
| gap: var(--yii-debug-space-2); | ||
| min-height: var(--yii-debug-control-min-size); | ||
| padding: var(--yii-debug-space-1) var(--yii-debug-space-2); | ||
| border: var(--yii-debug-border); | ||
| border-radius: var(--yii-debug-radius-pill); | ||
| background: var(--yii-debug-panel-surface-muted); | ||
| overflow-wrap: anywhere; | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-item > summary { | ||
| cursor: pointer; | ||
| list-style: none; | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-item > summary:focus-visible { | ||
| outline: 2px solid var(--yii-debug-panel-primary); | ||
| outline-offset: 4px; | ||
| border-radius: var(--yii-debug-radius-sm); | ||
| } | ||
|
|
||
| .yii-debug :is(.yii-debug-event-clock, .yii-debug-event-identity) { | ||
| display: grid; | ||
| gap: var(--yii-debug-space-1); | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-clock { | ||
| min-width: 105px; | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-time { | ||
| white-space: nowrap; | ||
| color: var(--yii-debug-panel-primary); | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-identity { | ||
| min-width: 0; | ||
| overflow-wrap: anywhere; | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-name::before { | ||
| content: "+ "; | ||
| color: var(--yii-debug-panel-primary); | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-item[open] .yii-debug-event-name::before { | ||
| content: "− "; | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-timing { | ||
| font-size: var(--yii-debug-fs-xs); | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-detail-row { | ||
| display: none; | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-table tr:has(.yii-debug-event-item[open]) + .yii-debug-event-detail-row { | ||
| display: table-row; | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-table .yii-debug-event-detail-row > td { | ||
| padding: 0; | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-detail { | ||
| display: grid; | ||
| grid-template-columns: repeat(2, minmax(0, 1fr)); | ||
| gap: var(--yii-debug-space-4); | ||
| padding: var(--yii-debug-space-4); | ||
| background: var(--yii-debug-panel-surface-muted); | ||
| white-space: normal; | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-detail > div { | ||
| min-width: 0; | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-detail-footer { | ||
| display: flex; | ||
| grid-column: 1 / -1; | ||
| flex-wrap: wrap; | ||
| gap: var(--yii-debug-space-2) var(--yii-debug-space-4); | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-metadata { | ||
| display: grid; | ||
| grid-template-columns: minmax(75px, 0.4fr) minmax(0, 1fr); | ||
| gap: var(--yii-debug-space-2) var(--yii-debug-space-3); | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-metadata dt { | ||
| color: var(--yii-debug-panel-muted); | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-metadata dd { | ||
| margin: 0; | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-trace pre { | ||
| white-space: pre-wrap; | ||
| overflow-wrap: anywhere; | ||
| } | ||
|
|
||
| .yii-debug :is(.yii-debug-event-context, .yii-debug-event-trace) > :last-child { | ||
| margin-bottom: 0; | ||
| } | ||
|
|
||
| @media (width < 768px) { | ||
| .yii-debug .yii-debug-event-detail { | ||
| grid-template-columns: minmax(0, 1fr); | ||
| } | ||
| } | ||
|
|
||
| .yii-debug .yii-debug-event-coverage > summary { | ||
| min-height: var(--yii-debug-control-min-size); | ||
| padding-block: var(--yii-debug-space-2); | ||
| cursor: pointer; | ||
| } |
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
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
Oops, something went wrong.
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.