forked from ChromeDevTools/devtools-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsecurity-helpers.ts
69 lines (58 loc) · 2.11 KB
/
security-helpers.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {click, closePanelTab, getBrowserAndPages, typeText, waitFor, waitForNone} from '../../shared/helper.js';
import {openCommandMenu} from './quick_open-helpers.js';
import {openPanelViaMoreTools} from './settings-helpers.js';
import {veImpression} from './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';
export async function securityTabExists() {
await waitFor(SECURITY_TAB_SELECTOR);
}
export async function securityTabDoesNotExist() {
await waitForNone(SECURITY_TAB_SELECTOR);
}
export async function securityPanelContentIsLoaded() {
await waitFor(SECURITY_PANEL_CONTENT);
}
export async function navigateToSecurityTab() {
await click(SECURITY_TAB_SELECTOR);
await securityPanelContentIsLoaded();
}
export async function closeSecurityTab() {
await closePanelTab(SECURITY_TAB_SELECTOR);
await securityTabDoesNotExist();
}
export async function openSecurityPanelFromMoreTools() {
await openPanelViaMoreTools(SECURITY_PANEL_TITLE);
await securityTabExists();
await securityPanelContentIsLoaded();
}
export async function openSecurityPanelFromCommandMenu() {
const {frontend} = getBrowserAndPages();
await openCommandMenu();
await typeText('Show Security');
await frontend.keyboard.press('Enter');
await securityTabExists();
await securityPanelContentIsLoaded();
}
export function veImpressionForSecurityPanel() {
return veImpression('Panel', 'security', [
veImpression(
'Pane', 'sidebar',
[
veImpression(
'Tree', undefined,
[
veImpression(
'TreeItem', 'security',
[
veImpression('TreeItem', undefined, [veImpression('TreeItem'), veImpression('Expand')]),
]),
]),
]),
veImpression('Pane', 'security.main-view'),
]);
}