diff --git a/public/assets/tests/qunit/form_color.js b/public/assets/tests/qunit/form_color.js
index 678d982d7..662ebd2dd 100644
--- a/public/assets/tests/qunit/form_color.js
+++ b/public/assets/tests/qunit/form_color.js
@@ -59,16 +59,19 @@ QUnit.test("form elements check", assert => {
previousSwatchColor = getSwatchColor()
return new Promise( (resolve,reject) => {
- syn.click(inputEl).drag(circle, { to: '-10x-10'}, resolve)
+ syn.click(inputEl, resolve)
+ })
+ .then(function(resolve){
+ return new Promise( (resolve, reject) => {
+ var square = el.find('.js-colorpicker-saturation-gradient')[0]
+ syn.click(square, {}, resolve)
+ })
})
})
.then( function() {
var params = App.ControllerForm.params(el)
- var test_params = {
- color: 'hsl(169,100%,20%)'
- }
- assert.deepEqual(params, test_params, 'Color is transformed to HSL after moving the circle')
+ assert.ok(params.color.match(/hsl\(180,(\d{2})%,2\d{1}%\)/), 'Color is transformed to HSL after moving the circle')
assert.notEqual(previousSwatchColor, getSwatchColor(), 'color in swatch was updated')
})
.then( function() {
@@ -76,16 +79,13 @@ QUnit.test("form elements check", assert => {
previousSwatchColor = getSwatchColor()
return new Promise( (resolve,reject) => {
- syn.drag(slider, { to: '-0x-11'}, resolve)
+ syn.drag(slider, { to: '-0x-15'}, resolve)
})
})
.then( function() {
var params = App.ControllerForm.params(el)
- var test_params = {
- color: 'hsl(169,100%,27%)'
- }
- assert.deepEqual(params, test_params, 'Color code is changed after draging slider')
+ assert.ok(params.color.match(/hsl\(180,(\d{2})%,3\d{1}%\)/), 'Color is changed after moving slider')
assert.notEqual(previousSwatchColor, getSwatchColor(), 'color in swatch was updated')
})
.then( function() {
diff --git a/spec/support/capybara/driven_by.rb b/spec/support/capybara/driven_by.rb
index 36a697026..c33083671 100644
--- a/spec/support/capybara/driven_by.rb
+++ b/spec/support/capybara/driven_by.rb
@@ -3,7 +3,7 @@
require_relative './set_up'
RSpec.configure do |config|
- config.before(:each, type: :system) do
+ config.before(:each, type: :system) do |example|
Capybara.register_server :puma_wrapper do |app, port, host, **_options|
@@ -23,10 +23,22 @@ RSpec.configure do |config|
# set custom Zammad driver (e.g. zammad_chrome) for special
# functionalities and CI requirements
- driven_by(:"zammad_#{ENV.fetch('BROWSER', 'firefox')}")
+ browser_name = ENV.fetch('BROWSER', 'firefox')
+ driven_by(:"zammad_#{browser_name}")
+
+ case example.metadata.fetch(:screen_size, :desktop)
+ when :tablet
+ browser_width = 1020
+ browser_height = 760
+ else # :desktop
+ browser_width = 1520
+ browser_height = 1000
+ end
+
+ # Firefox and Chrome effective screen sizes are slightly different
+ # accomodate that by reducing declared screen size on Firefox
+ browser_height -= 44 if browser_name == 'firefox'
- browser_width = ENV['BROWSER_WIDTH'] || 1024
- browser_height = ENV['BROWSER_HEIGHT'] || 800
page.driver.browser.manage.window.resize_to(browser_width, browser_height)
end
end
diff --git a/spec/system/search_spec.rb b/spec/system/search_spec.rb
index 3fbd14804..b4f542cc9 100644
--- a/spec/system/search_spec.rb
+++ b/spec/system/search_spec.rb
@@ -103,8 +103,6 @@ RSpec.describe 'Search', type: :system, authenticated: true, searchindex: true d
end
context 'bulk note' do
- before { current_window.resize_to(1300, 1040) }
-
it 'adds note to selected ticket' do
within :active_content do
find("tr[data-id='#{ticket_1.id}']").check('bulk', allow_label_click: true)
diff --git a/spec/system/setup/first_steps_spec.rb b/spec/system/setup/first_steps_spec.rb
index 740867b90..77a34de68 100644
--- a/spec/system/setup/first_steps_spec.rb
+++ b/spec/system/setup/first_steps_spec.rb
@@ -55,9 +55,6 @@ RSpec.describe 'First Steps', type: :system do
end
it 'creates test ticket', sessions_jobs: true do
- # make window large enough to show activity stream
- page.current_window.resize_to(1520, 800)
-
initial_ticket_count = Ticket.count
within(:active_content) { click '.js-testTicket' }
diff --git a/spec/system/ticket/update/simultaneously_with_two_user_spec.rb b/spec/system/ticket/update/simultaneously_with_two_user_spec.rb
index a79d31323..bab2e613c 100644
--- a/spec/system/ticket/update/simultaneously_with_two_user_spec.rb
+++ b/spec/system/ticket/update/simultaneously_with_two_user_spec.rb
@@ -157,7 +157,7 @@ RSpec.describe 'Ticket > Update > Simultaneously with two different user', type:
find('.js-objectTitle').set('TTTsome level 2 subject 123äöü')
# Click in the body field, to trigger the title update.
- click '.js-textarea'
+ find('.js-textarea').send_keys('trigger title')
expect(page).to have_css('.js-objectTitle', text: 'TTTsome level 2 subject 123äöü')
diff --git a/spec/system/ticket/view_spec.rb b/spec/system/ticket/view_spec.rb
index 0ec2829eb..abddd6e0e 100644
--- a/spec/system/ticket/view_spec.rb
+++ b/spec/system/ticket/view_spec.rb
@@ -149,59 +149,42 @@ RSpec.describe 'Ticket views', type: :system, authenticated_as: :authenticate do
end
end
- shared_examples 'show macros batch overlay' do
- def authenticate
- Macro.destroy_all && (create_list :macro, all)
- true
- end
-
- before do
- page.current_window.resize_to(width, height)
- visit '#ticket/view/all_open'
- end
-
- context 'with few macros' do
- let(:all) { 15 }
-
- context 'when on large screen' do
- let(:width) { 1520 }
- let(:height) { 1040 }
-
- it_behaves_like 'showing all macros'
- it_behaves_like "not adding 'small' class to macro element"
- end
-
- context 'when on small screen' do
- let(:width) { 1020 }
- let(:height) { 1040 }
-
- it_behaves_like 'showing all macros'
- it_behaves_like "not adding 'small' class to macro element"
- end
-
- end
-
- context 'with many macros' do
- let(:all) { 50 }
-
- context 'when on large screen' do
- let(:width) { 1520 }
- let(:height) { 1040 }
-
- it_behaves_like 'showing some macros', 32
- end
-
- context 'when on small screen' do
- let(:width) { 1020 }
- let(:height) { 1040 }
-
- it_behaves_like 'showing some macros', 30
- it_behaves_like "adding 'small' class to macro element"
- end
- end
+ def authenticate
+ Macro.destroy_all && (create_list :macro, all)
+ true
end
- include_examples 'show macros batch overlay'
+ before do
+ visit '#ticket/view/all_open'
+ end
+
+ context 'with few macros' do
+ let(:all) { 15 }
+
+ context 'when on large screen', screen_size: :desktop do
+ it_behaves_like 'showing all macros'
+ it_behaves_like "not adding 'small' class to macro element"
+ end
+
+ context 'when on small screen', screen_size: :tablet do
+ it_behaves_like 'showing all macros'
+ it_behaves_like "not adding 'small' class to macro element"
+ end
+
+ end
+
+ context 'with many macros' do
+ let(:all) { 50 }
+
+ context 'when on large screen', screen_size: :desktop do
+ it_behaves_like 'showing some macros', 32
+ end
+
+ context 'when on small screen', screen_size: :tablet do
+ it_behaves_like 'showing some macros', 24
+ it_behaves_like "adding 'small' class to macro element"
+ end
+ end
end
end