first.test.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. var webdriverio = require('webdriverio')
  2. var path = require('path')
  3. var options = {
  4. desiredCapabilities: {
  5. browserName: 'firefox'
  6. }
  7. }
  8. var browser = webdriverio.remote(options)
  9. var uppyTestURL = 'http://localhost:9966'
  10. beforeAll(() => {
  11. return browser
  12. .init()
  13. // .url(uppyTestURL)
  14. })
  15. afterAll(() => {
  16. return browser.end()
  17. })
  18. describe('Uppy end to end test', () => {
  19. test('search test', function () {
  20. return browser
  21. // .init()
  22. .url('https://duckduckgo.com/')
  23. .setValue('#search_form_input_homepage', 'WebdriverIO')
  24. .click('#search_button_homepage')
  25. .getTitle().then(function (title) {
  26. console.log(title)
  27. expect(title).toBe('WebdriverIO at DuckDuckGo')
  28. })
  29. // .end()
  30. }, 10000)
  31. test('another test', function () {
  32. return browser
  33. .url(uppyTestURL)
  34. .chooseFile('#uppyDragDrop .uppy-DragDrop-input', path.join(__dirname, 'image.jpg'))
  35. .pause(3000)
  36. .getHTML('#uppyDragDrop-progress .UppyProgressBar-percentage', false).then(val => {
  37. console.log(val)
  38. expect(parseInt(val)).toBe(100)
  39. })
  40. }, 10000)
  41. })