otrs_import_browser_test.rb 1.4 KB

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