Skip to content

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

fix(trace-viewer): show warning when opening an empty trace (#9449)

Max Schmitt34e933f4744b
diff --git a/packages/playwright-core/src/web/traceViewer/ui/actionList.css b/packages/playwright-core/src/web/traceViewer/ui/actionList.css
index f1bb3b9889..c530eafb27 100644
--- a/packages/playwright-core/src/web/traceViewer/ui/actionList.css
+++ b/packages/playwright-core/src/web/traceViewer/ui/actionList.css
@@ -122,3 +122,15 @@
.action-entry .codicon-warning {
color: darkorange;
}
+
+.no-actions-entry {
+ height: 400px;
+ display: grid;
+ place-items: center;
+ text-align: center;
+}
+
+.no-actions-entry-text {
+ font-weight: bold;
+ font-size: 1.3rem;
+}
diff --git a/packages/playwright-core/src/web/traceViewer/ui/actionList.tsx b/packages/playwright-core/src/web/traceViewer/ui/actionList.tsx
index 69522616d4..b62f333261 100644
--- a/packages/playwright-core/src/web/traceViewer/ui/actionList.tsx
+++ b/packages/playwright-core/src/web/traceViewer/ui/actionList.tsx
@@ -45,7 +45,7 @@ export const ActionList: React.FC<ActionListProps> = ({
}, [selectedAction, actionListRef]);
return <div className='action-list vbox'>
- <div className='.action-list-title tab-strip'>
+ <div className='action-list-title tab-strip'>
<div className='tab-element'>
<div className='tab-label'>Actions</div>
</div>
@@ -72,6 +72,16 @@ export const ActionList: React.FC<ActionListProps> = ({
}}
ref={actionListRef}
>
+ {actions.length === 0 && <div className='no-actions-entry'>
+ <div>
+ <div className='no-actions-entry-text'>
+ No actions recorded
+ </div>
+ <div>
+ Make sure that the right context was used when recording the trace.
+ </div>
+ </div>
+ </div>}
{actions.map(action => {
const { metadata } = action;
const selectedSuffix = action === selectedAction ? ' selected' : '';