otrs_import_browser_test.rb 1.5 KB

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