1 import { browser, element, by } from 'protractor'
2 import { join } from 'path'
4 export class VideoUploadPage {
6 return browser.get('/videos/upload')
10 const fileToUpload = join(__dirname, '../../fixtures/video.mp4')
12 await element(by.css('.upload-video-container input[type=file]')).sendKeys(fileToUpload)
14 // Wait for the upload to finish
15 await browser.wait(browser.ExpectedConditions.elementToBeClickable(this.getSecondStepSubmitButton()))
18 async validSecondUploadStep (videoName: string) {
19 const nameInput = element(by.css('input#name'))
20 await nameInput.clear()
21 await nameInput.sendKeys(videoName)
23 await this.getSecondStepSubmitButton().click()
25 return browser.wait(browser.ExpectedConditions.urlContains('/watch/'))
28 private getSecondStepSubmitButton () {
29 return element(by.css('.submit-button:not(.disabled) input'))