From a720fd65bfb8ab29ec8576193b4e9ffabf388971 Mon Sep 17 00:00:00 2001 From: Jesse Mazzella Date: Thu, 17 Nov 2022 13:32:15 -0800 Subject: [PATCH] feat(e2e): Add AppAction to expand the entire tree --- e2e/appActions.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/e2e/appActions.js b/e2e/appActions.js index bc1b1a212ad..69bea5d5458 100644 --- a/e2e/appActions.js +++ b/e2e/appActions.js @@ -189,6 +189,20 @@ async function openObjectTreeContextMenu(page, url) { }); } +/** + * Expands the entire object tree (every expandable tree item). + * @param {import('@playwright/test').Page} page + */ +async function expandEntireTree(page) { + const treePane = page.locator('#tree-pane'); + const collapsedTreeItems = treePane.locator('role=treeitem[expanded=false]'); + let count = await collapsedTreeItems.count(); + while (count > 0) { + await collapsedTreeItems.first().locator('.c-disclosure-triangle').click(); + count = await collapsedTreeItems.count(); + } +} + /** * Gets the UUID of the currently focused object by parsing the current URL * and returning the last UUID in the path. @@ -332,6 +346,7 @@ async function setEndOffset(page, offset) { module.exports = { createDomainObjectWithDefaults, expandTreePaneItemByName, + expandEntireTree, createPlanFromJSON, openObjectTreeContextMenu, getHashUrlToDomainObject,