]>
Commit | Line | Data |
---|---|---|
5bdfa604 | 1 | import { browserSleep, getCheckbox, go, isCheckboxSelected } from '../utils' |
6d210220 C |
2 | |
3 | export class AdminConfigPage { | |
4 | ||
5 | async navigateTo (tab: 'instance-homepage' | 'basic-configuration' | 'instance-information') { | |
6 | const waitTitles = { | |
7 | 'instance-homepage': 'INSTANCE HOMEPAGE', | |
8 | 'basic-configuration': 'APPEARANCE', | |
9 | 'instance-information': 'INSTANCE' | |
10 | } | |
6d210220 C |
11 | await go('/admin/config/edit-custom#' + tab) |
12 | ||
13 | await $('.inner-form-title=' + waitTitles[tab]).waitForDisplayed() | |
14 | } | |
15 | ||
814e9e07 C |
16 | async updateNSFWSetting (newValue: 'do_not_list' | 'blur' | 'display') { |
17 | const elem = $('#instanceDefaultNSFWPolicy') | |
18 | ||
19 | await elem.waitForDisplayed() | |
a41b9443 | 20 | await elem.scrollIntoView({ block: 'center' }) // Avoid issues with fixed header |
814e9e07 C |
21 | await elem.waitForClickable() |
22 | ||
23 | return elem.selectByAttribute('value', newValue) | |
6d210220 C |
24 | } |
25 | ||
26 | updateHomepage (newValue: string) { | |
27 | return $('#instanceCustomHomepageContent').setValue(newValue) | |
28 | } | |
29 | ||
5bdfa604 C |
30 | async toggleSignup (enabled: boolean) { |
31 | if (await isCheckboxSelected('signupEnabled') === enabled) return | |
32 | ||
1db86422 | 33 | const checkbox = await getCheckbox('signupEnabled') |
814e9e07 C |
34 | |
35 | await checkbox.waitForClickable() | |
1db86422 C |
36 | await checkbox.click() |
37 | } | |
38 | ||
5bdfa604 C |
39 | async toggleSignupApproval (required: boolean) { |
40 | if (await isCheckboxSelected('signupRequiresApproval') === required) return | |
41 | ||
42 | const checkbox = await getCheckbox('signupRequiresApproval') | |
43 | ||
44 | await checkbox.waitForClickable() | |
45 | await checkbox.click() | |
46 | } | |
47 | ||
48 | async toggleSignupEmailVerification (required: boolean) { | |
49 | if (await isCheckboxSelected('signupRequiresEmailVerification') === required) return | |
50 | ||
51 | const checkbox = await getCheckbox('signupRequiresEmailVerification') | |
52 | ||
53 | await checkbox.waitForClickable() | |
54 | await checkbox.click() | |
55 | } | |
56 | ||
6d210220 | 57 | async save () { |
1db86422 | 58 | const button = $('input[type=submit]') |
814e9e07 C |
59 | |
60 | await button.waitForClickable() | |
1db86422 | 61 | await button.click() |
5bdfa604 C |
62 | |
63 | await browserSleep(1000) | |
6d210220 C |
64 | } |
65 | } |