chait pinnamaneni | 6bc1c12 | 2020-10-30 17:30:52 | [diff] [blame^] | 1 | // 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 | |
| 5 | import {assert} from 'chai'; |
| 6 | |
| 7 | import {click, getBrowserAndPages, step} from '../../shared/helper.js'; |
| 8 | import {beforeEach, describe, it} from '../../shared/mocha-extensions.js'; |
| 9 | import {doubleClickSourceTreeItem, navigateToApplicationTab} from '../helpers/application-helpers.js'; |
| 10 | import {checkIfTabExistsInDrawer, tabExistsInMainPanel} from '../helpers/cross-tool-helper.js'; |
| 11 | import {closeDrawer} from '../helpers/quick_open-helpers.js'; |
| 12 | |
| 13 | const NETWORK_TAB_SELECTOR = '#tab-network'; |
| 14 | const SERVICE_WORKER_ROW_SELECTOR = '[aria-label="Service Workers"]'; |
| 15 | const TEST_HTML_FILE = 'service-worker-network'; |
| 16 | const SERVICE_WORKER_NETWORK_SELECTOR = '[aria-label="Network requests"]'; |
| 17 | |
| 18 | describe('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 | }); |