]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/e2e/src/po/signup.po.ts
Add E2E tests for signup
[github/Chocobozzz/PeerTube.git] / client / e2e / src / po / signup.po.ts
diff --git a/client/e2e/src/po/signup.po.ts b/client/e2e/src/po/signup.po.ts
new file mode 100644 (file)
index 0000000..ef36dbc
--- /dev/null
@@ -0,0 +1,64 @@
+import { getCheckbox } from '../utils'
+
+export class SignupPage {
+
+  getRegisterMenuButton () {
+    return $('.create-account-button')
+  }
+
+  async clickOnRegisterInMenu () {
+    const button = this.getRegisterMenuButton()
+
+    await button.waitForDisplayed()
+    await button.click()
+  }
+
+  async validateStep () {
+    const next = $('button[type=submit]')
+
+    await next.waitForClickable()
+    await next.click()
+  }
+
+  async checkTerms () {
+    const terms = await getCheckbox('terms')
+
+    return terms.click()
+  }
+
+  async fillAccountStep (options: {
+    displayName: string
+    username: string
+    email: string
+    password: string
+  }) {
+    if (options.displayName) {
+      await $('#displayName').setValue(options.displayName)
+    }
+
+    if (options.username) {
+      await $('#username').setValue(options.username)
+    }
+
+    if (options.email) {
+      await $('#email').setValue(options.email)
+    }
+
+    if (options.password) {
+      await $('#password').setValue(options.password)
+    }
+  }
+
+  async fillChannelStep (options: {
+    displayName: string
+    name: string
+  }) {
+    if (options.displayName) {
+      await $('#displayName').setValue(options.displayName)
+    }
+
+    if (options.name) {
+      await $('#name').setValue(options.name)
+    }
+  }
+}