-
Notifications
You must be signed in to change notification settings - Fork 655
Expand file tree
/
Copy pathcross-tool-helper.ts
More file actions
37 lines (30 loc) · 1.63 KB
/
cross-tool-helper.ts
File metadata and controls
37 lines (30 loc) · 1.63 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
// 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';
export async function clickOnContextMenuItemFromTab(
tabId: string, menuItemSelector: string, devToolsPage: DevToolsPage) {
// Find the selected node, right click.
await devToolsPage.click(tabId, {clickOptions: {button: 'right'}});
// Click on the context menu option
await devToolsPage.click(menuItemSelector);
}
export const MOVE_TO_DRAWER_SELECTOR = '[aria-label="Move to drawer"]';
export const MOVE_TO_MAIN_TAB_BAR_SELECTOR = '[aria-label="Move to main tab bar"]';
export const MAIN_PANEL_SELECTOR = 'div[class*="main-tabbed-pane"][slot*="main"]';
export const DRAWER_PANEL_SELECTOR = 'div[class*="drawer-tabbed-pane"][slot*="sidebar"]';
export const TAB_HEADER_SELECTOR = 'div[class*="tabbed-pane-header"]';
export async function tabExistsInMainPanel(tabId: string, devToolsPage: DevToolsPage) {
const mainPanel = await devToolsPage.waitFor(MAIN_PANEL_SELECTOR);
await devToolsPage.waitFor(tabId, mainPanel);
}
export async function tabExistsInDrawer(tabId: string, devToolsPage: DevToolsPage) {
const drawer = await devToolsPage.waitFor(DRAWER_PANEL_SELECTOR);
await devToolsPage.waitFor(tabId, drawer);
}
export const checkIfTabExistsInDrawer = async (tabId: string, devToolsPage: DevToolsPage) => {
const drawer = await devToolsPage.waitFor(DRAWER_PANEL_SELECTOR);
const header = await devToolsPage.waitFor(TAB_HEADER_SELECTOR, drawer);
const tab = await devToolsPage.waitFor(tabId, header);
return Boolean(tab);
};