ニジカ投稿局 https://tv.nizika.tv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

plugins.e2e-spec.ts 2.4 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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'
  5. describe('Plugins', () => {
  6. let videoUploadPage: VideoUploadPage
  7. let loginPage: LoginPage
  8. let adminPluginPage: AdminPluginPage
  9. function getPluginCheckbox () {
  10. return getCheckbox('hello-world-field-4')
  11. }
  12. async function expectSubmitState ({ disabled }: { disabled: boolean }) {
  13. const disabledSubmit = await $('my-button .disabled')
  14. if (disabled) expect(await disabledSubmit.isDisplayed()).toBeTruthy()
  15. else expect(await disabledSubmit.isDisplayed()).toBeFalsy()
  16. }
  17. before(async () => {
  18. await waitServerUp()
  19. })
  20. beforeEach(async () => {
  21. loginPage = new LoginPage(isMobileDevice())
  22. videoUploadPage = new VideoUploadPage()
  23. adminPluginPage = new AdminPluginPage()
  24. await browser.maximizeWindow()
  25. })
  26. it('Should install hello world plugin', async () => {
  27. await loginPage.loginAsRootUser()
  28. await adminPluginPage.navigateToPluginSearch()
  29. await adminPluginPage.search('hello-world')
  30. await adminPluginPage.installHelloWorld()
  31. await browser.refresh()
  32. })
  33. it('Should have checkbox in video edit page', async () => {
  34. await videoUploadPage.navigateTo()
  35. await videoUploadPage.uploadVideo('video.mp4')
  36. await $('span=Super field 4 in main tab').waitForDisplayed()
  37. const checkbox = await getPluginCheckbox()
  38. expect(await checkbox.isDisplayed()).toBeTruthy()
  39. await expectSubmitState({ disabled: true })
  40. })
  41. it('Should check the checkbox and be able to submit the video', async function () {
  42. const checkbox = await getPluginCheckbox()
  43. await checkbox.waitForClickable()
  44. await checkbox.click()
  45. await expectSubmitState({ disabled: false })
  46. })
  47. it('Should uncheck the checkbox and not be able to submit the video', async function () {
  48. const checkbox = await getPluginCheckbox()
  49. await checkbox.waitForClickable()
  50. await checkbox.click()
  51. await expectSubmitState({ disabled: true })
  52. const error = await $('.form-error*=Should be enabled')
  53. expect(await error.isDisplayed()).toBeTruthy()
  54. })
  55. it('Should change the privacy and should hide the checkbox', async function () {
  56. await videoUploadPage.setAsPrivate()
  57. await expectSubmitState({ disabled: false })
  58. })
  59. })