Test stabilization:

- Use standard way to navigate to manage view.
- Use standard way to wait for closing modal dialog.
- Selected user is not system state agnostic.
- Take screenshot if group selection fails.
This commit is contained in:
Thorsten Eckel 2018-12-14 18:29:31 +01:00
parent b2b2afb333
commit ab4e03f0ab

View file

@ -11,7 +11,7 @@ class AdminPermissionsGranularVsFullTest < TestCase
) )
tasks_close_all() tasks_close_all()
click(css: '.user-menu a[title=Admin') click(css: 'a[href="#manage"]')
click(css: '.content.active a[href="#manage/groups"]') click(css: '.content.active a[href="#manage/groups"]')
click(css: '.content.active a[data-type="new"]') click(css: '.content.active a[data-type="new"]')
@ -21,26 +21,34 @@ class AdminPermissionsGranularVsFullTest < TestCase
element.clear element.clear
element.send_keys(new_group_name) element.send_keys(new_group_name)
click(css: '.modal button.js-submit') click(css: '.modal button.js-submit')
modal_disappear
sleep(1)
click(css: '.content.active a[href="#manage/users"]') click(css: '.content.active a[href="#manage/users"]')
user_css = '.user-list .js-tableBody tr td' user_css = '.user-list .js-tableBody tr td'
watch_for(css: user_css) watch_for(css: user_css)
click(css: user_css) @browser.find_elements(css: '.content.active .user-list td:first-child').each do |entry|
next if entry.text.strip != 'master@example.com'
entry.click
break
end
modal_ready modal_ready
scroll_script = "var el = document.getElementsByClassName('modal')[0];" scroll_script = "var el = document.getElementsByClassName('modal')[0];"
scroll_script += 'el.scrollTo(0, el.scrollHeight);' scroll_script += 'el.scrollTo(0, el.scrollHeight);'
@browser.execute_script scroll_script @browser.execute_script scroll_script
group = @browser.find_elements(css: '.modal .settings-list tbody tr').find do |el| group = @browser.find_elements(css: '.modal .settings-list tbody tr').find do |el|
el.find_element(css: 'td').text == new_group_name el.find_element(css: 'td').text == new_group_name
end end
if !group
screenshot(comment: 'group_not_found')
raise "Can't find group #{new_group_name}"
end
toggle_checkbox(group, 'full') toggle_checkbox(group, 'full')
sleep(1) sleep(1)
assert(checkbox_is_selected(group, 'full')) assert(checkbox_is_selected(group, 'full'))