aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/suites-local/signup.e2e-spec.ts
blob: 4eed3eefe0977e3accca6e04e68e23b395e593e3 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import { AdminConfigPage } from '../po/admin-config.po'
import { LoginPage } from '../po/login.po'
import { SignupPage } from '../po/signup.po'
import { isMobileDevice, waitServerUp } from '../utils'

describe('Signup', () => {
  let loginPage: LoginPage
  let adminConfigPage: AdminConfigPage
  let signupPage: SignupPage

  before(async () => {
    await waitServerUp()
  })

  beforeEach(async () => {
    loginPage = new LoginPage(isMobileDevice())
    adminConfigPage = new AdminConfigPage()
    signupPage = new SignupPage()

    await browser.maximizeWindow()
  })

  it('Should disable signup', async () => {
    await loginPage.loginAsRootUser()

    await adminConfigPage.navigateTo('basic-configuration')
    await adminConfigPage.toggleSignup()

    await adminConfigPage.save()

    await loginPage.logout()
    await browser.refresh()

    expect(signupPage.getRegisterMenuButton()).not.toBeDisplayed()
  })

  it('Should enable signup', async () => {
    await loginPage.loginAsRootUser()

    await adminConfigPage.navigateTo('basic-configuration')
    await adminConfigPage.toggleSignup()

    await adminConfigPage.save()

    await loginPage.logout()
    await browser.refresh()

    expect(signupPage.getRegisterMenuButton()).toBeDisplayed()
  })

  it('Should go on signup page', async function () {
    await signupPage.clickOnRegisterInMenu()
  })

  it('Should validate the first step (about page)', async function () {
    await signupPage.validateStep()
  })

  it('Should validate the second step (terms)', async function () {
    await signupPage.checkTerms()
    await signupPage.validateStep()
  })

  it('Should validate the third step (account)', async function () {
    await signupPage.fillAccountStep({
      displayName: 'user 1',
      username: 'user_1',
      email: 'user_1@example.com',
      password: 'my_super_password'
    })

    await signupPage.validateStep()
  })

  it('Should validate the third step (channel)', async function () {
    await signupPage.fillChannelStep({
      displayName: 'user 1 channel',
      name: 'user_1_channel'
    })

    await signupPage.validateStep()
  })

  it('Should be logged in', async function () {
    await loginPage.ensureIsLoggedInAs('user 1')
  })
})