test.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. /* global browser, expect, capabilities */
  2. const path = require('path')
  3. const { selectFakeFile, supportsChooseFile, ensureInputVisible } = require('../utils')
  4. const testURL = 'http://localhost:4567/i18n-drag-drop'
  5. describe('File upload with DragDrop + XHRUpload, i18n translated string', function () {
  6. this.retries(2)
  7. beforeEach(async () => {
  8. await browser.url(testURL)
  9. await browser.execute(ensureInputVisible, '#uppyi18n .uppy-DragDrop-input')
  10. })
  11. it('should upload a file with XHRUpload and set progressbar to 100%', async () => {
  12. let testImage = path.join(__dirname, '../../resources/image.jpg')
  13. if (supportsChooseFile(capabilities)) {
  14. const input = await browser.$('#uppyi18n .uppy-DragDrop-input')
  15. await input.setValue(testImage)
  16. } else {
  17. await browser.execute(selectFakeFile, 'uppyi18n')
  18. }
  19. await browser.pause(3000)
  20. const percent = await browser.$('#uppyi18n-progress .uppy-ProgressBar-percentage')
  21. const html = await percent.getHTML(false)
  22. expect(parseInt(html)).to.be.equal(100)
  23. })
  24. it('should translate text strings into Russian', async () => {
  25. const label = await browser.$('#uppyi18n .uppy-DragDrop-label')
  26. const text = await label.getText()
  27. expect(text.trim()).to.be.equal('Перенесите файлы сюда или выберите')
  28. })
  29. })