4465: test for regex link targets
authorTim Pierce <twp@curoverse.com>
Thu, 4 Dec 2014 16:26:58 +0000 (11:26 -0500)
committerTim Pierce <twp@curoverse.com>
Thu, 4 Dec 2014 16:26:58 +0000 (11:26 -0500)
The goal of this story is that the "report issue" dialog includes links
to a Github or Redmine page corresponding to the software versions for
Workbench and the API server, so the test should ensure not just that
there's a link with a given text, but that its target is a Github page
corresponding to a hexadecimal commit hash.

apps/workbench/test/integration/report_issue_test.rb

index 7eb65a22b814c564b123468399ae6605fb6d094b..fcbf4e7f1c043639664c43d977b1b7dda04ebc12 100644 (file)
@@ -1,11 +1,8 @@
 require 'integration_helper'
 require 'selenium-webdriver'
 require 'headless'
-require_relative '../../app/helpers/version_helper'
 
 class ReportIssueTest < ActionDispatch::IntegrationTest
-  include VersionHelper
-
   setup do
     headless = Headless.new
     headless.start
@@ -38,10 +35,12 @@ class ReportIssueTest < ActionDispatch::IntegrationTest
       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_no_text?('Describe the problem?'), 'Found text - Describe the problem'
-      assert page.has_link?(api_version), 'No link for API version'
-      assert page.has_link?(wb_version_text), 'No link for Workbench version'
       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 })
       click_button 'Close'
     end