X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fe2e%2Fsrc%2Futils%2Felements.ts;h=315718879978fe9b9cec76390b15dff8b5e64390;hb=a9bfa85d2cdf13670aaced740da5b493fbeddfce;hp=cadc46cce47e8ff23e05ce6e873134dfdd1dbd62;hpb=6d210220be0875d63461829d83c6e3a59d05cf7a;p=github%2FChocobozzz%2FPeerTube.git 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 }