]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/e2e/src/utils/elements.ts
Translated using Weblate (Vietnamese)
[github/Chocobozzz/PeerTube.git] / client / e2e / src / utils / elements.ts
index b0ddd5a65e7bd6d7c6c1406e0c122bdd2a46d6ac..d9435e52052305eb6782542a8b08705c9f9a9462 100644 (file)
@@ -5,6 +5,10 @@ async function getCheckbox (name: string) {
   return input.parentElement()
 }
 
+function isCheckboxSelected (name: string) {
+  return $(`input[id=${name}]`).isSelected()
+}
+
 async function selectCustomSelect (id: string, valueLabel: string) {
   const wrapper = $(`[formcontrolname=${id}] .ng-arrow-wrapper`)
 
@@ -22,7 +26,18 @@ async function selectCustomSelect (id: string, valueLabel: string) {
   return option.click()
 }
 
+async function findParentElement (
+  el: WebdriverIO.Element,
+  finder: (el: WebdriverIO.Element) => Promise<boolean>
+) {
+  if (await finder(el) === true) return el
+
+  return findParentElement(await el.parentElement(), finder)
+}
+
 export {
   getCheckbox,
-  selectCustomSelect
+  isCheckboxSelected,
+  selectCustomSelect,
+  findParentElement
 }