Files
react-native-devtools-frontend/test/e2e/quick_open/QuickOpen_test.ts
T
Andres Olivares 13a0de6f16 Always reveal Sources panel with quick open menu
With crrev.com/c/2960171 the sources panel was set to be opened when a
breakpoint was hit only if an experiment was enabled. However this
behaviour was extended to other triggers of the sources panel, like when
a file is selected using the quick open menu. This means that using the
quick open menu to open a file in the sources panel would only work if
the experiment discussed before is enabled.

To fix this, the check for the experiment value was moved to the call
sites triggered specifically after a Debugger.paused event

Bug: none
Change-Id: I9eb53091b04e63627813e14a8ed6bc6605e92b3b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3271700
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Commit-Queue: Andres Olivares <andoli@chromium.org>
2021-11-11 12:16:44 +00:00

46 lines
1.9 KiB
TypeScript

// Copyright 2021 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 {assert} from 'chai';
import {click, getBrowserAndPages, goToResource, step, waitFor} from '../../shared/helper.js';
import {describe, it} from '../../shared/mocha-extensions.js';
import {navigateToElementsTab} from '../helpers/elements-helpers.js';
import {getMenuItemAtPosition, getMenuItemTitleAtPosition, openFileQuickOpen} from '../helpers/quick_open-helpers.js';
import {togglePreferenceInSettingsTab} from '../helpers/settings-helpers.js';
import {listenForSourceFilesLoaded, waitForSourceLoadedEvent} from '../helpers/sources-helpers.js';
async function openAFileWithQuickMenu() {
const {frontend} = getBrowserAndPages();
await listenForSourceFilesLoaded(frontend);
await step('navigate to elements tab', async () => {
await navigateToElementsTab();
});
await step('open quick open menu and select the first option', async () => {
await goToResource('pages/hello-world.html');
await openFileQuickOpen();
const firstItem = await getMenuItemAtPosition(0);
await click(firstItem);
});
await step('check the sources panel is open with the selected file', async () => {
await waitFor('.navigator-file-tree-item');
await waitForSourceLoadedEvent(frontend, 'hello-world.html');
});
}
describe('Quick Open menu', () => {
it('lists available files', async () => {
await goToResource('pages/hello-world.html');
await openFileQuickOpen();
const firstItemTitle = await getMenuItemTitleAtPosition(0);
assert.strictEqual(firstItemTitle, 'hello-world.html');
});
it('opens the sources panel when a file is selected', async () => {
await openAFileWithQuickMenu();
await togglePreferenceInSettingsTab('Focus Sources panel when triggering a breakpoint');
await openAFileWithQuickMenu();
});
});