X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fe2e%2Fsrc%2Fpo%2Fvideo-upload.po.ts;h=7de715a9553e2cb9b6dd5840ded7cbab27481acb;hb=6b88559babc1e0490119a6b52411b10910d9da9d;hp=741914d2deaab06e634cdc82fa42587f24c88ae7;hpb=2e8e97f313683bdf8a7448f3d1ba1f1c27f6ad50;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/e2e/src/po/video-upload.po.ts b/client/e2e/src/po/video-upload.po.ts index 741914d2d..7de715a95 100644 --- a/client/e2e/src/po/video-upload.po.ts +++ b/client/e2e/src/po/video-upload.po.ts @@ -1,18 +1,29 @@ -import { browser, element, by } from 'protractor' -import { join } from 'path' +import { browser, by, element } from 'protractor' import { FileDetector } from 'selenium-webdriver/remote' +import { join } from 'path' export class VideoUploadPage { - navigateTo () { - return browser.get('/videos/upload') + async navigateTo () { + await element(by.css('.header .publish-button')).click() + + return browser.wait(browser.ExpectedConditions.visibilityOf(element(by.css('.upload-video-container')))) } async uploadVideo () { browser.setFileDetector(new FileDetector()) const fileToUpload = join(__dirname, '../../fixtures/video.mp4') + const fileInputSelector = '.upload-video-container input[type=file]' + const parentFileInput = '.upload-video-container .button-file' + + // Avoid sending keys on non visible element + await browser.executeScript(`document.querySelector('${fileInputSelector}').style.opacity = 1`) + await browser.executeScript(`document.querySelector('${parentFileInput}').style.overflow = 'initial'`) + + await browser.sleep(1000) - await element(by.css('.upload-video-container input[type=file]')).sendKeys(fileToUpload) + const elem = element(by.css(fileInputSelector)) + await elem.sendKeys(fileToUpload) // Wait for the upload to finish await browser.wait(browser.ExpectedConditions.elementToBeClickable(this.getSecondStepSubmitButton())) @@ -29,6 +40,6 @@ export class VideoUploadPage { } private getSecondStepSubmitButton () { - return element(by.css('.submit-button:not(.disabled) input')) + return element(by.css('.submit-button:not(.disabled)')) } }