"use strict";
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const sources_helpers_js_1 = require("../helpers/sources-helpers.js");
function createSelectorsForFile(fileName, inspectedPage) {
    return (0, sources_helpers_js_1.createSelectorsForWorkerFile)(fileName, 'test/e2e/resources/sources', fileName, 1, inspectedPage);
}
async function openNestedWorkerFile(selectors, devToolsPage) {
    const workerFile = await (0, sources_helpers_js_1.expandFileTree)(selectors, devToolsPage);
    return await workerFile.evaluate(node => node.textContent);
}
describe('The Sources Tab', function () {
    it('can show multiple dedicated workers with different scripts', async ({ devToolsPage, inspectedPage }) => {
        const worker1Selectors = createSelectorsForFile('worker1.js', inspectedPage);
        const worker2Selectors = createSelectorsForFile('worker2.js', inspectedPage);
        // Have the target load the page.
        await inspectedPage.goToResource('sources/different-workers.html');
        // Locate the button for switching to the sources tab.
        await devToolsPage.click('#tab-sources');
        // Wait for the navigation panel to show up
        await devToolsPage.waitFor('.navigator-file-tree-item');
        const worker1FileName = await openNestedWorkerFile(worker1Selectors, devToolsPage);
        chai_1.assert.strictEqual(worker1FileName, 'worker1.js');
        const worker2FileName = await openNestedWorkerFile(worker2Selectors, devToolsPage);
        chai_1.assert.strictEqual(worker2FileName, 'worker2.js');
    });
});
//# sourceMappingURL=can-show-multiple-workers.test.js.map