aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/e2e/src/utils/elements.ts
blob: b0ddd5a65e7bd6d7c6c1406e0c122bdd2a46d6ac (plain) (tree)
1
2
3
4
5
6
7
8




                                                           


                                                                    



                                                                









                                                                                   


        

                    
 
async function getCheckbox (name: string) {
  const input = $(`my-peertube-checkbox input[id=${name}]`)
  await input.waitForExist()

  return input.parentElement()
}

async function selectCustomSelect (id: string, valueLabel: string) {
  const wrapper = $(`[formcontrolname=${id}] .ng-arrow-wrapper`)

  await wrapper.waitForClickable()
  await 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
}