-
Notifications
You must be signed in to change notification settings - Fork 653
Expand file tree
/
Copy pathsecurity-helpers.ts
More file actions
68 lines (57 loc) · 2.35 KB
/
security-helpers.ts
File metadata and controls
68 lines (57 loc) · 2.35 KB
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
// 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.
import type {DevToolsPage} from '../shared/frontend-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(devToolsPage: DevToolsPage) {
await devToolsPage.waitFor(SECURITY_TAB_SELECTOR);
}
export async function securityTabDoesNotExist(devToolsPage: DevToolsPage) {
await devToolsPage.waitForNone(SECURITY_TAB_SELECTOR);
}
export async function securityPanelContentIsLoaded(devToolsPage: DevToolsPage) {
await devToolsPage.waitFor(SECURITY_PANEL_CONTENT);
}
export async function navigateToSecurityTab(devToolsPage: DevToolsPage) {
await devToolsPage.click(SECURITY_TAB_SELECTOR);
await securityPanelContentIsLoaded(devToolsPage);
}
export async function closeSecurityTab(devToolsPage: DevToolsPage) {
await devToolsPage.closePanelTab(SECURITY_TAB_SELECTOR);
await securityTabDoesNotExist(devToolsPage);
}
export async function openSecurityPanelFromMoreTools(devToolsPage: DevToolsPage) {
await openPanelViaMoreTools(SECURITY_PANEL_TITLE, devToolsPage);
await securityTabExists(devToolsPage);
await securityPanelContentIsLoaded(devToolsPage);
}
export async function openSecurityPanelFromCommandMenu(devToolsPage: DevToolsPage) {
await openCommandMenu(devToolsPage);
await devToolsPage.typeText('Show Security');
await devToolsPage.pressKey('Enter');
await securityTabExists(devToolsPage);
await securityPanelContentIsLoaded(devToolsPage);
}
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'),
]);
}