-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Expand file tree
/
Copy pathextensions.test.ts
More file actions
46 lines (39 loc) · 1.36 KB
/
extensions.test.ts
File metadata and controls
46 lines (39 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import assert from 'node:assert';
import path from 'node:path';
import {describe, it} from 'node:test';
import {installExtension} from '../../src/tools/extensions.js';
import {withMcpContext} from '../utils.js';
const EXTENSION_PATH = path.join(
import.meta.dirname,
'../../../tests/tools/fixtures/extension',
);
describe('extension', () => {
it('installs an extension and verifies it is listed in chrome://extensions', async () => {
await withMcpContext(async (response, context) => {
await installExtension.handler(
{params: {path: EXTENSION_PATH}},
response,
context,
);
const responseLine = response.responseLines[0];
assert.ok(responseLine, 'Response should not be empty');
const match = responseLine.match(/Extension installed\. Id: (.+)/);
const extensionId = match ? match[1] : null;
assert.ok(extensionId, 'Response should contain a valid key');
const page = context.getSelectedPage();
await page.goto('chrome://extensions');
const element = await page.waitForSelector(
`extensions-manager >>> extensions-item[id="${extensionId}"]`,
);
assert.ok(
element,
`Extension with ID "${extensionId}" should be visible on chrome://extensions`,
);
});
});
});