Maintenance: Improved RSpec screen size handling.
This commit is contained in:
parent
aae15bcf4d
commit
c6d9abd96e
6 changed files with 61 additions and 71 deletions
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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' }
|
||||
|
|
|
@ -157,7 +157,7 @@ RSpec.describe 'Ticket > Update > Simultaneously with two different user', type:
|
|||
find('.js-objectTitle').set('TTTsome level 2 <b>subject</b> 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 <b>subject</b> 123äöü')
|
||||
|
||||
|
|
|
@ -149,32 +149,24 @@ 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 }
|
||||
|
||||
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' do
|
||||
let(:width) { 1020 }
|
||||
let(:height) { 1040 }
|
||||
|
||||
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
|
||||
|
@ -184,25 +176,16 @@ RSpec.describe 'Ticket views', type: :system, authenticated_as: :authenticate do
|
|||
context 'with many macros' do
|
||||
let(:all) { 50 }
|
||||
|
||||
context 'when on large screen' do
|
||||
let(:width) { 1520 }
|
||||
let(:height) { 1040 }
|
||||
|
||||
context 'when on large screen', screen_size: :desktop do
|
||||
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
|
||||
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
|
||||
|
||||
include_examples 'show macros batch overlay'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when performing a Bulk action' do
|
||||
|
|
Loading…
Reference in a new issue