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',
|
name: 'chat',
|
||||||
note: 'Access to %s',
|
note: 'Access to %s',
|
||||||
preferences: {
|
preferences: {
|
||||||
|
disabled: true,
|
||||||
translations: ['Chat']
|
translations: ['Chat']
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -267,9 +267,10 @@ class MaintenanceTest < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
switch(
|
switch(
|
||||||
browser: browser1,
|
browser: browser1,
|
||||||
css: '#content .js-modeSetting',
|
css: '#content .js-modeSetting',
|
||||||
type: 'on',
|
type: 'on',
|
||||||
|
no_check: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
# check warning
|
# check warning
|
||||||
|
@ -348,9 +349,10 @@ class MaintenanceTest < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
switch(
|
switch(
|
||||||
browser: browser1,
|
browser: browser1,
|
||||||
css: '#content .js-modeSetting',
|
css: '#content .js-modeSetting',
|
||||||
type: 'on',
|
type: 'on',
|
||||||
|
no_check: true,
|
||||||
)
|
)
|
||||||
# check warning
|
# check warning
|
||||||
alert = browser1.switch_to.alert
|
alert = browser1.switch_to.alert
|
||||||
|
|
|
@ -685,6 +685,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
browser: browser1,
|
browser: browser1,
|
||||||
css: '.some_class',
|
css: '.some_class',
|
||||||
type: 'on', # 'off'
|
type: 'on', # 'off'
|
||||||
|
no_check: true, # do not check is switch has changed, in case if js alert
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
@ -697,22 +698,27 @@ class TestCase < Test::Unit::TestCase
|
||||||
|
|
||||||
element = instance.find_elements(css: "#{params[:css]} input[type=checkbox]")[0]
|
element = instance.find_elements(css: "#{params[:css]} input[type=checkbox]")[0]
|
||||||
checked = element.attribute('checked')
|
checked = element.attribute('checked')
|
||||||
|
|
||||||
if !checked
|
if !checked
|
||||||
if params[:type] == 'on'
|
if params[:type] == 'on'
|
||||||
instance.find_elements(css: "#{params[:css]} label")[0].click
|
instance.find_elements(css: "#{params[:css]} label")[0].click
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
element = instance.find_elements(css: "#{params[:css]} input[type=checkbox]")[0]
|
if params[:no_check] != true
|
||||||
checked = element.attribute('checked')
|
element = instance.find_elements(css: "#{params[:css]} input[type=checkbox]")[0]
|
||||||
raise 'Switch not on!' if !checked
|
checked = element.attribute('checked')
|
||||||
|
raise 'Switch not on!' if !checked
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elsif params[:type] == 'off'
|
elsif params[:type] == 'off'
|
||||||
instance.find_elements(css: "#{params[:css]} label")[0].click
|
instance.find_elements(css: "#{params[:css]} label")[0].click
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
element = instance.find_elements(css: "#{params[:css]} input[type=checkbox]")[0]
|
if params[:no_check] != true
|
||||||
checked = element.attribute('checked')
|
element = instance.find_elements(css: "#{params[:css]} input[type=checkbox]")[0]
|
||||||
raise 'Switch not off!' if checked
|
checked = element.attribute('checked')
|
||||||
|
raise 'Switch not off!' if checked
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue