Skip to content

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

fix(dashboard): omnibox URL bar doesn't accept typing in interactive mode (#40627)

Copilot69df4d07557c
diff --git a/packages/dashboard/src/dashboard.tsx b/packages/dashboard/src/dashboard.tsx
index 8b1d49d11c..184e536a20 100644
--- a/packages/dashboard/src/dashboard.tsx
+++ b/packages/dashboard/src/dashboard.tsx
@@ -165,6 +165,11 @@ export const Dashboard: React.FC<DashboardProps> = ({ model }) => {
const selectedTab = tabs?.find(t => t.selected);
const ready = !!selectedTab;
+ const [omniboxValue, setOmniboxValue] = React.useState(selectedTab?.url ?? '');
+ React.useEffect(() => {
+ setOmniboxValue(selectedTab?.url ?? '');
+ }, [selectedTab?.url]);
+
function imgCoords(e: React.MouseEvent): { x: number; y: number } {
const vw = liveFrame?.viewportWidth ?? 0;
const vh = liveFrame?.viewportHeight ?? 0;
@@ -331,8 +336,8 @@ export const Dashboard: React.FC<DashboardProps> = ({ model }) => {
placeholder='Search or enter URL'
spellCheck={false}
autoComplete='off'
- value={selectedTab?.url}
- onChange={() => {}}
+ value={omniboxValue}
+ onChange={e => setOmniboxValue(e.target.value)}
onKeyDown={e => {
if (!interactive)
return;
diff --git a/tests/mcp/dashboard.spec.ts b/tests/mcp/dashboard.spec.ts
index 4f3887a5e5..dd25d767e0 100644
--- a/tests/mcp/dashboard.spec.ts
+++ b/tests/mcp/dashboard.spec.ts
@@ -474,6 +474,28 @@ async function installSaveFilePickerMock(page: import('playwright-core').Page):
};
}
+test('should allow typing in omnibox in interactive mode', async ({ cli, server, startDashboardServer }) => {
+ server.setContent('/page1', '<html><body>Page 1</body></html>', 'text/html');
+ server.setContent('/page2', '<html><body>Page 2</body></html>', 'text/html');
+ await cli('open', server.PREFIX + '/page1');
+
+ const dashboard = await startDashboardServer();
+ await dashboard.getByRole('navigation', { name: 'Sessions' }).getByRole('option').first().click();
+ await expect(dashboard.locator('#omnibox')).toHaveValue(/page1/);
+
+ // Enter interactive mode.
+ await dashboard.getByRole('button', { name: 'Enable interactive mode' }).click();
+ await expect(dashboard.getByRole('main')).toHaveClass(/interactive/);
+
+ const schemeless = `${server.HOST}/page2`;
+ await dashboard.locator('#omnibox').click();
+ await dashboard.locator('#omnibox').fill(schemeless);
+ await expect(dashboard.locator('#omnibox')).toHaveValue(schemeless);
+
+ await dashboard.locator('#omnibox').press('Enter');
+ await expect(dashboard.locator('#omnibox')).toHaveValue(server.PREFIX + '/page2', { timeout: 10000 });
+});
+
test('save recording streams WebM bytes to the chosen file', async ({ cli, server, page, startDashboardServer }) => {
await cli('open', server.EMPTY_PAGE);
const awaitBytes = await installSaveFilePickerMock(page);