provider.zoom.test.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* global browser */
  2. /*
  3. WARNING! PLEASE READ THIS BEFORE ENABLING THIS TEST ON TRAVIS.
  4. Before enabling this test on travis, please keep in mind that with this "no_ssl_bump_domains" option set
  5. here https://github.com/transloadit/uppy/blob/998c7b1805acb8d305a562dd9726ebae98575e07/.travis.yml#L33
  6. SSL encryption may not be enabled between the running companion and the testing browser client.
  7. Hence, provider tokens (Google, Instagram, Zoom) may be at risk of getting hijacked.
  8. */
  9. const { finishUploadTest, startUploadTest, uploadWithRetry } = require('./helper')
  10. const testURL = 'http://localhost:4567/providers'
  11. describe('File upload with Zoom Provider', () => {
  12. beforeEach(async () => {
  13. await browser.url(testURL)
  14. })
  15. // not using arrow functions as cb so to keep mocha in the 'this' context
  16. it('should upload a file completely with Zoom', async function () {
  17. if (!process.env.UPPY_GOOGLE_EMAIL) {
  18. console.log('skipping Zoom integration test')
  19. return this.skip()
  20. }
  21. // ensure session is cleared
  22. await startUploadTest(browser, 'Zoom', /zoom/)
  23. await signIntoGoogle(browser)
  24. await finishUploadTest(browser)
  25. })
  26. // not using arrow functions as cb so to keep mocha in the 'this' context
  27. it('should resume uploads when retry is triggered with Zoom', async function () {
  28. if (!process.env.UPPY_GOOGLE_EMAIL) {
  29. console.log('skipping Zoom integration test')
  30. return this.skip()
  31. }
  32. await uploadWithRetry(browser, 'Zoom', testURL)
  33. })
  34. })
  35. const signIntoGoogle = async (browser) => {
  36. const emailInput = await browser.$('#identifierId')
  37. await emailInput.waitForExist(30000)
  38. await emailInput.setValue(process.env.UPPY_GOOGLE_EMAIL)
  39. let nextButton = await browser.$('#identifierNext')
  40. await nextButton.click()
  41. const passwordInput = await browser.$('input[name=password]')
  42. await passwordInput.waitForDisplayed(30000)
  43. await passwordInput.setValue(process.env.UPPY_GOOGLE_PASSWORD)
  44. nextButton = await browser.$('#passwordNext')
  45. await nextButton.click()
  46. await browser.pause(3000)
  47. const emailListItem = await browser.$(`li div[data-identifier="${process.env.UPPY_GOOGLE_EMAIL}"]`)
  48. if (await emailListItem.isExisting()) {
  49. // if user is already signed in, just select user
  50. await emailListItem.click()
  51. }
  52. const allowZoomButton = await browser.$('#submit_approve_access')
  53. if (await allowZoomButton.isExisting()) {
  54. // if Zoom has never been allowed, allow it
  55. await allowZoomButton.click()
  56. }
  57. }