blob: 266cd6ff388c7574c53d91b10905e8a09e09cfb2 [file] [log] [blame]
chait pinnamaneni6bc1c122020-10-30 17:30:521// Copyright 2020 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5import {assert} from 'chai';
6
7import {click, getBrowserAndPages, step} from '../../shared/helper.js';
8import {beforeEach, describe, it} from '../../shared/mocha-extensions.js';
9import {doubleClickSourceTreeItem, navigateToApplicationTab} from '../helpers/application-helpers.js';
10import {checkIfTabExistsInDrawer, tabExistsInMainPanel} from '../helpers/cross-tool-helper.js';
11import {closeDrawer} from '../helpers/quick_open-helpers.js';
12
13const NETWORK_TAB_SELECTOR = '#tab-network';
14const SERVICE_WORKER_ROW_SELECTOR = '[aria-label="Service Workers"]';
15const TEST_HTML_FILE = 'service-worker-network';
16const SERVICE_WORKER_NETWORK_SELECTOR = '[aria-label="Network requests"]';
17
18describe('The Application Tab', async () => {
19 beforeEach(async () => {
20 const {target} = getBrowserAndPages();
21 await navigateToApplicationTab(target, TEST_HTML_FILE);
22 await doubleClickSourceTreeItem(SERVICE_WORKER_ROW_SELECTOR);
23 });
24
25 it('Clicking on Network requests for service worker should open Network panel in drawer and closing should move it back',
26 async () => {
27 await step('Click on network requests for service worker should open network panel in drawer', async () => {
28 await click(SERVICE_WORKER_NETWORK_SELECTOR);
29 const networkTabInDrawer = await checkIfTabExistsInDrawer(NETWORK_TAB_SELECTOR);
30 assert.isTrue(networkTabInDrawer);
31 });
32
33 await step('Close drawer and network tab should move back to main panel', async () => {
34 await closeDrawer();
35 await tabExistsInMainPanel(NETWORK_TAB_SELECTOR);
36 });
37 });
38});