Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

feat(trace): account for more action types in timeline (#5077)

Dmitry Gozman16249ccbdae3
diff --git a/src/cli/traceViewer/web/ui/timeline.css b/src/cli/traceViewer/web/ui/timeline.css
index 3e0e7bc267..f8d0f71774 100644
--- a/src/cli/traceViewer/web/ui/timeline.css
+++ b/src/cli/traceViewer/web/ui/timeline.css
@@ -82,16 +82,28 @@
box-shadow: 0 0 0 1px var(--action-color);
}
-.timeline-bar.click {
+.timeline-bar.click,
+.timeline-bar.dblclick,
+.timeline-bar.hover,
+.timeline-bar.check,
+.timeline-bar.uncheck,
+.timeline-bar.tap {
--action-color: var(--green);
}
.timeline-bar.fill,
-.timeline-bar.press {
+.timeline-bar.press,
+.timeline-bar.type,
+.timeline-bar.selectOption,
+.timeline-bar.setInputFiles {
--action-color: var(--orange);
}
-.timeline-bar.goto {
+.timeline-bar.goto,
+.timeline-bar.setContent,
+.timeline-bar.goBack,
+.timeline-bar.goForward,
+.timeline-bar.reload {
--action-color: var(--blue);
}
diff --git a/src/cli/traceViewer/web/ui/timeline.tsx b/src/cli/traceViewer/web/ui/timeline.tsx
index 0af664cb50..ce784a72f3 100644
--- a/src/cli/traceViewer/web/ui/timeline.tsx
+++ b/src/cli/traceViewer/web/ui/timeline.tsx
@@ -55,13 +55,16 @@ export const Timeline: React.FunctionComponent<{
const bars: TimelineBar[] = [];
for (const page of context.pages) {
for (const entry of page.actions) {
+ let detail = entry.action.selector || '';
+ if (entry.action.action === 'goto')
+ detail = entry.action.value || '';
bars.push({
entry,
leftTime: entry.action.startTime,
rightTime: entry.action.endTime,
leftPosition: timeToPosition(measure.width, boundaries, entry.action.startTime),
rightPosition: timeToPosition(measure.width, boundaries, entry.action.endTime),
- label: entry.action.action + ' ' + (entry.action.selector || entry.action.value || ''),
+ label: entry.action.action + ' ' + detail,
type: entry.action.action,
priority: 0,
});
diff --git a/src/cli/traceViewer/web/ui/workbench.tsx b/src/cli/traceViewer/web/ui/workbench.tsx
index c6a1cae45c..5820a50c66 100644
--- a/src/cli/traceViewer/web/ui/workbench.tsx
+++ b/src/cli/traceViewer/web/ui/workbench.tsx
@@ -36,7 +36,7 @@ export const Workbench: React.FunctionComponent<{
return actions;
}, [context]);
- const snapshotSize = context.created.viewportSize!;
+ const snapshotSize = context.created.viewportSize || { width: 1280, height: 720 };
return <div className='vbox workbench'>
<div className='hbox header'>