1 import { AdminPluginPage } from '../po/admin-plugin.po'
2 import { LoginPage } from '../po/login.po'
3 import { VideoUploadPage } from '../po/video-upload.po'
4 import { getCheckbox, isMobileDevice, waitServerUp } from '../utils'
6 describe('Plugins', () => {
7 let videoUploadPage: VideoUploadPage
8 let loginPage: LoginPage
9 let adminPluginPage: AdminPluginPage
11 function getPluginCheckbox () {
12 return getCheckbox('hello-world-field-4')
15 async function expectSubmitState ({ disabled }: { disabled: boolean }) {
16 const disabledSubmit = await $('my-button .disabled')
18 if (disabled) expect(await disabledSubmit.isDisplayed()).toBeTruthy()
19 else expect(await disabledSubmit.isDisplayed()).toBeFalsy()
26 beforeEach(async () => {
27 loginPage = new LoginPage(isMobileDevice())
28 videoUploadPage = new VideoUploadPage()
29 adminPluginPage = new AdminPluginPage()
31 await browser.maximizeWindow()
34 it('Should install hello world plugin', async () => {
35 await loginPage.loginAsRootUser()
37 await adminPluginPage.navigateToPluginSearch()
38 await adminPluginPage.search('hello-world')
39 await adminPluginPage.installHelloWorld()
40 await browser.refresh()
43 it('Should have checkbox in video edit page', async () => {
44 await videoUploadPage.navigateTo()
45 await videoUploadPage.uploadVideo('video.mp4')
47 await $('span=Super field 4 in main tab').waitForDisplayed()
49 const checkbox = await getPluginCheckbox()
50 expect(await checkbox.isDisplayed()).toBeTruthy()
52 await expectSubmitState({ disabled: true })
55 it('Should check the checkbox and be able to submit the video', async function () {
56 const checkbox = await getPluginCheckbox()
58 await checkbox.waitForClickable()
59 await checkbox.click()
61 await expectSubmitState({ disabled: false })
64 it('Should uncheck the checkbox and not be able to submit the video', async function () {
65 const checkbox = await getPluginCheckbox()
67 await checkbox.waitForClickable()
68 await checkbox.click()
70 await expectSubmitState({ disabled: true })
72 const error = await $('.form-error*=Should be enabled')
74 expect(await error.isDisplayed()).toBeTruthy()
77 it('Should change the privacy and should hide the checkbox', async function () {
78 await videoUploadPage.setAsPrivate()
80 await expectSubmitState({ disabled: false })