[ARVADOS] created: bf53b14daa894c77ea2b9413e9a574897446a2b7

git at public.curoverse.com git at public.curoverse.com
Fri Mar 21 17:24:14 EDT 2014


        at  bf53b14daa894c77ea2b9413e9a574897446a2b7 (commit)


commit bf53b14daa894c77ea2b9413e9a574897446a2b7
Author: Brett Smith <brett at curoverse.com>
Date:   Fri Mar 21 17:24:07 2014 -0400

    workbench: Add basic smoke test.
    
    This visits all the link on a user's front page and makes sure they
    all return 200.
    
    It's easy to extend this to crawl the entire site, checking for
    success.  I've included the code for that.  We need to squash some
    bugs and check the timing before we start doing that, though.
    
    This overlaps api_client_authorizations_test, so I deleted that.

diff --git a/apps/workbench/test/integration/api_client_authorizations_test.rb b/apps/workbench/test/integration/api_client_authorizations_test.rb
deleted file mode 100644
index 6312034..0000000
--- a/apps/workbench/test/integration/api_client_authorizations_test.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-require 'integration_helper'
-
-class ApiClientAuthorizationsTest < ActionDispatch::IntegrationTest
-  test "try loading Manage API tokens page" do
-    Capybara.current_driver = Capybara.javascript_driver
-    visit page_with_token('admin_trustedclient')
-    click_link 'user-menu'
-    click_link 'Manage API tokens'
-    assert_equal 200, status_code
-  end
-end
diff --git a/apps/workbench/test/integration/smoke_test.rb b/apps/workbench/test/integration/smoke_test.rb
new file mode 100644
index 0000000..700c8e6
--- /dev/null
+++ b/apps/workbench/test/integration/smoke_test.rb
@@ -0,0 +1,39 @@
+require 'integration_helper'
+require 'uri'
+
+class SmokeTest < ActionDispatch::IntegrationTest
+  def assert_visit_success(allowed=[200])
+    assert_includes(allowed, status_code,
+                    "#{current_url} returned #{status_code}, not one of " +
+                    allowed.inspect)
+  end
+
+  def all_links_in(find_spec, text_regexp=//)
+    find(find_spec).all('a').collect { |tag|
+      if tag[:href].nil? or tag[:href].empty? or (tag.text !~ text_regexp)
+        nil
+      else
+        url = URI(tag[:href])
+        url.host.nil? ? url.path : nil
+      end
+    }.compact
+  end
+
+  test "all first-level links succeed" do
+    visit page_with_token('active_trustedclient', '/')
+    assert_visit_success
+    click_link 'user-menu'
+    urls = [all_links_in('.arvados-nav'),
+            all_links_in('.navbar', /^Manage /)].flatten
+    seen_urls = ['/']
+    while not (url = urls.shift).nil?
+      next if seen_urls.include? url
+      visit url
+      seen_urls << url
+      assert_visit_success
+      # Uncommenting the line below lets you crawl the entire site for a
+      # more thorough test.
+      # urls += all_links_in('body')
+    end
+  end
+end

commit 178545086f0752789ca79d212e92f8c45030ead9
Author: Brett Smith <brett at curoverse.com>
Date:   Fri Mar 21 16:22:55 2014 -0400

    workbench: Add ids to other navbar dropdowns.
    
    This makes them easier to click in integration tests.

diff --git a/apps/workbench/app/views/layouts/application.html.erb b/apps/workbench/app/views/layouts/application.html.erb
index b5c75fc..63cf67c 100644
--- a/apps/workbench/app/views/layouts/application.html.erb
+++ b/apps/workbench/app/views/layouts/application.html.erb
@@ -116,7 +116,7 @@
         -->
 
         <li class="dropdown notification-menu">
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="collections-menu">
             <span class="glyphicon glyphicon-paperclip"></span>
             <span class="badge" id="persistent-selection-count"></span>
             <span class="caret"></span>
@@ -130,7 +130,7 @@
 
         <% if current_user.is_active %>
         <li class="dropdown notification-menu">
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="notifications-menu">
             <span class="glyphicon glyphicon-envelope"></span>
             <span class="badge badge-alert notification-count"><%= @notification_count %></span>
             <span class="caret"></span>

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list