"use strict";
// Copyright 2026 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const path = __importStar(require("node:path"));
const paths_js_1 = require("../../conductor/paths.js");
describe('Mock Extension Loading', () => {
    // Path to the dummy extension in its new home
    const extensionPath = path.join(paths_js_1.SOURCE_ROOT, 'test/e2e/resources/extensions/dummy_ext');
    setup({
        extensions: [extensionPath],
    });
    it('can load the extension, inject content script, log to console, and style elements in OTR', async ({ inspectedPage }) => {
        const consoleMessages = [];
        // Listen to console events on the inspected page
        inspectedPage.page.on('console', msg => {
            consoleMessages.push(msg.text());
        });
        // Navigate to a page to trigger injection
        await inspectedPage.goToResource('empty.html');
        // 1. Verify console log from content script
        chai_1.assert.include(consoleMessages, 'OTR Test Extension content script injected!', 'Expected console message from extension was not found');
        // 2. Verify child element is present
        const marker = await inspectedPage.page.$('#otr-test-extension-marker');
        chai_1.assert.isNotNull(marker, 'Marker element injected by extension was not found');
        // 3. Verify child element has red background color
        const backgroundColor = await inspectedPage.page.evaluate(() => {
            const el = document.getElementById('otr-test-extension-marker');
            return el ? window.getComputedStyle(el).backgroundColor : null;
        });
        // 'red' resolves to 'rgb(255, 0, 0)' in computed style
        chai_1.assert.strictEqual(backgroundColor, 'rgb(255, 0, 0)', `Expected marker to have red background (rgb(255, 0, 0)), but got ${backgroundColor}`);
    });
});
//# sourceMappingURL=mock-extension.test.js.map