From 3202f8a51a11a19371a2a665b9e694716deca7e0 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 3 Feb 2016 11:02:07 +0100 Subject: [PATCH] Fixed bug: Results have to get compared in the browser since the backend runs in the test mode and the frontend in production. --- .../app/controllers/import_zendesk.coffee | 6 +++- .../zendesk_import_browser_test.rb | 33 ++++++++++++++----- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/app/controllers/import_zendesk.coffee b/app/assets/javascripts/app/controllers/import_zendesk.coffee index a94f5631c..e0f1519cc 100644 --- a/app/assets/javascripts/app/controllers/import_zendesk.coffee +++ b/app/assets/javascripts/app/controllers/import_zendesk.coffee @@ -151,7 +151,11 @@ class Index extends App.ControllerContent success: (data, status, xhr) => if data.result is 'import_done' - window.location.reload() + delay = 0 + if @Config.get('developer_mode') is true + delay = 5000 + + @delay(window.location.reload, delay) return if data.result is 'error' diff --git a/test/integration/zendesk_import_browser_test.rb b/test/integration/zendesk_import_browser_test.rb index f2e90468d..b40b378c7 100644 --- a/test/integration/zendesk_import_browser_test.rb +++ b/test/integration/zendesk_import_browser_test.rb @@ -79,17 +79,32 @@ class ZendeskImportBrowserTest < TestCase click(css: '.js-migration-start') watch_for( - css: 'body', - value: 'login', + css: '.js-group .js-done', + value: '2', + timeout: 60, + ) + + watch_for( + css: '.js-organization .js-done', + value: '1', + timeout: 60, + ) + + watch_for( + css: '.js-user .js-done', + value: '141', + timeout: 60, + ) + + watch_for( + css: '.js-ticket .js-done', + value: '143', timeout: 300, ) - assert_equal( 143, User.count, 'users' ) - assert_equal( 3, Group.count, 'groups' ) - assert_equal( 5, Role.count, 'roles' ) - assert_equal( 2, Organization.count, 'organizations' ) - assert_equal( 144, Ticket.count, 'tickets' ) - assert_equal( 151, Ticket::Article.count, 'ticket articles' ) - assert_equal( 2, Store.count, 'ticket article attachments' ) + watch_for( + css: 'body', + value: 'login', + ) end end