otrs_import_browser_test.rb 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. require 'browser_test_helper'
  2. class OtrsImportBrowserTest < TestCase
  3. def test_import
  4. if !ENV['IMPORT_OTRS_ENDPOINT']
  5. raise "ERROR: Need IMPORT_OTRS_ENDPOINT - hint IMPORT_OTRS_ENDPOINT='http://vz305.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator'"
  6. end
  7. if !ENV['IMPORT_OTRS_ENDPOINT_KEY']
  8. raise "ERROR: Need IMPORT_OTRS_ENDPOINT_KEY - hint IMPORT_OTRS_ENDPOINT_KEY='01234567899876543210'"
  9. end
  10. puts "Using endpoint '#{ENV['IMPORT_OTRS_ENDPOINT']}'."
  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_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_OTRS_ENDPOINT']};Key=#{ENV['IMPORT_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: 600,
  47. )
  48. end
  49. end