diff --git a/packages/playwright-core/src/server/chromium/crApp.ts b/packages/playwright-core/src/server/chromium/crApp.ts
index 1ae096078c..bfa8819f2d 100644
--- a/packages/playwright-core/src/server/chromium/crApp.ts
+++ b/packages/playwright-core/src/server/chromium/crApp.ts
@@ -41,6 +41,9 @@ export async function syncLocalStorageWithSettings(page: Page, appName: string)
const settings = await fs.promises.readFile(settingsFile, 'utf-8').catch(() => ('{}'));
await page.addInitScript(
`(${String((settings: any) => {
+ // iframes w/ snapshots, etc.
+ if (location && location.protocol === 'data:')
+ return;
Object.entries(settings).map(([k, v]) => localStorage[k] = v);
(window as any).saveSettings = () => {
(window as any)._saveSerializedSettings(JSON.stringify({ ...localStorage }));
diff --git a/packages/trace-viewer/src/sw.ts b/packages/trace-viewer/src/sw.ts
index 488b8928b8..c778d09d34 100644
--- a/packages/trace-viewer/src/sw.ts
+++ b/packages/trace-viewer/src/sw.ts
@@ -42,9 +42,6 @@ async function loadTrace(traceUrl: string, traceFileName: string | null, clientI
try {
await traceModel.load(traceUrl, progress);
} catch (error: any) {
- // eslint-disable-next-line no-console
- console.error(error);
-
if (error?.message?.includes('Cannot find .trace file') && await traceModel.hasEntry('index.html'))
throw new Error('Could not load trace. Did you upload a Playwright HTML report instead? Make sure to extract the archive first and then double-click the index.html file or put it on a web server.');
else if (traceFileName)
diff --git a/packages/trace-viewer/src/ui/snapshotTab.css b/packages/trace-viewer/src/ui/snapshotTab.css
index a83e83d792..d51ae00f10 100644
--- a/packages/trace-viewer/src/ui/snapshotTab.css
+++ b/packages/trace-viewer/src/ui/snapshotTab.css
@@ -153,4 +153,5 @@ body.dark-mode .window-header {
.snapshot-tab .cm-wrapper {
line-height: 23px;
+ margin-right: 4px;
}
diff --git a/packages/trace-viewer/src/ui/snapshotTab.tsx b/packages/trace-viewer/src/ui/snapshotTab.tsx
index 7a4cac8c7e..eefa47bd70 100644
--- a/packages/trace-viewer/src/ui/snapshotTab.tsx
+++ b/packages/trace-viewer/src/ui/snapshotTab.tsx
@@ -137,7 +137,6 @@ export const SnapshotTab: React.FunctionComponent<{
setHighlightedLocator('');
setIsInspecting(!pickerVisible);
}}>Pick locator
-
{['action', 'before', 'after'].map(tab => {
return ,
hideStackFrames?: boolean,
+ rootDir?: string,
fallbackLocation?: StackFrame,
-}> = ({ action, sources, hideStackFrames, fallbackLocation }) => {
+}> = ({ action, sources, hideStackFrames, rootDir, fallbackLocation }) => {
const [lastAction, setLastAction] = React.useState();
const [selectedFrame, setSelectedFrame] = React.useState(0);
@@ -41,7 +42,7 @@ export const SourceTab: React.FunctionComponent<{
}
}, [action, lastAction, setLastAction, setSelectedFrame]);
- const { source, targetLine, highlight } = useAsyncMemo<{ source: SourceModel, targetLine: number, highlight: SourceHighlight[] }>(async () => {
+ const { source, highlight, targetLine, fileName } = useAsyncMemo<{ source: SourceModel, targetLine?: number, fileName?: string, highlight: SourceHighlight[] }>(async () => {
const location = action?.stack?.[selectedFrame] || fallbackLocation;
if (!location?.file)
return { source: { errors: [], content: undefined }, targetLine: 0, highlight: [] };
@@ -54,6 +55,7 @@ export const SourceTab: React.FunctionComponent<{
}
const targetLine = location.line || 0;
+ const fileName = rootDir && location.file.startsWith(rootDir) ? location.file.substring(rootDir.length + 1) : location.file;
const highlight: SourceHighlight[] = source.errors.map(e => ({ type: 'error', line: e.location.line, message: e.error!.message }));
highlight.push({ line: targetLine, type: 'running' });
@@ -68,11 +70,14 @@ export const SourceTab: React.FunctionComponent<{
source.content = ``;
}
}
- return { source, targetLine, highlight };
- }, [action, selectedFrame, fallbackLocation], { source: { errors: [], content: 'Loading\u2026' }, targetLine: 0, highlight: [] });
+ return { source, highlight, targetLine, fileName };
+ }, [action, selectedFrame, rootDir, fallbackLocation], { source: { errors: [], content: 'Loading\u2026' }, highlight: [] });
return
-
+
+ {fileName &&
{fileName}
}
+
+
;
};
diff --git a/packages/trace-viewer/src/ui/watchMode.css b/packages/trace-viewer/src/ui/watchMode.css
index ed8cbc0e96..f94e490c5a 100644
--- a/packages/trace-viewer/src/ui/watchMode.css
+++ b/packages/trace-viewer/src/ui/watchMode.css
@@ -40,16 +40,9 @@
overflow: hidden
}
-.watch-mode-sidebar .toolbar {
- min-height: 24px;
-}
-
-.watch-mode-sidebar .toolbar-button {
- margin: 0;
-}
-
.watch-mode .section-title {
display: flex;
+ flex: auto;
flex-direction: row;
align-items: center;
font-size: 11px;
@@ -58,6 +51,7 @@
text-overflow: ellipsis;
overflow: hidden;
padding: 8px;
+ height: 30px;
}
.watch-mode-sidebar img {
@@ -68,20 +62,19 @@
}
.status-line {
- flex: none;
+ flex: auto;
+ white-space: nowrap;
line-height: 22px;
- padding: 0 10px;
- color: var(--vscode-statusBar-foreground);
- background-color: var(--vscode-statusBar-background);
+ padding-left: 10px;
display: flex;
flex-direction: row;
align-items: center;
+ height: 30px;
}
.status-line > div {
- display: flex;
- align-items: center;
- margin: 0 5px;
+ overflow: hidden;
+ text-overflow: ellipsis;
}
.list-view-entry:not(.highlighted):not(.selected) .toolbar-button:not(.toggled) {
@@ -103,7 +96,6 @@
flex: none;
display: flex;
flex-direction: column;
- margin-top: 8px;
}
.filter-title,
@@ -120,7 +112,7 @@
}
.filter-summary {
- line-height: 24px;
+ line-height: 21px;
margin-top: 2px;
margin-left: 20px;
}
diff --git a/packages/trace-viewer/src/ui/watchMode.tsx b/packages/trace-viewer/src/ui/watchMode.tsx
index 5e3d7083e4..a3769c3648 100644
--- a/packages/trace-viewer/src/ui/watchMode.tsx
+++ b/packages/trace-viewer/src/ui/watchMode.tsx
@@ -22,7 +22,7 @@ import { TreeView } from '@web/components/treeView';
import type { TreeState } from '@web/components/treeView';
import { baseFullConfig, TeleReporterReceiver, TeleSuite } from '@testIsomorphic/teleReceiver';
import type { TeleTestCase } from '@testIsomorphic/teleReceiver';
-import type { FullConfig, Suite, TestCase, TestResult, Location } from '../../../playwright-test/types/testReporter';
+import type { FullConfig, Suite, TestCase, Location } from '../../../playwright-test/types/testReporter';
import { SplitView } from '@web/components/splitView';
import { MultiTraceModel } from './modelUtil';
import './watchMode.css';
@@ -36,7 +36,7 @@ import { toggleTheme } from '@web/theme';
import { artifactsFolderName } from '@testIsomorphic/folders';
import { settings } from '@web/uiUtils';
-let updateRootSuite: (config: FullConfig, rootSuite: Suite, progress: Progress) => void = () => {};
+let updateRootSuite: (config: FullConfig, rootSuite: Suite, progress: Progress | undefined) => void = () => {};
let runWatchedTests = (fileName: string) => {};
let xtermSize = { cols: 80, rows: 24 };
@@ -67,17 +67,17 @@ export const WatchModeView: React.FC<{}> = ({
]));
const [projectFilters, setProjectFilters] = React.useState