]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/e2e/src/utils/elements.ts
Add ability for admins to set default p2p policy
[github/Chocobozzz/PeerTube.git] / client / e2e / src / utils / elements.ts
index cadc46cce47e8ff23e05ce6e873134dfdd1dbd62..315718879978fe9b9cec76390b15dff8b5e64390 100644 (file)
@@ -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
 }