6652-Added tests for the system menu and each of the pages in the
[arvados.git] / apps / workbench / test / integration / system_menu_test.rb
1 require 'integration_helper'
2
3 class SystemMenuTest < ActionDispatch::IntegrationTest
4   # These tests don't do state-changing API calls. Save some time by
5   # skipping the database reset.
6   reset_api_fixtures :after_each_test, false
7   reset_api_fixtures :after_suite, true
8
9   setup do
10     need_javascript
11   end
12
13   [
14     #['Repositories','repository','Attributes'], Fails due to #6652
15     ['Virtual machines','virtual machine','current_user_logins'],
16     ['SSH keys','authorized key','public_key'],
17     ['Links','link','link_class'],
18     ['Groups','group','group_class'],
19     ['Compute nodes','node','info[ping_secret'],
20     ['Keep services','keep service','service_ssl_flag'],
21     ['Keep disks', 'keep disk','bytes_free'],
22   ].each do |page_name, add_button_text, look_for|
23
24     test "test system menu #{page_name} link" do
25       visit page_with_token('admin')
26       within('.navbar-fixed-top') do
27         page.find("#system-menu").click
28         within('.dropdown-menu') do
29           assert_selector 'a', text: page_name
30           find('a', text: page_name).click
31         end
32       end
33
34       # click the add button
35       assert_selector 'button', text: "Add a new #{add_button_text}"
36       find('button', text: "Add a new #{add_button_text}").click
37
38       # look for unique property in the created object page
39       assert page.has_text? look_for
40     end
41   end
42 end