otrs_import_browser_test.rb 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class OtrsImportBrowserTest < TestCase
  4. def test_import
  5. if !ENV['IMPORT_BT_OTRS_ENDPOINT']
  6. raise "ERROR: Need IMPORT_BT_OTRS_ENDPOINT - hint IMPORT_BT_OTRS_ENDPOINT='http://vz305.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator'"
  7. end
  8. if !ENV['IMPORT_BT_OTRS_ENDPOINT_KEY']
  9. raise "ERROR: Need IMPORT_BT_OTRS_ENDPOINT_KEY - hint IMPORT_BT_OTRS_ENDPOINT_KEY='01234567899876543210'"
  10. end
  11. @browser = browser_instance
  12. location(url: browser_url)
  13. click(css: 'a[href="#import"]')
  14. click(css: 'a[href="#import/otrs"]')
  15. click(css: '.js-download')
  16. click(css: '.js-otrs-link')
  17. invalid_key_url = "#{ENV['IMPORT_BT_OTRS_ENDPOINT']};Key=31337"
  18. set(
  19. css: '#otrs-link',
  20. value: invalid_key_url
  21. )
  22. sleep 5
  23. watch_for(
  24. css: '.otrs-link-error',
  25. value: 'Invalid API key.',
  26. )
  27. import_url = "#{ENV['IMPORT_BT_OTRS_ENDPOINT']};Key=#{ENV['IMPORT_BT_OTRS_ENDPOINT_KEY']}"
  28. set(
  29. css: '#otrs-link',
  30. value: import_url
  31. )
  32. sleep 5
  33. watch_for_disappear(
  34. css: '.otrs-link-error',
  35. value: 'Invalid API key.',
  36. )
  37. click(css: '.js-migration-check')
  38. watch_for(
  39. css: '.wizard-slide:not(.hide)',
  40. value: 'Notice',
  41. )
  42. click(css: '.js-migration-start')
  43. watch_for(
  44. css: 'body',
  45. value: 'login',
  46. timeout: 300,
  47. )
  48. end
  49. end