"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 });
exports.securityTabExists = securityTabExists;
exports.securityTabDoesNotExist = securityTabDoesNotExist;
exports.securityPanelContentIsLoaded = securityPanelContentIsLoaded;
exports.navigateToSecurityTab = navigateToSecurityTab;
exports.closeSecurityTab = closeSecurityTab;
exports.openSecurityPanelFromMoreTools = openSecurityPanelFromMoreTools;
exports.openSecurityPanelFromCommandMenu = openSecurityPanelFromCommandMenu;
exports.veImpressionForSecurityPanel = veImpressionForSecurityPanel;
const quick_open_helpers_js_1 = require("./quick_open-helpers.js");
const settings_helpers_js_1 = require("./settings-helpers.js");
const visual_logging_helpers_js_1 = require("./visual-logging-helpers.js");
const SECURITY_PANEL_CONTENT = '.view-container[aria-label="Security panel"]';
const SECURITY_TAB_SELECTOR = '#tab-security';
const SECURITY_PANEL_TITLE = 'Security';
async function securityTabExists(devToolsPage) {
    await devToolsPage.waitFor(SECURITY_TAB_SELECTOR);
}
async function securityTabDoesNotExist(devToolsPage) {
    await devToolsPage.waitForNone(SECURITY_TAB_SELECTOR);
}
async function securityPanelContentIsLoaded(devToolsPage) {
    await devToolsPage.waitFor(SECURITY_PANEL_CONTENT);
}
async function navigateToSecurityTab(devToolsPage) {
    await devToolsPage.click(SECURITY_TAB_SELECTOR);
    await securityPanelContentIsLoaded(devToolsPage);
}
async function closeSecurityTab(devToolsPage) {
    await devToolsPage.closePanelTab(SECURITY_TAB_SELECTOR);
    await securityTabDoesNotExist(devToolsPage);
}
async function openSecurityPanelFromMoreTools(devToolsPage) {
    await (0, settings_helpers_js_1.openPanelViaMoreTools)(SECURITY_PANEL_TITLE, devToolsPage);
    await securityTabExists(devToolsPage);
    await securityPanelContentIsLoaded(devToolsPage);
}
async function openSecurityPanelFromCommandMenu(devToolsPage) {
    await (0, quick_open_helpers_js_1.openCommandMenu)(devToolsPage);
    await devToolsPage.typeText('Show Security');
    await devToolsPage.pressKey('Enter');
    await securityTabExists(devToolsPage);
    await securityPanelContentIsLoaded(devToolsPage);
}
function veImpressionForSecurityPanel() {
    return (0, visual_logging_helpers_js_1.veImpression)('Panel', 'security', [
        (0, visual_logging_helpers_js_1.veImpression)('Pane', 'sidebar', [
            (0, visual_logging_helpers_js_1.veImpression)('Tree', undefined, [
                (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'security', [
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', undefined, [(0, visual_logging_helpers_js_1.veImpression)('TreeItem'), (0, visual_logging_helpers_js_1.veImpression)('Expand')]),
                ]),
            ]),
        ]),
        (0, visual_logging_helpers_js_1.veImpression)('Pane', 'security.main-view'),
    ]);
}
//# sourceMappingURL=security-helpers.js.map