aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/po/admin-registration.po.ts
blob: 918587c5e9e26bc6eea2a0a7fc750c5c2586c38c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { browserSleep, findParentElement, go } from '../utils'

export class AdminRegistrationPage {

  async navigateToRegistratonsList () {
    await go('/admin/moderation/registrations/list')

    await $('my-registration-list').waitForDisplayed()
  }

  async accept (username: string, moderationResponse: string) {
    const usernameEl = await $('*=' + username)
    await usernameEl.waitForDisplayed()

    const tr = await findParentElement(usernameEl, async el => await el.getTagName() === 'tr')

    await tr.$('.action-cell .dropdown-root').click()

    const accept = await $('span*=Accept this request')
    await accept.waitForClickable()
    await accept.click()

    const moderationResponseTextarea = await $('#moderationResponse')
    await moderationResponseTextarea.waitForDisplayed()

    await moderationResponseTextarea.setValue(moderationResponse)

    const submitButton = $('.modal-footer input[type=submit]')
    await submitButton.waitForClickable()
    await submitButton.click()

    await browserSleep(1000)
  }

}