]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/e2e/src/po/video-upload.po.ts
Add videos e2e tests
[github/Chocobozzz/PeerTube.git] / client / e2e / src / po / video-upload.po.ts
CommitLineData
5f92c4dc
C
1import { browser, element, by } from 'protractor'
2import { join } from 'path'
3
4export 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}