X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/3e443d57aaecd34e63a8d861c7075ab7b0f61174..9f1ce358ac564abf62965cccf2bf3afa3bcfef95:/apps/workbench/test/integration/report_issue_test.rb diff --git a/apps/workbench/test/integration/report_issue_test.rb b/apps/workbench/test/integration/report_issue_test.rb index ce534ff801..4e1920a939 100644 --- a/apps/workbench/test/integration/report_issue_test.rb +++ b/apps/workbench/test/integration/report_issue_test.rb @@ -1,13 +1,8 @@ require 'integration_helper' -require 'selenium-webdriver' -require 'headless' -class ApplicationLayoutTest < ActionDispatch::IntegrationTest +class ReportIssueTest < ActionDispatch::IntegrationTest setup do - headless = Headless.new - headless.start - Capybara.current_driver = :selenium - + need_javascript @user_profile_form_fields = Rails.configuration.user_profile_form_fields end @@ -17,61 +12,62 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest # test version info and report issue from help menu def check_version_info_and_report_issue_from_help_menu - within('.navbar-fixed-top') do - page.find("#arv-help").click - within('.dropdown-menu') do + within '.navbar-fixed-top' do + find('.help-menu > a').click + within '.help-menu .dropdown-menu' do assert page.has_link?('Tutorials and User guide'), 'No link - Tutorials and User guide' assert page.has_link?('API Reference'), 'No link - API Reference' assert page.has_link?('SDK Reference'), 'No link - SDK Reference' - assert page.has_link?('Show version / debugging info'), 'No link - Show version / debugging info' - assert page.has_link?('Report a problem'), 'No link - Report a problem' + assert page.has_link?('Show version / debugging info ...'), 'No link - Show version / debugging info' + assert page.has_link?('Report a problem ...'), 'No link - Report a problem' # check show version info link - click_link 'Show version / debugging info' + click_link 'Show version / debugging info ...' end end within '.modal-content' do assert page.has_text?('Version / debugging info'), 'No text - Version / debugging info' assert page.has_no_text?('Report a problem'), 'Found text - Report a problem' - assert page.has_text?('Server version'), 'No text - Server version' - assert page.has_text?('Server restarted at'), 'No text - Server restarted at' - assert page.has_text?('Workbench version'), 'No text - Workbench version' - assert page.has_text?('Arvados base'), 'No text - Arvados base' - assert page.has_text?('Additional info'), 'No text - Additional info' - assert page.has_no_text?('Found a problem?'), 'Found text - Found a problem' + assert page.has_no_text?('Describe the problem?'), 'Found text - Describe the problem' assert page.has_button?('Close'), 'No button - Close' - assert page.has_no_button?('Report issue'), 'Found button - Report issue' + assert page.has_no_button?('Send problem report'), 'Found button - Send problem report' + history_links = all('a').select do |a| + a[:href] =~ %r!^https://arvados.org/projects/arvados/repository/changes\?rev=[0-9a-f]+$! + end + assert_operator(2, :<=, history_links.count, + "Should have found two links to revision history " + + "in #{history_links.inspect}") click_button 'Close' end # check report issue link - within('.navbar-fixed-top') do - page.find("#arv-help").click - within('.dropdown-menu') do - click_link 'Report a problem' - end + within '.navbar-fixed-top' do + find('.help-menu > a').click + find('.help-menu .dropdown-menu a', text: 'Report a problem ...').click end within '.modal-content' do assert page.has_text?('Report a problem'), 'No text - Report a problem' assert page.has_no_text?('Version / debugging info'), 'Found text - Version / debugging info' - assert page.has_text?('Server version'), 'No text - Server version' - assert page.has_text?('Server restarted at'), 'No text - Server restarted at' - assert page.has_text?('Workbench version'), 'No text - Workbench version' - assert page.has_text?('Arvados base'), 'No text - Arvados base' - assert page.has_text?('Additional info'), 'No text - Additional info' - assert page.has_text?('Found a problem?'), 'No text - Found a problem' + assert page.has_text?('Describe the problem'), 'No text - Describe the problem' assert page.has_no_button?('Close'), 'Found button - Close' - assert page.has_button?('Report issue'), 'No button - Report issue' + assert page.has_text?('Send problem report'), 'Send problem report button text is not found' + assert page.has_no_button?('Send problem report'), 'Send problem report button is not disabled before entering problem description' assert page.has_button?('Cancel'), 'No button - Cancel' # enter a report text and click on report page.find_field('report_issue_text').set 'my test report text' - click_button 'Report issue' + assert page.has_button?('Send problem report'), 'Send problem report button not enabled after entering text' + + report = mock + report.expects(:deliver).returns true + IssueReporter.expects(:send_report).returns report + + click_button 'Send problem report' # ajax success updated button texts and added footer message - assert page.has_no_button?('Report issue'), 'Found button - Report issue' + assert page.has_no_text?('Send problem report'), 'Found button - Send problem report' assert page.has_no_button?('Cancel'), 'Found button - Cancel' assert page.has_text?('Report sent'), 'No text - Report sent' assert page.has_button?('Close'), 'No text - Close' @@ -88,10 +84,11 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest ['active', api_fixture('users')['active']], ['admin', api_fixture('users')['admin']], ['active_no_prefs', api_fixture('users')['active_no_prefs']], - ['active_no_prefs_profile', api_fixture('users')['active_no_prefs_profile']], + ['active_no_prefs_profile_no_getting_started_shown', + api_fixture('users')['active_no_prefs_profile_no_getting_started_shown']], ].each do |token, user| - test "check help for user #{token}" do + test "check version info and report issue for user #{token}" do if !token visit ('/') else