1 import { join } from 'path'
2 import { getCheckbox, selectCustomSelect } from '../utils'
4 export class VideoUploadPage {
6 await $('.header .publish-button').click()
8 await $('.upload-video-container').waitForDisplayed()
11 async uploadVideo () {
12 const fileToUpload = join(__dirname, '../../fixtures/video.mp4')
13 const fileInputSelector = '.upload-video-container input[type=file]'
14 const parentFileInput = '.upload-video-container .button-file'
16 // Avoid sending keys on non visible element
17 await browser.execute(`document.querySelector('${fileInputSelector}').style.opacity = 1`)
18 await browser.execute(`document.querySelector('${parentFileInput}').style.overflow = 'initial'`)
20 await browser.pause(1000)
22 const elem = await $(fileInputSelector)
23 await elem.chooseFile(fileToUpload)
25 // Wait for the upload to finish
26 await browser.waitUntil(async () => {
27 const actionButton = this.getSecondStepSubmitButton().$('.action-button')
29 const klass = await actionButton.getAttribute('class')
30 return !klass.includes('disabled')
35 return getCheckbox('nsfw').click()
38 async validSecondUploadStep (videoName: string) {
39 const nameInput = $('input#name')
40 await nameInput.clearValue()
41 await nameInput.setValue(videoName)
43 await this.getSecondStepSubmitButton().click()
45 return browser.waitUntil(async () => {
46 return (await browser.getUrl()).includes('/w/')
51 return selectCustomSelect('privacy', 'Public')
54 private getSecondStepSubmitButton () {
55 return $('.submit-container my-button')