3112: report issue works for no user and inactive user cases.
[arvados.git] / apps / workbench / test / integration / application_layout_test.rb
index 64eb2b2b18cc50eb7b520b1a9ddb16ee0823ab08..5fe86cc401adec5818aad3aefd8f60310c819ea1 100644 (file)
@@ -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,6 +323,7 @@ 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
       # Our test config enabled profile by default. So, no need to update config
       if !token
@@ -293,12 +356,14 @@ 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
@@ -313,5 +378,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
       visit page_with_token(token)
       verify_search_box user
     end
+
   end
+
 end