Improved test.
This commit is contained in:
parent
a9fe4310c5
commit
3bf32d51e4
3 changed files with 21 additions and 12 deletions
|
@ -327,6 +327,7 @@ class AddPermission < ActiveRecord::Migration
|
|||
name: 'chat',
|
||||
note: 'Access to %s',
|
||||
preferences: {
|
||||
disabled: true,
|
||||
translations: ['Chat']
|
||||
},
|
||||
)
|
||||
|
|
|
@ -267,9 +267,10 @@ class MaintenanceTest < TestCase
|
|||
)
|
||||
|
||||
switch(
|
||||
browser: browser1,
|
||||
css: '#content .js-modeSetting',
|
||||
type: 'on',
|
||||
browser: browser1,
|
||||
css: '#content .js-modeSetting',
|
||||
type: 'on',
|
||||
no_check: true,
|
||||
)
|
||||
|
||||
# check warning
|
||||
|
@ -348,9 +349,10 @@ class MaintenanceTest < TestCase
|
|||
)
|
||||
|
||||
switch(
|
||||
browser: browser1,
|
||||
css: '#content .js-modeSetting',
|
||||
type: 'on',
|
||||
browser: browser1,
|
||||
css: '#content .js-modeSetting',
|
||||
type: 'on',
|
||||
no_check: true,
|
||||
)
|
||||
# check warning
|
||||
alert = browser1.switch_to.alert
|
||||
|
|
|
@ -685,6 +685,7 @@ class TestCase < Test::Unit::TestCase
|
|||
browser: browser1,
|
||||
css: '.some_class',
|
||||
type: 'on', # 'off'
|
||||
no_check: true, # do not check is switch has changed, in case if js alert
|
||||
)
|
||||
|
||||
=end
|
||||
|
@ -697,22 +698,27 @@ class TestCase < Test::Unit::TestCase
|
|||
|
||||
element = instance.find_elements(css: "#{params[:css]} input[type=checkbox]")[0]
|
||||
checked = element.attribute('checked')
|
||||
|
||||
if !checked
|
||||
if params[:type] == 'on'
|
||||
instance.find_elements(css: "#{params[:css]} label")[0].click
|
||||
sleep 2
|
||||
|
||||
element = instance.find_elements(css: "#{params[:css]} input[type=checkbox]")[0]
|
||||
checked = element.attribute('checked')
|
||||
raise 'Switch not on!' if !checked
|
||||
if params[:no_check] != true
|
||||
element = instance.find_elements(css: "#{params[:css]} input[type=checkbox]")[0]
|
||||
checked = element.attribute('checked')
|
||||
raise 'Switch not on!' if !checked
|
||||
end
|
||||
end
|
||||
elsif params[:type] == 'off'
|
||||
instance.find_elements(css: "#{params[:css]} label")[0].click
|
||||
sleep 2
|
||||
|
||||
element = instance.find_elements(css: "#{params[:css]} input[type=checkbox]")[0]
|
||||
checked = element.attribute('checked')
|
||||
raise 'Switch not off!' if checked
|
||||
if params[:no_check] != true
|
||||
element = instance.find_elements(css: "#{params[:css]} input[type=checkbox]")[0]
|
||||
checked = element.attribute('checked')
|
||||
raise 'Switch not off!' if checked
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue