Improved test.

This commit is contained in:
Martin Edenhofer 2016-08-16 08:31:54 +02:00
parent a9fe4310c5
commit 3bf32d51e4
3 changed files with 21 additions and 12 deletions

View file

@ -327,6 +327,7 @@ class AddPermission < ActiveRecord::Migration
name: 'chat',
note: 'Access to %s',
preferences: {
disabled: true,
translations: ['Chat']
},
)

View file

@ -270,6 +270,7 @@ class MaintenanceTest < TestCase
browser: browser1,
css: '#content .js-modeSetting',
type: 'on',
no_check: true,
)
# check warning
@ -351,6 +352,7 @@ class MaintenanceTest < TestCase
browser: browser1,
css: '#content .js-modeSetting',
type: 'on',
no_check: true,
)
# check warning
alert = browser1.switch_to.alert

View file

@ -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,24 +698,29 @@ 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
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
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
=begin