1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 require 'integration_helper'
8 class SmokeTest < ActionDispatch::IntegrationTest
13 def assert_visit_success(allowed=[200])
14 assert_includes(allowed, status_code,
15 "#{current_url} returned #{status_code}, not one of " +
19 def all_links_in(find_spec, text_regexp=//)
20 all(find_spec + ' a').collect { |tag|
21 if tag[:href].nil? or tag[:href].empty? or (tag.text !~ text_regexp)
23 elsif tag[:'data-remote']
24 # these don't necessarily work with format=html
28 url.host.nil? ? url.path : nil
33 test "all first-level links succeed" do
34 visit page_with_token('active_trustedclient', '/')
36 click_link 'notifications-menu'
37 urls = [all_links_in('nav'),
38 all_links_in('.navbar', /^Manage /)].flatten
40 while not (url = urls.shift).nil?
41 next if seen_urls.include? url
45 # Uncommenting the line below lets you crawl the entire site for a
47 # urls += all_links_in('body')
51 test "mithril test page" do
52 visit page_with_token('active_trustedclient', '/tests/mithril')
54 assert_selector 'p', text: 'mithril is working'