From 2038decc98179720c0623ba35476c3361f93b473 Mon Sep 17 00:00:00 2001 From: Tomas Kikutis Date: Tue, 19 Sep 2023 20:36:00 +0200 Subject: [PATCH] improve tree-select driver to allow selecting values across multiple levels --- e2e/client/specs/helpers/tree-select-driver.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/e2e/client/specs/helpers/tree-select-driver.ts b/e2e/client/specs/helpers/tree-select-driver.ts index aeeac91729..d5fb74b211 100644 --- a/e2e/client/specs/helpers/tree-select-driver.ts +++ b/e2e/client/specs/helpers/tree-select-driver.ts @@ -22,13 +22,22 @@ export class TreeSelectDriver { }); } - addValue(value: string): void { + addValue(value: string | Array): void { el(['open-popover'], null, this._element).click(); - element(by.cssContainingText('[data-test-id="tree-select-popover"] [data-test-id="option"]', value)).click(); + const values = typeof value === 'string' ? [value] : value; + + for (let i = 0; i < values.length; i++) { + element( + by.cssContainingText( + '[data-test-id="tree-select-popover"] [data-test-id="option"]', + values[i], + ), + ).click(); + } } - setValue(value: string) { + setValue(value: string | Array) { const maybeClearButton = this._element.element(s(['clear-value'])); maybeClearButton.isPresent().then((present) => {