aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/e2e/src/utils/elements.ts
blob: 9d6cfe6730da4cb6ddd7805c861cf1dba9ba0ed4 (plain) (tree)
1
2
3
4
5




                                                           













                                                                                   


        

                    
 
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) {
  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
}