X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fe2e%2Fsrc%2Fpo%2Flogin.po.ts;h=486b9a6d8b5a164b58f400d5e1c13b678e130ca7;hb=a9bfa85d2cdf13670aaced740da5b493fbeddfce;hp=5a36fd611f4c731f7c076d3c6669e0f28a8819e4;hpb=cd4d7a2ca868209fb1e2dbd790c1e5d6cca77e86;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/e2e/src/po/login.po.ts b/client/e2e/src/po/login.po.ts index 5a36fd611..486b9a6d8 100644 --- a/client/e2e/src/po/login.po.ts +++ b/client/e2e/src/po/login.po.ts @@ -1,14 +1,43 @@ -import { browser, element, by } from 'protractor' +import { go } from '../utils' export class LoginPage { + async loginAsRootUser () { - await browser.get('/login') + await go('/login') + + await browser.execute(`window.localStorage.setItem('no_instance_config_warning_modal', 'true')`) + await browser.execute(`window.localStorage.setItem('no_welcome_modal', 'true')`) + + await $('input#username').setValue('root') + await $('input#password').setValue('test' + this.getSuffix()) + + await browser.pause(1000) - await element(by.css('input#username')).sendKeys('root') - await element(by.css('input#password')).sendKeys('test1') + await $('form input[type=submit]').click() + + await this.getLoggedInInfoElem().waitForExist() + + await expect(this.getLoggedInInfoElem()).toHaveText('root') + } - await element(by.css('form input[type=submit]')).click() + 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') + } - return browser.wait(browser.ExpectedConditions.urlContains('/videos/')) + private getSuffix () { + return browser.config.baseUrl + ? browser.config.baseUrl.slice(-1) + : '1' } }