blob: 1ac69610766a755b7f6b4d69f7aa8db79c3d7428 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
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 uploadVideo () {
browser.setFileDetector(new FileDetector())
const fileToUpload = join(__dirname, '../../fixtures/video.mp4')
await element(by.css('.upload-video-container input[type=file]')).sendKeys(fileToUpload)
// Wait for the upload to finish
await browser.wait(browser.ExpectedConditions.elementToBeClickable(this.getSecondStepSubmitButton()))
}
async validSecondUploadStep (videoName: string) {
const nameInput = element(by.css('input#name'))
await nameInput.clear()
await nameInput.sendKeys(videoName)
await this.getSecondStepSubmitButton().click()
return browser.wait(browser.ExpectedConditions.urlContains('/watch/'))
}
private getSecondStepSubmitButton () {
return element(by.css('.submit-button:not(.disabled) input'))
}
}
|