fix(trace viewer): reveal stack for highlighted action (#32919)
Closes https://github.com/microsoft/playwright/issues/32915.
In the `Call` and `Logs` tabs, we update the contents based on the
hovered action. We document that this is also the case for the `Source`
tab:
78054a7652/docs/src/test-ui-mode-js.md
?plain=1#L61-L65
But it isn't. Not sure if it's a regression or not, but this PR fixes
it.
This commit is contained in:
parent
6373fe703d
commit
3a5bf1cc1d
|
@ -114,16 +114,16 @@ export const Workbench: React.FunctionComponent<{
|
|||
}
|
||||
}, [model, selectedCallId]);
|
||||
|
||||
const revealedStack = React.useMemo(() => {
|
||||
if (revealedError)
|
||||
return revealedError.stack;
|
||||
return selectedAction?.stack;
|
||||
}, [selectedAction, revealedError]);
|
||||
|
||||
const activeAction = React.useMemo(() => {
|
||||
return highlightedAction || selectedAction;
|
||||
}, [selectedAction, highlightedAction]);
|
||||
|
||||
const revealedStack = React.useMemo(() => {
|
||||
if (revealedError)
|
||||
return revealedError.stack;
|
||||
return activeAction?.stack;
|
||||
}, [activeAction, revealedError]);
|
||||
|
||||
const onActionSelected = React.useCallback((action: modelUtil.ActionTraceEventInContext) => {
|
||||
setSelectedAction(action);
|
||||
setHighlightedAction(undefined);
|
||||
|
|
|
@ -76,6 +76,11 @@ class TraceViewerPage {
|
|||
await this.page.locator(`.action-title:has-text("${title}")`).nth(ordinal).click();
|
||||
}
|
||||
|
||||
@step
|
||||
async hoverAction(title: string, ordinal: number = 0) {
|
||||
await this.page.locator(`.action-title:has-text("${title}")`).nth(ordinal).hover();
|
||||
}
|
||||
|
||||
@step
|
||||
async selectSnapshot(name: string) {
|
||||
await this.page.click(`.snapshot-tab .tabbed-pane-tab-label:has-text("${name}")`);
|
||||
|
|
|
@ -864,6 +864,9 @@ test('should show action source', async ({ showTraceViewer }) => {
|
|||
await page.click('text=Source');
|
||||
await expect(page.locator('.source-line-running')).toContainText('await page.getByText(\'Click\').click()');
|
||||
await expect(page.getByTestId('stack-trace-list').locator('.list-view-entry.selected')).toHaveText(/doClick.*trace-viewer\.spec\.ts:[\d]+/);
|
||||
|
||||
await traceViewer.hoverAction('page.waitForNavigation');
|
||||
await expect(page.locator('.source-line-running')).toContainText('page.waitForNavigation()');
|
||||
});
|
||||
|
||||
test('should follow redirects', async ({ page, runAndTrace, server, asset }) => {
|
||||
|
|
Loading…
Reference in New Issue