aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/e2e/src/utils/elements.ts
blob: 3ffa5defd38c8ef074d341ba39a0a68af6bdd3e3 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
                                     
                                                                    













                                                                                   


        

                    
 
function getCheckbox (name: string) {
  return $(`my-peertube-checkbox input[id=${name}]`).parentElement()
}

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 {
  getCheckbox,
  selectCustomSelect
}