]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/e2e/src/po/video-upload.po.ts
Make it works with new autoplay policy
[github/Chocobozzz/PeerTube.git] / client / e2e / src / po / video-upload.po.ts
index 1ac69610766a755b7f6b4d69f7aa8db79c3d7428..1978707e3a5cb55f79ecb8048f25d87811cc362b 100644 (file)
@@ -3,16 +3,26 @@ 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 .upload-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 .button-file'
+
+    // Avoid sending keys on non visible element
+    await browser.executeScript(`document.querySelector('${fileInputSelector}').style.opacity = 1`)
+    // await browser.executeScript(`document.querySelector('${fileInputSelector}').style.opacity = 1`)
+    await browser.executeScript(`document.querySelector('${parentFileInput}').style.overflow = 'initial'`)
 
-    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()))