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,