aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/e2e/src/suites-local/signup.e2e-spec.ts
blob: 0f6d7a0e6f43cce0b076499bff869fea0a232d2a (plain) (tree)






















































































                                                                       
import { AdminConfigPage } from '../po/admin-config.po'
import { LoginPage } from '../po/login.po'
import { SignupPage } from '../po/signup.po'
import { waitServerUp } from '../utils'

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

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

  beforeEach(async () => {
    loginPage = new LoginPage()
    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')
  })
})