aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/suites-local/plugins.e2e-spec.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-22 18:02:36 +0100
committerChocobozzz <me@florianbigard.com>2021-12-29 10:10:01 +0100
commit3c065fe3b3e1385d59ad1980251d14b712648155 (patch)
treef5f7f1b428b8155a735014304e2d45b9ed92fe07 /client/e2e/src/suites-local/plugins.e2e-spec.ts
parent61cc1c03bf6f12af7c1b2e2a7d2fdaa563c37b59 (diff)
downloadPeerTube-3c065fe3b3e1385d59ad1980251d14b712648155.tar.gz
PeerTube-3c065fe3b3e1385d59ad1980251d14b712648155.tar.zst
PeerTube-3c065fe3b3e1385d59ad1980251d14b712648155.zip
Enhance plugin video fields
Add video form tab selection Add ability to display an error
Diffstat (limited to 'client/e2e/src/suites-local/plugins.e2e-spec.ts')
-rw-r--r--client/e2e/src/suites-local/plugins.e2e-spec.ts79
1 files changed, 79 insertions, 0 deletions
diff --git a/client/e2e/src/suites-local/plugins.e2e-spec.ts b/client/e2e/src/suites-local/plugins.e2e-spec.ts
new file mode 100644
index 000000000..14802c1ca
--- /dev/null
+++ b/client/e2e/src/suites-local/plugins.e2e-spec.ts
@@ -0,0 +1,79 @@
1import { AdminPluginPage } from '../po/admin-plugin.po'
2import { LoginPage } from '../po/login.po'
3import { VideoUploadPage } from '../po/video-upload.po'
4import { browserSleep, getCheckbox, waitServerUp } from '../utils'
5
6describe('Plugins', () => {
7 let videoUploadPage: VideoUploadPage
8 let loginPage: LoginPage
9 let adminPluginPage: AdminPluginPage
10
11 function getPluginCheckbox () {
12 return getCheckbox('hello-world-field-4')
13 }
14
15 async function expectSubmitState ({ disabled }: { disabled: boolean }) {
16 const disabledSubmit = await $('my-button .disabled')
17
18 if (disabled) expect(await disabledSubmit.isDisplayed()).toBeTruthy()
19 else expect(await disabledSubmit.isDisplayed()).toBeFalsy()
20 }
21
22 before(async () => {
23 await waitServerUp()
24 })
25
26 beforeEach(async () => {
27 loginPage = new LoginPage()
28 videoUploadPage = new VideoUploadPage()
29 adminPluginPage = new AdminPluginPage()
30
31 await browser.maximizeWindow()
32 })
33
34 it('Should install hello world plugin', async () => {
35 await loginPage.loginAsRootUser()
36
37 await adminPluginPage.navigateToSearch()
38 await adminPluginPage.search('hello-world')
39 await adminPluginPage.installHelloWorld()
40 await browser.refresh()
41 })
42
43 it('Should have checkbox in video edit page', async () => {
44 await videoUploadPage.navigateTo()
45 await videoUploadPage.uploadVideo()
46
47 await $('span=Super field 4 in main tab').waitForDisplayed()
48
49 const checkbox = await getPluginCheckbox()
50 expect(await checkbox.isDisplayed()).toBeTruthy()
51
52 await expectSubmitState({ disabled: true })
53 })
54
55 it('Should check the checkbox and be able to submit the video', async function () {
56 const checkbox = await getPluginCheckbox()
57 await checkbox.click()
58
59 await expectSubmitState({ disabled: false })
60 })
61
62 it('Should uncheck the checkbox and not be able to submit the video', async function () {
63 const checkbox = await getPluginCheckbox()
64 await checkbox.click()
65
66 await browserSleep(5000)
67
68 await expectSubmitState({ disabled: true })
69
70 const error = await $('.form-error*=Should be enabled')
71 expect(await error.isDisplayed()).toBeTruthy()
72 })
73
74 it('Should change the privacy and should hide the checkbox', async function () {
75 await videoUploadPage.setAsPrivate()
76
77 await expectSubmitState({ disabled: false })
78 })
79})