2016-01-13 09:29:41 +00:00
|
|
|
require 'browser_test_helper'
|
|
|
|
|
|
|
|
class OtrsImportBrowserTest < TestCase
|
|
|
|
def test_import
|
2016-01-13 12:07:23 +00:00
|
|
|
|
|
|
|
if !ENV['IMPORT_BT_OTRS_ENDPOINT']
|
2016-03-01 14:26:46 +00:00
|
|
|
raise "ERROR: Need IMPORT_BT_OTRS_ENDPOINT - hint IMPORT_BT_OTRS_ENDPOINT='http://vz305.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator'"
|
2016-01-13 12:07:23 +00:00
|
|
|
end
|
|
|
|
if !ENV['IMPORT_BT_OTRS_ENDPOINT_KEY']
|
2016-03-01 14:26:46 +00:00
|
|
|
raise "ERROR: Need IMPORT_BT_OTRS_ENDPOINT_KEY - hint IMPORT_BT_OTRS_ENDPOINT_KEY='01234567899876543210'"
|
2016-01-13 12:07:23 +00:00
|
|
|
end
|
|
|
|
|
2016-01-13 09:29:41 +00:00
|
|
|
@browser = browser_instance
|
|
|
|
location(url: browser_url)
|
|
|
|
|
2016-01-13 12:07:23 +00:00
|
|
|
click(css: 'a[href="#import"]')
|
|
|
|
click(css: 'a[href="#import/otrs"]')
|
2016-01-13 16:33:08 +00:00
|
|
|
click(css: '.js-download')
|
|
|
|
click(css: '.js-otrs-link')
|
2016-01-13 15:59:26 +00:00
|
|
|
|
2016-01-13 17:00:43 +00:00
|
|
|
invalid_key_url = "#{ENV['IMPORT_BT_OTRS_ENDPOINT']};Key=31337"
|
|
|
|
|
|
|
|
set(
|
|
|
|
css: '#otrs-link',
|
|
|
|
value: invalid_key_url
|
|
|
|
)
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.otrs-link-error',
|
2016-01-13 17:00:43 +00:00
|
|
|
value: 'Invalid API key.',
|
|
|
|
)
|
|
|
|
|
|
|
|
import_url = "#{ENV['IMPORT_BT_OTRS_ENDPOINT']};Key=#{ENV['IMPORT_BT_OTRS_ENDPOINT_KEY']}"
|
2016-01-13 12:07:23 +00:00
|
|
|
set(
|
|
|
|
css: '#otrs-link',
|
|
|
|
value: import_url
|
|
|
|
)
|
2016-01-13 17:00:43 +00:00
|
|
|
sleep 5
|
|
|
|
|
|
|
|
watch_for_disappear(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.otrs-link-error',
|
2016-01-13 17:00:43 +00:00
|
|
|
value: 'Invalid API key.',
|
2016-01-13 15:59:26 +00:00
|
|
|
)
|
2017-01-15 10:47:20 +00:00
|
|
|
click(css: '.js-migration-check')
|
2016-01-13 15:59:26 +00:00
|
|
|
|
2017-01-15 10:47:20 +00:00
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.wizard-slide:not(.hide)',
|
2017-01-15 10:47:20 +00:00
|
|
|
value: 'Notice',
|
|
|
|
)
|
2016-01-13 16:33:08 +00:00
|
|
|
click(css: '.js-migration-start')
|
2016-01-13 15:59:26 +00:00
|
|
|
|
2016-01-13 09:29:41 +00:00
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: 'body',
|
|
|
|
value: 'login',
|
2017-09-27 08:38:59 +00:00
|
|
|
timeout: 600,
|
2016-01-13 09:29:41 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|