Benedikt Meurer | 9751653 | 2022-03-28 11:07:08 | [diff] [blame] | 1 | // 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 Vitkov | 92b8346 | 2025-02-13 12:28:55 | [diff] [blame] | 5 | import {click, step, waitFor} from '../../shared/helper.js'; |
Jack Franklin | e839c0c | 2022-05-03 08:47:44 | [diff] [blame] | 6 | import { |
| 7 | clickOnContextMenu, |
| 8 | CONSOLE_TAB_SELECTOR, |
| 9 | focusConsolePrompt, |
| 10 | typeIntoConsole, |
| 11 | } from '../helpers/console-helpers.js'; |
Benedikt Meurer | 9751653 | 2022-03-28 11:07:08 | [diff] [blame] | 12 | |
Benedikt Meurer | cb7952f | 2024-02-21 13:32:23 | [diff] [blame] | 13 | describe('The Console Tab', () => { |
Benedikt Meurer | 9751653 | 2022-03-28 11:07:08 | [diff] [blame] | 14 | it('recursively expands objects', async () => { |
Benedikt Meurer | 9751653 | 2022-03-28 11:07:08 | [diff] [blame] | 15 | await step('open the console tab and focus the prompt', async () => { |
| 16 | await click(CONSOLE_TAB_SELECTOR); |
| 17 | await focusConsolePrompt(); |
| 18 | }); |
| 19 | |
Nikolay Vitkov | 92b8346 | 2025-02-13 12:28:55 | [diff] [blame] | 20 | await typeIntoConsole('({a: {x: 21}, b: {y: 42}})'); |
Benedikt Meurer | 9751653 | 2022-03-28 11:07:08 | [diff] [blame] | 21 | |
| 22 | // Expand the object node recursively |
Danil Somsikov | 06ed90b | 2024-07-17 11:16:19 | [diff] [blame] | 23 | await clickOnContextMenu('.console-view-object-properties-section', 'expand-recursively'); |
Benedikt Meurer | 9751653 | 2022-03-28 11:07:08 | [diff] [blame] | 24 | 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 | }); |