Skip to content

Commit 18ce214

Browse files
committed
chore: trying to fix windows errors
1 parent d25b7c6 commit 18ce214

4 files changed

Lines changed: 23 additions & 2 deletions

File tree

src/McpContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ import type {
3434
Viewport,
3535
Target,
3636
Extension,
37+
Root,
3738
} from './third_party/index.js';
38-
import type {DevTools} from './third_party/index.js';
3939
import {Locator} from './third_party/index.js';
4040
import {PredefinedNetworkConditions} from './third_party/index.js';
4141
import {listPages} from './tools/pages.js';

src/tools/console.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ export const listConsoleMessages = definePageTool(cliArgs => {
7777
.describe(
7878
'Set to true to return the preserved messages over the last 3 navigations.',
7979
),
80+
serviceWorkerId: zod
81+
.string()
82+
.optional()
83+
.describe('Filter messages to only return messages of the specified service worker.'),
8084
},
8185
blockedByDialog: false,
8286
handler: async (request, response) => {
@@ -85,6 +89,7 @@ export const listConsoleMessages = definePageTool(cliArgs => {
8589
pageIdx: request.params.pageIdx,
8690
types: request.params.types,
8791
includePreservedMessages: request.params.includePreservedMessages,
92+
serviceWorkerId: request.params.serviceWorkerId,
8893
});
8994
},
9095
};

src/tools/input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ async function fillFormElement(
274274

275275
if (isToggle) {
276276
if (['true', 'false'].includes(value)) {
277-
await handle.asLocator().fill(value === 'true');
277+
await handle.asLocator().fill(value);
278278
} else {
279279
throw new Error(
280280
`Checkboxes, radio boxes and toggles require "true" or "false" value, but ${value} was used`,

tests/tools/console.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,14 @@ import {
2525
getTextContent,
2626
withMcpContext,
2727
stabilizeStructuredContent,
28+
extractExtensionId,
2829
} from '../utils.js';
2930

31+
const EXTENSION_LOGGING_PATH = path.join(
32+
import.meta.dirname,
33+
'../../../tests/tools/fixtures/extension-logging',
34+
);
35+
3036
describe('console', () => {
3137
before(async () => {
3238
await loadIssueDescriptions();
@@ -60,6 +66,16 @@ describe('console', () => {
6066
await context.triggerExtensionAction(extensionId);
6167
const worker = await swTarget.worker();
6268

69+
// On Windows, the service worker context might not be fully initialized
70+
// with all global APIs yet.
71+
await worker?.evaluate(`
72+
(async () => {
73+
while (typeof globalThis.setTimeout !== 'function') {
74+
await new Promise(resolve => Promise.resolve().then(resolve));
75+
}
76+
})()
77+
`);
78+
6379
await worker?.evaluate(
6480
`
6581
console.log('Service Worker starting...');

0 commit comments

Comments
 (0)