From a9bfa85d2cdf13670aaced740da5b493fbeddfce Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 15 Dec 2021 15:58:10 +0100 Subject: Add ability for admins to set default p2p policy --- client/e2e/src/utils/elements.ts | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'client/e2e/src/utils/elements.ts') diff --git a/client/e2e/src/utils/elements.ts b/client/e2e/src/utils/elements.ts index cadc46cce..315718879 100644 --- a/client/e2e/src/utils/elements.ts +++ b/client/e2e/src/utils/elements.ts @@ -1,7 +1,22 @@ -function clickOnCheckbox (name: string) { - return $(`my-peertube-checkbox[inputname=${name}] label`).click() +function getCheckbox (name: string) { + return $(`my-peertube-checkbox[inputname=${name}] label`) +} + +async function selectCustomSelect (id: string, valueLabel: string) { + await $(`[formcontrolname=${id}] .ng-arrow-wrapper`).click() + + const option = await $$(`[formcontrolname=${id}] .ng-option`).filter(async o => { + const text = await o.getText() + + return text.trimStart().startsWith(valueLabel) + }).then(options => options[0]) + + await option.waitForDisplayed() + + return option.click() } export { - clickOnCheckbox + getCheckbox, + selectCustomSelect } -- cgit v1.2.3