aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/e2e/src/po/admin-config.po.ts
blob: 27957a71f1dd9b3de3272acd2675c9863598873a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
                                          














                                                                                                







                                                                                 





                                                                 

                                                       

                                     


                          
                 
                                          

                                   
                        

   
import { getCheckbox, go } from '../utils'

export class AdminConfigPage {

  async navigateTo (tab: 'instance-homepage' | 'basic-configuration' | 'instance-information') {
    const waitTitles = {
      'instance-homepage': 'INSTANCE HOMEPAGE',
      'basic-configuration': 'APPEARANCE',
      'instance-information': 'INSTANCE'
    }

    await go('/admin/config/edit-custom#' + tab)

    await $('.inner-form-title=' + waitTitles[tab]).waitForDisplayed()
  }

  async updateNSFWSetting (newValue: 'do_not_list' | 'blur' | 'display') {
    const elem = $('#instanceDefaultNSFWPolicy')

    await elem.waitForDisplayed()
    await elem.scrollIntoView(false) // Avoid issues with fixed header on firefox
    await elem.waitForClickable()

    return elem.selectByAttribute('value', newValue)
  }

  updateHomepage (newValue: string) {
    return $('#instanceCustomHomepageContent').setValue(newValue)
  }

  async toggleSignup () {
    const checkbox = await getCheckbox('signupEnabled')

    await checkbox.waitForClickable()
    await checkbox.click()
  }

  async save () {
    const button = $('input[type=submit]')

    await button.waitForClickable()
    await button.click()
  }
}