Merge branch 'master' into 3112-report-bug
[arvados.git] / apps / workbench / test / integration / application_layout_test.rb
index f231e4d3d458298fb639b9cec11de4b4e466e246..5fe86cc401adec5818aad3aefd8f60310c819ea1 100644 (file)
@@ -45,19 +45,19 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
         assert page.has_link? "#{user['email']}"
         find('a', text: "#{user['email']}").click
         within('.dropdown-menu') do
-          if !invited
-            page.has_no_link? ('Not active')
-          else
-            page.has_no_link? ('Sign agreements')
-            page.has_link? ('Manage account')
+          if user['is_active']
+            assert page.has_no_link? ('Not active')
+            assert page.has_no_link? ('Sign agreements')
+
+            assert page.has_link? ('Manage account')
 
             if profile_config
-              page.has_link? ('Manage profile')
+              assert page.has_link? ('Manage profile')
             else
-              page.has_no_link? ('Manage profile')
+              assert page.has_no_link? ('Manage profile')
             end
           end
-          page.has_link? ('Log out')
+          assert page.has_link? ('Log out')
         end
       end
     end
@@ -71,8 +71,55 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
         assert page.has_link? 'Tutorials and User guide'
         assert page.has_link? 'API Reference'
         assert page.has_link? 'SDK Reference'
+        assert page.has_link? 'Show version / debugging info'
+        assert page.has_link? 'Report a problem'
+
+        # check show version info link      
+        click_link 'Show version / debugging info'
+      end
+    end
+
+    within '.modal-content' do
+      assert page.has_text? 'Version / debugging info'
+      assert page.has_no_text? 'Report a problem'
+      assert page.has_text? 'Server version'
+      assert page.has_text? 'Server restarted at'
+      assert page.has_text? 'Workbench version'
+      assert page.has_text? 'Arvados base'
+      assert page.has_text? 'Additional info'
+      assert page.has_no_text? 'Report text'
+      assert page.has_button? 'Close'
+      assert page.has_no_button? 'Report issue'
+      click_button 'Close'
+    end
+
+    # check report issue link      
+    within('.navbar-fixed-top') do
+      page.find("#arv-help").click
+      within('.dropdown-menu') do
+        click_link 'Report a problem'
       end
     end
+
+    within '.modal-content' do
+      assert page.has_text? 'Report a problem'
+      assert page.has_no_text? 'Version / debugging info'
+      assert page.has_text? 'Server version'
+      assert page.has_text? 'Server restarted at'
+      assert page.has_text? 'Workbench version'
+      assert page.has_text? 'Arvados base'
+      assert page.has_text? 'Additional info'
+      assert page.has_text? 'Report text'
+      assert page.has_no_button? 'Close'
+      assert page.has_button? 'Report issue'
+      assert page.has_button? 'Cancel'
+
+      # enter a report text and click on report
+      page.find_field('report_text').set 'my test report text'
+      click_button 'Report issue'
+    end
+
+    assert page.has_no_text? 'Version / debugging info'
   end
 
   def verify_system_menu user
@@ -151,10 +198,10 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
         page.find_field('name').set 'added_in_test'
         click_button 'Submit'
       end
-    end
 
-    # key must be added. look for it in the refreshed page
-    assert page.has_text? 'added_in_test'
+      # key must be added. look for it in the refreshed page
+      assert page.has_text? 'added_in_test'
+    end
   end
 
   # Check manage profile page and add missing profile to the user
@@ -226,6 +273,21 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
 
       # we should see 'not found' error page
       assert page.has_text? 'Not Found'
+      assert page.has_link? 'Report problem'
+      click_link 'Report problem'
+      within '.modal-content' do
+        assert page.has_text? 'Report a problem'
+        assert page.has_no_text? 'Version / debugging info'
+        assert page.has_text? 'Server version'
+        assert page.has_text? 'Server restarted at'
+        assert page.has_text? 'Report text'
+        assert page.has_button? 'Report issue'
+        assert page.has_button? 'Cancel'
+
+        # enter a report text and click on report
+        page.find_field('report_text').set 'my test report text'
+        click_button 'Report issue'
+      end
 
       # let's search for the anonymously accessible project
       publicly_accessible_project = api_fixture('groups')['anonymously_accessible_project']
@@ -261,7 +323,8 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
     ['active_no_prefs', api_fixture('users')['active_no_prefs'], true, false],
     ['active_no_prefs_profile', api_fixture('users')['active_no_prefs_profile'], true, false],
   ].each do |token, user, invited, has_profile|
-      test "visit home page when profile is configured for user #{token}" do
+
+    test "visit home page when profile is configured for user #{token}" do
       # Our test config enabled profile by default. So, no need to update config
       if !token
         visit ('/')
@@ -271,17 +334,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
 
       verify_homepage_with_profile user, invited, has_profile
     end
-  end
 
-  [
-    [nil, nil, false, false],
-    ['inactive', api_fixture('users')['inactive'], true, false],
-    ['inactive_uninvited', api_fixture('users')['inactive_uninvited'], false, false],
-    ['active', api_fixture('users')['active'], true, true],
-    ['admin', api_fixture('users')['admin'], true, true],
-    ['active_no_prefs', api_fixture('users')['active_no_prefs'], true, false],
-    ['active_no_prefs_profile', api_fixture('users')['active_no_prefs_profile'], true, false],
-  ].each do |token, user, invited, has_profile|
     test "visit home page when profile not configured for user #{token}" do
       Rails.configuration.user_profile_form_fields = false
 
@@ -293,20 +346,8 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
 
       verify_homepage_with_profile user, invited, has_profile
     end
-  end
 
-  [
-    [nil, nil, false, false],
-    ['inactive', api_fixture('users')['inactive'], true, false],
-    ['inactive_uninvited', api_fixture('users')['inactive_uninvited'], false, false],
-    ['active', api_fixture('users')['active'], true, true],
-    ['admin', api_fixture('users')['admin'], true, true],
-    ['active_no_prefs', api_fixture('users')['active_no_prefs'], true, false],
-    ['active_no_prefs_profile', api_fixture('users')['active_no_prefs_profile'], true, false],
-  ].each do |token, user, invited, has_profile|
     test "check help for user #{token}" do
-      Rails.configuration.user_profile_form_fields = false
-
       if !token
         visit ('/')
       else
@@ -315,36 +356,29 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
 
       check_help_menu
     end
+
   end
 
   [
     ['active', api_fixture('users')['active'], true, true],
     ['admin', api_fixture('users')['admin'], true, true],
   ].each do |token, user|
+
     test "test system menu for user #{token}" do
       visit page_with_token(token)
       verify_system_menu user
     end
-  end
 
-  [
-    ['active', api_fixture('users')['active'], true, true],
-    ['admin', api_fixture('users')['admin'], true, true],
-  ].each do |token, user|
     test "test manage account for user #{token}" do
       visit page_with_token(token)
       verify_manage_account user
     end
-  end
 
-  [
-    ['active', api_fixture('users')['active'], true, true],
-    ['admin', api_fixture('users')['admin'], true, true],
-  ].each do |token, user|
     test "test search for user #{token}" do
       visit page_with_token(token)
       verify_search_box user
     end
+
   end
 
 end