"use strict";
// Copyright 2022 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 sources_helpers_js_1 = require("../helpers/sources-helpers.js");
function createSelectorsForFile(domainName, folderName, fileName) {
    const rootSelector = '.navigator-frame-tree-item[aria-label="top, frame"]';
    const domainSelector = `${rootSelector} + ol > [aria-label="${domainName}, domain"]`;
    const folderSelector = `${domainSelector} + ol > [aria-label^="${folderName}, "]`;
    const fileSelector = `${folderSelector} + ol > [aria-label="${fileName}, file"]`;
    return {
        rootSelector,
        domainSelector,
        folderSelector,
        fileSelector,
    };
}
describe('The Sources Tab', () => {
    it('resolves relative sourceURL annotations correctly', async ({ devToolsPage, inspectedPage }) => {
        const domainName = inspectedPage.getResourcesPath().split('/')[2];
        await (0, sources_helpers_js_1.openFileInSourcesPanel)('sourceurl.html', devToolsPage, inspectedPage);
        await (0, sources_helpers_js_1.expandFileTree)(createSelectorsForFile(domainName, 'test/e2e/resources/sources', 'eval.js'), devToolsPage);
        await (0, sources_helpers_js_1.expandFileTree)(createSelectorsForFile(domainName, 'test/e2e/resources/sources', 'inline.js'), devToolsPage);
    });
    it('retains absolute webpack:/// and webpack-internal:/// sourceURL annotations', async ({ devToolsPage, inspectedPage }) => {
        await (0, sources_helpers_js_1.openFileInSourcesPanel)('sourceurl.html', devToolsPage, inspectedPage);
        await (0, sources_helpers_js_1.expandFileTree)(createSelectorsForFile('webpack://', 'src', 'index.js'), devToolsPage);
        await (0, sources_helpers_js_1.expandFileTree)(createSelectorsForFile('webpack-internal://', '(webpack-dev-server)', 'generated.js'), devToolsPage);
    });
});
//# sourceMappingURL=sourceurl.test.js.map