]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/e2e/src/po/video-upload.po.ts
Fix hls redundancy pruning
[github/Chocobozzz/PeerTube.git] / client / e2e / src / po / video-upload.po.ts
CommitLineData
0b33c520 1import { join } from 'path'
5f92c4dc
C
2
3export class VideoUploadPage {
d1bd87e0 4 async navigateTo () {
3419e0e1 5 await $('.header .publish-button').click()
d1bd87e0 6
3419e0e1 7 await $('.upload-video-container').waitForDisplayed()
5f92c4dc
C
8 }
9
10 async uploadVideo () {
11 const fileToUpload = join(__dirname, '../../fixtures/video.mp4')
d1bd87e0 12 const fileInputSelector = '.upload-video-container input[type=file]'
84c7cde6 13 const parentFileInput = '.upload-video-container .button-file'
d1bd87e0
C
14
15 // Avoid sending keys on non visible element
3419e0e1
C
16 await browser.execute(`document.querySelector('${fileInputSelector}').style.opacity = 1`)
17 await browser.execute(`document.querySelector('${parentFileInput}').style.overflow = 'initial'`)
5f92c4dc 18
3419e0e1 19 await browser.pause(1000)
84c7cde6 20
3419e0e1
C
21 const elem = await $(fileInputSelector)
22 await elem.chooseFile(fileToUpload)
5f92c4dc
C
23
24 // Wait for the upload to finish
3419e0e1
C
25 await browser.waitUntil(async () => {
26 const actionButton = this.getSecondStepSubmitButton().$('.action-button')
3ec535f7
C
27
28 const klass = await actionButton.getAttribute('class')
29 return !klass.includes('disabled')
30 })
5f92c4dc
C
31 }
32
33 async validSecondUploadStep (videoName: string) {
3419e0e1
C
34 const nameInput = $('input#name')
35 await nameInput.clearValue()
36 await nameInput.setValue(videoName)
5f92c4dc
C
37
38 await this.getSecondStepSubmitButton().click()
39
3419e0e1
C
40 return browser.waitUntil(async () => {
41 return (await browser.getUrl()).includes('/w/')
42 })
5f92c4dc
C
43 }
44
45 private getSecondStepSubmitButton () {
3419e0e1 46 return $('.submit-container my-button')
5f92c4dc
C
47 }
48}