]>
Commit | Line | Data |
---|---|---|
5f92c4dc C |
1 | import { browser, element, by } from 'protractor' |
2 | import { join } from 'path' | |
3 | ||
4 | export class VideoUploadPage { | |
5 | navigateTo () { | |
6 | return browser.get('/videos/upload') | |
7 | } | |
8 | ||
9 | async uploadVideo () { | |
10 | const fileToUpload = join(__dirname, '../../fixtures/video.mp4') | |
11 | ||
12 | await element(by.css('.upload-video-container input[type=file]')).sendKeys(fileToUpload) | |
13 | ||
14 | // Wait for the upload to finish | |
15 | await browser.wait(browser.ExpectedConditions.elementToBeClickable(this.getSecondStepSubmitButton())) | |
16 | } | |
17 | ||
18 | async validSecondUploadStep (videoName: string) { | |
19 | const nameInput = element(by.css('input#name')) | |
20 | await nameInput.clear() | |
21 | await nameInput.sendKeys(videoName) | |
22 | ||
23 | await this.getSecondStepSubmitButton().click() | |
24 | ||
25 | return browser.wait(browser.ExpectedConditions.urlContains('/watch/')) | |
26 | } | |
27 | ||
28 | private getSecondStepSubmitButton () { | |
29 | return element(by.css('.submit-button:not(.disabled) input')) | |
30 | } | |
31 | } |