"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 helper_js_1 = require("../../shared/helper.js");
const context_menu_helpers_js_1 = require("../helpers/context-menu-helpers.js");
const elements_helpers_js_1 = require("../helpers/elements-helpers.js");
const issues_helpers_js_1 = require("../helpers/issues-helpers.js");
describe('The Issues tab', () => {
    it('should reveal an element in the Elements panel when the node icon is clicked', async ({ devToolsPage, inspectedPage, }) => {
        await inspectedPage.goToResource('elements/element-reveal-inline-issue.html');
        await (0, issues_helpers_js_1.navigateToIssuesTab)(devToolsPage);
        await (0, issues_helpers_js_1.expandIssue)(devToolsPage);
        await (0, issues_helpers_js_1.revealNodeInElementsPanel)(devToolsPage);
        await (0, elements_helpers_js_1.waitForSelectedTreeElementSelectorWhichIncludesText)('alert("This should be blocked by CSP");', devToolsPage);
    });
});
describe('The Elements panel', () => {
    it('has a context menu link from an iframe to the corresponding frame details view', async ({ devToolsPage, inspectedPage, }) => {
        await inspectedPage.goToResource('application/main-frame.html');
        await (0, context_menu_helpers_js_1.openSoftContextMenuAndClickOnItem)('[aria-label="</iframe>"]', 'Show iframe details', devToolsPage);
        await (0, helper_js_1.step)('Frame details report with correct title is shown', async () => {
            await devToolsPage.waitForFunction(async () => {
                const reportTitleNode = await devToolsPage.waitFor('.report-title');
                const reportTitle = await reportTitleNode.evaluate(e => e.textContent);
                return reportTitle === 'frameId (iframe.html)';
            });
        });
        await (0, helper_js_1.step)('The correct frame is selected in the sidebar', async () => {
            await devToolsPage.waitFor('[aria-label="frameId (iframe.html)"][aria-selected="true"]');
        });
    });
    it('has link from a slot to assigned elements', async ({ devToolsPage, inspectedPage }) => {
        await inspectedPage.goToResource('elements/slot-element.html');
        await (0, elements_helpers_js_1.expandSelectedNodeRecursively)(devToolsPage);
        await devToolsPage.click('[aria-label="reveal"]');
        await (0, elements_helpers_js_1.waitForPartialContentOfSelectedElementsNode)('<h1>​headline​</h1>', devToolsPage);
    });
    it('has link from a slot element to a slot', async ({ devToolsPage, inspectedPage }) => {
        await inspectedPage.goToResource('elements/slot-element.html');
        await (0, elements_helpers_js_1.expandSelectedNodeRecursively)(devToolsPage);
        await (0, elements_helpers_js_1.waitForAdorners)(([
            { textContent: 'view-source', isActive: false },
            { textContent: 'reveal', isActive: false },
            { textContent: 'slot', isActive: false },
        ]), devToolsPage);
        await devToolsPage.click('[aria-label="slot"]');
        await (0, elements_helpers_js_1.waitForPartialContentOfSelectedElementsNode)('<slot>', devToolsPage);
    });
});
//# sourceMappingURL=reveal-correct-node.test.js.map