Fix 2.4.2 upgrade notes formatting refs #19330
[arvados.git] / apps / workbench / test / integration / smoke_test.rb
index 700c8e62925779298bdfee4ab7376347fce02ca6..18973dbeee72fbff920a0ae9cd516e85555509fb 100644 (file)
@@ -1,7 +1,15 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 require 'integration_helper'
 require 'uri'
 
 class SmokeTest < ActionDispatch::IntegrationTest
+  setup do
+    need_javascript
+  end
+
   def assert_visit_success(allowed=[200])
     assert_includes(allowed, status_code,
                     "#{current_url} returned #{status_code}, not one of " +
@@ -9,9 +17,12 @@ class SmokeTest < ActionDispatch::IntegrationTest
   end
 
   def all_links_in(find_spec, text_regexp=//)
-    find(find_spec).all('a').collect { |tag|
+    all(find_spec + ' a').collect { |tag|
       if tag[:href].nil? or tag[:href].empty? or (tag.text !~ text_regexp)
         nil
+      elsif tag[:'data-remote']
+        # these don't necessarily work with format=html
+        nil
       else
         url = URI(tag[:href])
         url.host.nil? ? url.path : nil
@@ -22,8 +33,8 @@ class SmokeTest < ActionDispatch::IntegrationTest
   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'),
+    click_link 'notifications-menu'
+    urls = [all_links_in('nav'),
             all_links_in('.navbar', /^Manage /)].flatten
     seen_urls = ['/']
     while not (url = urls.shift).nil?
@@ -36,4 +47,10 @@ class SmokeTest < ActionDispatch::IntegrationTest
       # urls += all_links_in('body')
     end
   end
+
+  test "mithril test page" do
+    visit page_with_token('active_trustedclient', '/tests/mithril')
+    assert_visit_success
+    assert_selector 'p', text: 'mithril is working'
+  end
 end