]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/e2e/src/po/login.po.ts
Add ability to filter my imports by target URL
[github/Chocobozzz/PeerTube.git] / client / e2e / src / po / login.po.ts
index 8e3030e43ccad94a3c3a6ba9943ff14ee0aaa16b..486b9a6d8b5a164b58f400d5e1c13b678e130ca7 100644 (file)
@@ -1,6 +1,7 @@
 import { go } from '../utils'
 
 export class LoginPage {
+
   async loginAsRootUser () {
     await go('/login')
 
@@ -8,7 +9,7 @@ export class LoginPage {
     await browser.execute(`window.localStorage.setItem('no_welcome_modal', 'true')`)
 
     await $('input#username').setValue('root')
-    await $('input#password').setValue('test1')
+    await $('input#password').setValue('test' + this.getSuffix())
 
     await browser.pause(1000)
 
@@ -19,7 +20,24 @@ export class LoginPage {
     await expect(this.getLoggedInInfoElem()).toHaveText('root')
   }
 
+  async logout () {
+    await $('.logged-in-more').click()
+
+    const logout = () => $('.dropdown-item*=Log out')
+
+    await logout().waitForDisplayed()
+    await logout().click()
+
+    await $('.login-buttons-block').waitForDisplayed()
+  }
+
   private getLoggedInInfoElem () {
     return $('.logged-in-display-name')
   }
+
+  private getSuffix () {
+    return browser.config.baseUrl
+      ? browser.config.baseUrl.slice(-1)
+      : '1'
+  }
 }