From 04d35f009659576f102ef36915a66370b75f90bd Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 4 Jun 2013 09:00:09 +0200 Subject: [PATCH 1/2] Removed not needed empty lines. --- app/models/history.rb | 10 +++++----- app/models/observer/history.rb | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/history.rb b/app/models/history.rb index 592f080d9..497c7801b 100644 --- a/app/models/history.rb +++ b/app/models/history.rb @@ -10,7 +10,7 @@ class History < ApplicationModel @@cache_object = {} @@cache_attribute = {} - def self.history_create(data) + def self.history_create(data) # lookups if data[:history_type] @@ -179,7 +179,7 @@ class History < ApplicationModel if item['history_object'] == 'User' users[ item['o_id'] ] = User.user_data_full( item['o_id'] ) end - + # load users if !users[ item['created_by_id'] ] users[ item['created_by_id'] ] = User.user_data_full( item['created_by_id'] ) @@ -227,7 +227,7 @@ class History < ApplicationModel return history_type end - def self.history_object_lookup_id( id ) + def self.history_object_lookup_id( id ) # use cache return @@cache_object[ id ] if @@cache_object[ id ] @@ -238,7 +238,7 @@ class History < ApplicationModel return history_object end - def self.history_object_lookup( name ) + def self.history_object_lookup( name ) # use cache return @@cache_object[ name ] if @@cache_object[ name ] @@ -258,7 +258,7 @@ class History < ApplicationModel return history_object end - def self.history_attribute_lookup( name ) + def self.history_attribute_lookup( name ) # use cache return @@cache_attribute[ name ] if @@cache_attribute[ name ] diff --git a/app/models/observer/history.rb b/app/models/observer/history.rb index ba5801775..5775cb789 100644 --- a/app/models/observer/history.rb +++ b/app/models/observer/history.rb @@ -39,7 +39,7 @@ class Observer::History < ActiveRecord::Observer # do not send anything if nothing has changed return if current.attributes == record.attributes - + puts "HISTORY OBSERVER, object will be updated #{ record.class.name.to_s}.find(#{ current.id.to_s })" # puts 'current' # puts current.inspect @@ -169,4 +169,4 @@ class Observer::History < ActiveRecord::Observer end h end -end \ No newline at end of file +end From d84ec44b55ffd5434bee65f74c15eb240144114c Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 8 Jun 2013 00:31:41 +0200 Subject: [PATCH 2/2] Added browser tests for taskbar. --- test/browser/taskbar_test.rb | 179 +++++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 test/browser/taskbar_test.rb diff --git a/test/browser/taskbar_test.rb b/test/browser/taskbar_test.rb new file mode 100644 index 000000000..97531791d --- /dev/null +++ b/test/browser/taskbar_test.rb @@ -0,0 +1,179 @@ +# encoding: utf-8 +require 'browser_test_helper' + +class TaskbarTest < TestCase + def test_current_session_a_same_agent + tests = [ + { + :name => 'start', + :instance1 => browser_instance, + :instance2 => browser_instance, + :instance1_username => 'master@example.com', + :instance1_password => 'test', + :instance2_username => 'master@example.com', + :instance2_password => 'test', + :url => browser_url, + :action => [ + { + :where => :instance1, + :execute => 'check', + :css => '#login', + :result => false, + }, + { + :where => :instance2, + :execute => 'check', + :css => '#login', + :result => false, + }, + { + :execute => 'wait', + :value => 5, + }, + { + :where => :instance1, + :execute => 'match', + :css => 'body', + :value => 'Reload application', + :match_result => true, + }, + { + :where => :instance2, + :execute => 'match', + :css => 'body', + :value => 'Reload application', + :match_result => false, + }, +# { +# :execute => 'wait', +# :value => 1, +# }, + ], + }, + ] + browser_double_test(tests) + end + + def test_current_session_b_different_agent + tests = [ + { + :name => 'start', + :instance1 => browser_instance, + :instance2 => browser_instance, + :instance1_username => 'master@example.com', + :instance1_password => 'test', + :instance2_username => 'agent1@example.com', + :instance2_password => 'test', + :url => browser_url, + :action => [ + { + :where => :instance1, + :execute => 'check', + :css => '#login', + :result => false, + }, + { + :where => :instance2, + :execute => 'check', + :css => '#login', + :result => false, + }, + { + :execute => 'wait', + :value => 5, + }, + { + :where => :instance1, + :execute => 'match', + :css => 'body', + :value => 'Reload application', + :match_result => false, + }, + { + :where => :instance2, + :execute => 'match', + :css => 'body', + :value => 'Reload application', + :match_result => false, + }, +# { +# :execute => 'wait', +# :value => 1, +# }, + ], + }, + ] + browser_double_test(tests) + end + + def test_persistant_task_a + tests = [ + { + :name => 'persistant task', + :action => [ + { + :execute => 'click', + :css => 'a[href="#new"]', + }, + { + :execute => 'click', + :css => 'a[href="#ticket_create/call_inbound"]', + }, + { + :execute => 'wait', + :value => 5, + }, + { + :execute => 'check', + :css => '.active .ticket_create', + :result => true, + }, + { + :execute => 'set', + :css => '.active .ticket_create input[name="subject"]', + :value => 'some test AAA', + }, + { + :execute => 'wait', + :value => 20, + }, + ], + }, + ] + browser_signle_test_with_login(tests, { :username => 'agent1@example.com' }) + end + def test_persistant_task_b + tests = [ + { + :name => 'persistant task', + :action => [ + { + :execute => 'wait', + :value => 6, + }, + { + :execute => 'click', + :css => '.task', + }, + { + :execute => 'match', + :css => 'body', + :value => 'some test AAA', + :match_result => true, + }, + { + :execute => 'click', + :css => '.taskbar [data-type="close"]', + }, + { + :execute => 'match', + :css => 'body', + :value => 'some test AAA', + :match_result => false, + }, + ], + }, + ] + browser_signle_test_with_login(tests, { :username => 'agent1@example.com' }) + end +end