Skip to content

Commit 61d7ef3

Browse files
fix open method
1 parent cf68786 commit 61d7ef3

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

tests/e2e/pageObjects/components/browser/tree-view.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ export class TreeView {
7171
await t.click(this.treeViewSettingsBtn);
7272
await t.click(this.sortingBtn);
7373
order === 'ASC'
74-
? await t.click(this.sortingASCoption)
75-
: await t.click(this.sortingDESCoption)
74+
? await t.click(this.sortingASCoption)
75+
: await t.click(this.sortingDESCoption);
7676

7777
// Click on save button
7878
await t.click(this.treeViewDelimiterValueSave);
@@ -93,11 +93,11 @@ export class TreeView {
9393
*/
9494
async openTreeFolders(names: string[]): Promise<void> {
9595
let base = `node-item_${names[0]}:`;
96-
await t.click(Selector(`[data-testid="${base}"]`));
96+
await this.clickElementIfNotExpanded(base, names[0]);
9797
if (names.length > 1) {
9898
for (let i = 1; i < names.length; i++) {
9999
base = `${base }${names[i]}:`;
100-
await t.click(Selector(`[data-testid="${base}"]`));
100+
await this.clickElementIfNotExpanded(base, names[i]);
101101
}
102102
}
103103
}
@@ -120,4 +120,17 @@ export class TreeView {
120120

121121
return textArray;
122122
}
123+
124+
/**
125+
* click on the folder element if it is not expanded
126+
* @param base the base element
127+
* @param name of the folder
128+
*/
129+
private async clickElementIfNotExpanded(base: string, name: string): Promise<void> {
130+
const folderArrow = Selector(`[data-test-subj="node-arrow-icon_"${name[0]}"]`);
131+
const baseSelector = Selector(`[data-testid="${base}"]`);
132+
if (await baseSelector.find('div').count === 0 && await folderArrow.exists) {
133+
await t.click(Selector(`[data-testid="${base}"]`));
134+
}
135+
}
123136
}

0 commit comments

Comments
 (0)