blob: 71baffe406a3aa468bd4e5f35c12a060a17ab020 [file] [log] [blame]
Benedikt Meurer97516532022-03-28 11:07:081// Copyright 2022 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
Nikolay Vitkov92b83462025-02-13 12:28:555import {click, step, waitFor} from '../../shared/helper.js';
Jack Frankline839c0c2022-05-03 08:47:446import {
7 clickOnContextMenu,
8 CONSOLE_TAB_SELECTOR,
9 focusConsolePrompt,
10 typeIntoConsole,
11} from '../helpers/console-helpers.js';
Benedikt Meurer97516532022-03-28 11:07:0812
Benedikt Meurercb7952f2024-02-21 13:32:2313describe('The Console Tab', () => {
Benedikt Meurer97516532022-03-28 11:07:0814 it('recursively expands objects', async () => {
Benedikt Meurer97516532022-03-28 11:07:0815 await step('open the console tab and focus the prompt', async () => {
16 await click(CONSOLE_TAB_SELECTOR);
17 await focusConsolePrompt();
18 });
19
Nikolay Vitkov92b83462025-02-13 12:28:5520 await typeIntoConsole('({a: {x: 21}, b: {y: 42}})');
Benedikt Meurer97516532022-03-28 11:07:0821
22 // Expand the object node recursively
Danil Somsikov06ed90b2024-07-17 11:16:1923 await clickOnContextMenu('.console-view-object-properties-section', 'expand-recursively');
Benedikt Meurer97516532022-03-28 11:07:0824 const root = await waitFor('.console-view-object-properties-section.expanded');
25
26 // Ensure that both a and b are expanded.
27 const [aChildren, bChildren] = await Promise.all([
28 waitFor('li[data-object-property-name-for-test="a"][aria-expanded=true] ~ ol.expanded', root),
29 waitFor('li[data-object-property-name-for-test="b"][aria-expanded=true] ~ ol.expanded', root),
30 ]);
31
32 // The x and y properties should be visible now.
33 await Promise.all([
34 waitFor('li[data-object-property-name-for-test="x"]', aChildren),
35 waitFor('li[data-object-property-name-for-test="y"]', bChildren),
36 ]);
37
38 // The [[Prototype]] internal properties should not be expanded now.
39 await Promise.all([
40 waitFor('li[data-object-property-name-for-test="[[Prototype]]"][aria-expanded=false]', aChildren),
41 waitFor('li[data-object-property-name-for-test="[[Prototype]]"][aria-expanded=false]', bChildren),
42 ]);
43 });
44});