X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/86f994bb5d039e62bfc4383ed9f510b77b71ecad..09cbdc3074b3f1e69c9c537875146f6da0a6ed8f:/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 3af7f922a3..98ce8aad14 100644 --- a/apps/workbench/test/integration/report_issue_test.rb +++ b/apps/workbench/test/integration/report_issue_test.rb @@ -1,25 +1,24 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'integration_helper' -require 'selenium-webdriver' -require 'headless' class ReportIssueTest < ActionDispatch::IntegrationTest setup do - headless = Headless.new - headless.start - Capybara.current_driver = :selenium - - @user_profile_form_fields = Rails.configuration.user_profile_form_fields + need_javascript + @user_profile_form_fields = Rails.configuration.Workbench.UserProfileFormFields end teardown do - Rails.configuration.user_profile_form_fields = @user_profile_form_fields + Rails.configuration.Workbench.UserProfileFormFields = @user_profile_form_fields end # 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' @@ -37,19 +36,19 @@ class ReportIssueTest < ActionDispatch::IntegrationTest 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?('Send problem report'), 'Found button - Send problem report' - api_version_rgx = %r!^https://github.com/curoverse/arvados/tree/[0-9a-f]+/services/api/?$! - wb_version_rgx = %r!^https://github.com/curoverse/arvados/tree/[0-9a-f]+/apps/workbench/?$! - assert_not_empty(all("a").select { |a| a[:href] =~ wb_version_rgx }) - assert_not_empty(all("a").select { |a| a[:href] =~ api_version_rgx }) + history_links = all('a').select do |a| + a[:href] =~ %r!^https://dev.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 @@ -64,6 +63,11 @@ class ReportIssueTest < ActionDispatch::IntegrationTest # enter a report text and click on report page.find_field('report_issue_text').set 'my test report text' 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 @@ -84,7 +88,8 @@ class ReportIssueTest < 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 version info and report issue for user #{token}" do