Merge branch 'master' into 3112-report-bug. Also, break search testing into a separat...
authorradhika <radhika@curoverse.com>
Wed, 20 Aug 2014 14:31:50 +0000 (10:31 -0400)
committerradhika <radhika@curoverse.com>
Wed, 20 Aug 2014 14:31:50 +0000 (10:31 -0400)
Conflicts:
apps/workbench/app/controllers/application_controller.rb
apps/workbench/config/application.default.yml
apps/workbench/test/integration/application_layout_test.rb

1  2 
apps/workbench/app/controllers/actions_controller.rb
apps/workbench/app/controllers/application_controller.rb
apps/workbench/config/application.default.yml
apps/workbench/config/routes.rb
apps/workbench/test/integration/application_layout_test.rb
apps/workbench/test/integration/report_issue_test.rb
apps/workbench/test/integration/search_box_test.rb

index a913d8a2c9a5fce92c94aac9953c5b651df5f49b,5c99c15abc62544f79c4bca6f148da051f8e59a8..20dea38dcdd8497a982881693c88951a3dd06620
@@@ -11,10 -11,10 +11,10 @@@ class ApplicationController < ActionCon
    around_filter :set_thread_api_token
    # Methods that don't require login should
    #   skip_around_filter :require_thread_api_token
 -  around_filter :require_thread_api_token, except: ERROR_ACTIONS
 +  around_filter :require_thread_api_token, except: [:report_issue_popup, :report_issue] + ERROR_ACTIONS
    before_filter :accept_uuid_as_id_param, except: ERROR_ACTIONS
 -  before_filter :check_user_agreements, except: ERROR_ACTIONS
 +  before_filter :check_user_agreements, except: [:report_issue_popup, :report_issue] + ERROR_ACTIONS
-   before_filter :check_user_profile, except: [:update_profile] + ERROR_ACTIONS
+   before_filter :check_user_profile, except: ERROR_ACTIONS
    before_filter :check_user_notifications, except: ERROR_ACTIONS
    before_filter :load_filters_and_paging_params, except: ERROR_ACTIONS
    before_filter :find_object_by_uuid, except: [:index, :choose] + ERROR_ACTIONS
index 13829b6e18a3289c9ac6a283051508e3ef3a27ae,9443520b1443ade6b8bbad19bed8363016f33097..042f869168cf6fdaf6eb16c5294b0ca5c09673c6
@@@ -129,15 -128,6 +129,15 @@@ common
    #      - IT
    #      - Other
  
-   # Use "user_profile_form_message" to configure the message you want to display in
-   # the profile page. If this is not provided, a default message will be displayed.
-   user_profile_form_message: Welcome to Arvados. Please fill in all required fields before you can access Arvados Workbench. Missing required fields are in <span style="color:red">red</span>.
+   # Use "user_profile_form_message" to configure the message you want to display on
+   # the profile page.
+   user_profile_form_message: Welcome to Arvados. All <span style="color:red">required fields</span> must be completed before you can proceed.
 +
 +  # source_version
 +  source_version: <%= `git log -n 1 --format=%h` %>
 +  local_modified: false
 +
 +  # report nitification to and from addresses
 +  report_notifier_email_from: arvados@example.com
 +  report_notifier_email_to: arvados@example.com
 +  support_email_address: arvados@example.com
Simple merge
index 78ed2365e2fa2e3878314437c4d47cdb2fd677e3,19bb4c1c8470de3e3e12a7b9d57fdb7d1ec289f5..fa6793d25280bc26ce0c44624c882374ef7e6c70
@@@ -68,65 -68,11 +68,14 @@@ class ApplicationLayoutTest < ActionDis
      within('.navbar-fixed-top') do
        page.find("#arv-help").click
        within('.dropdown-menu') do
 -        assert page.has_link? 'Tutorials and User guide'
 -        assert page.has_link? 'API Reference'
 -        assert page.has_link? 'SDK Reference'
 +        assert page.has_link?('Tutorials and User guide'), 'No link - Tutorials and User guide'
 +        assert page.has_link?('API Reference'), 'No link - API Reference'
 +        assert page.has_link?('SDK Reference'), 'No link - SDK Reference'
 +        assert page.has_link?('Show version / debugging info'), 'No link - Show version / debugging info'
 +        assert page.has_link?('Report a problem'), 'No 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'), 'No text - Version / debugging info'
-       assert page.has_no_text?('Report a problem'), 'Found text - Report a problem'
-       assert page.has_text?('Server version'), 'No text - Server version'
-       assert page.has_text?('Server restarted at'), 'No text - Server restarted at'
-       assert page.has_text?('Workbench version'), 'No text - Workbench version'
-       assert page.has_text?('Arvados base'), 'No text - Arvados base'
-       assert page.has_text?('Additional info'), 'No text - Additional info'
-       assert page.has_no_text?('Found a problem?'), 'Found text - Found a problem'
-       assert page.has_button?('Close'), 'No button - Close'
-       assert page.has_no_button?('Report issue'), 'Found 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'
++        # Version info and Report a problem are tested in "report_issue_test.rb"
        end
      end
-     within '.modal-content' do
-       assert page.has_text?('Report a problem'), 'No text - Report a problem'
-       assert page.has_no_text?('Version / debugging info'), 'Found text - Version / debugging info'
-       assert page.has_text?('Server version'), 'No text - Server version'
-       assert page.has_text?('Server restarted at'), 'No text - Server restarted at'
-       assert page.has_text?('Workbench version'), 'No text - Workbench version'
-       assert page.has_text?('Arvados base'), 'No text - Arvados base'
-       assert page.has_text?('Additional info'), 'No text - Additional info'
-       assert page.has_text?('Found a problem?'), 'No text - Found a problem'
-       assert page.has_no_button?('Close'), 'Found button - Close'
-       assert page.has_button?('Report issue'), 'No button - Report issue'
-       assert page.has_button?('Cancel'), 'No button - Cancel'
-       # enter a report text and click on report
-       page.find_field('report_issue_text').set 'my test report text'
-       click_button 'Report issue'
-       # ajax success updated button texts and added footer message
-       assert page.has_no_button?('Report issue'), 'Found button - Report issue'
-       assert page.has_no_button?('Cancel'), 'Found button - Cancel'
-       assert page.has_text?('Report sent'), 'No text - Report sent'
-       assert page.has_button?('Close'), 'No text - Close'
-       assert page.has_text?('Thanks for reporting this issue'), 'No text - Thanks for reporting this issue'
-       click_button 'Close'
-     end
    end
  
    def verify_system_menu user
        end
      end
  
-     assert page.has_text?(profile_message[0,25]), 'No text - configured profile message'
+     assert page.has_text? profile_message.gsub(/<.*?>/,'')
 -    assert page.has_text? required_field_title
 +    assert page.has_text?(required_field_title), 'No text - configured required field title'
++
      page.find_field('user[prefs][:profile][:'+required_field_key+']').set 'value to fill required field'
  
      click_button "Save profile"
      # profile saved and in profile page now with success
 -    assert page.has_text? 'Thank you for filling in your profile'
 -    click_link 'Back to work'
 +    assert page.has_text?('Thank you for filling in your profile'), 'No text - Thank you for filling'
-     click_button 'Access Arvados Workbench'
++    click_link 'Back to work!'
  
      # profile saved and in home page now
 -    assert page.has_text? 'My projects'
 -    assert page.has_text? 'Projects shared with me'
 -  end
 -
 -  # test the search box
 -  def verify_search_box user
 -    if user && user['is_active']
 -      # let's search for a valid uuid
 -      within('.navbar-fixed-top') do
 -        page.find_field('search').set user['uuid']
 -        page.find('.glyphicon-search').click
 -      end
 -
 -      # we should now be in the user's home project as a result of search
 -      assert_selector "#Data_collections[data-object-uuid='#{user['uuid']}']"
 -
 -      # let's search again for an invalid valid uuid
 -      within('.navbar-fixed-top') do
 -        search_for = String.new user['uuid']
 -        search_for[0]='1'
 -        page.find_field('search').set search_for
 -        page.find('.glyphicon-search').click
 -      end
 -
 -      # we should see 'not found' error page
 -      assert page.has_text? 'Not Found'
 -
 -      # let's search for the anonymously accessible project
 -      publicly_accessible_project = api_fixture('groups')['anonymously_accessible_project']
 -
 -      within('.navbar-fixed-top') do
 -        # search again for the anonymously accessible project
 -        page.find_field('search').set publicly_accessible_project['name'][0,10]
 -        page.find('.glyphicon-search').click
 -      end
 -
 -      within '.modal-content' do
 -        assert page.has_text? 'All projects'
 -        assert page.has_text? 'Search'
 -        assert page.has_text? 'Cancel'
 -        assert_selector('div', text: publicly_accessible_project['name'])
 -        find(:xpath, '//div[./span[contains(.,publicly_accessible_project["uuid"])]]').click
 -
 -        click_button 'Show'
 -      end
 -
 -      # seeing "Unrestricted public data" now
 -      assert page.has_text? publicly_accessible_project['name']
 -      assert page.has_text? publicly_accessible_project['description']
 -    end
 +    assert page.has_text?('My projects'), 'No text - My projects'
 +    assert page.has_text?('Projects shared with me'), 'No text - Projects shared with me'
    end
  
-   # test the search box
-   def verify_search_box user
-     if user && user['is_active']
-       # let's search for a valid uuid
-       within('.navbar-fixed-top') do
-         page.find_field('search').set user['uuid']
-         page.find('.glyphicon-search').click
-       end
-       # we should now be in the user's page as a result of search
-       assert page.has_text?(user['first_name']), 'No text - user first name'
-       # let's search again for an invalid valid uuid
-       within('.navbar-fixed-top') do
-         search_for = String.new user['uuid']
-         search_for[0]='1'
-         page.find_field('search').set search_for
-         page.find('.glyphicon-search').click
-       end
-       # we should see 'not found' error page
-       assert page.has_text?('Not Found'), 'No text - Not Found'
-       assert page.has_link?('Report problem'), 'No text - Report problem'
-       click_link 'Report problem'
-       within '.modal-content' do
-         assert page.has_text?('Report a problem'), 'No text - Report a problem'
-         assert page.has_no_text?('Version / debugging info'), 'No text - Version / debugging info'
-         assert page.has_text?('Server version'), 'No text - Server version'
-         assert page.has_text?('Server restarted at'), 'No text - Server restarted at'
-         assert page.has_text?('Found a problem?'), 'No text - Found a problem'
-         assert page.has_button?('Report issue'), 'No button - Report issue'
-         assert page.has_button?('Cancel'), 'No button - Cancel'
-         # enter a report text and click on report
-         page.find_field('report_issue_text').set 'my test report text'
-         click_button 'Report issue'
-         # ajax success updated button texts and added footer message
-         assert page.has_no_button?('Report issue'), 'Found button - Report issue'
-         assert page.has_no_button?('Cancel'), 'Found button - Cancel'
-         assert page.has_text?('Report sent'), 'No text - Report sent'
-         assert page.has_button?('Close'), 'No text - Close'
-         assert page.has_text?('Thanks for reporting this issue'), 'No text - Thanks for reporting this issue'
-         click_button 'Close'
-       end
-       # let's search for the anonymously accessible project
-       publicly_accessible_project = api_fixture('groups')['anonymously_accessible_project']
-       within('.navbar-fixed-top') do
-         # search again for the anonymously accessible project
-         page.find_field('search').set publicly_accessible_project['name'][0,10]
-         page.find('.glyphicon-search').click
-       end
-       within '.modal-content' do
-         assert page.has_text?('All projects'), 'No text - All projects'
-         assert page.has_text?('Search'), 'No text - Search'
-         assert page.has_text?('Cancel'), 'No text - Cancel'
-         assert_selector('div', text: publicly_accessible_project['name'])
-         find(:xpath, '//div[./span[contains(.,publicly_accessible_project["uuid"])]]').click
-         click_button 'Show'
-       end
-       # seeing "Unrestricted public data" now
-       assert page.has_text?(publicly_accessible_project['name']), 'No text - publicly accessible project name'
-       assert page.has_text?(publicly_accessible_project['description']), 'No text - publicly accessible project description'
-     end
-   end
    [
      [nil, nil, false, false],
      ['inactive', api_fixture('users')['inactive'], true, false],
    end
  
    [
--    ['active', api_fixture('users')['active'], true, true],
--    ['admin', api_fixture('users')['admin'], true, true],
++    ['active', api_fixture('users')['active']],
++    ['admin', api_fixture('users')['admin']],
    ].each do |token, user|
 +
      test "test system menu for user #{token}" do
        visit page_with_token(token)
        verify_system_menu user
        visit page_with_token(token)
        verify_manage_account user
      end
--
--    test "test search for user #{token}" do
--      visit page_with_token(token)
--      verify_search_box user
--    end
    end
  end
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..ce534ff801a13c6745bf872d40ea9b808c2028c1
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,106 @@@
++require 'integration_helper'
++require 'selenium-webdriver'
++require 'headless'
++
++class ApplicationLayoutTest < ActionDispatch::IntegrationTest
++  setup do
++    headless = Headless.new
++    headless.start
++    Capybara.current_driver = :selenium
++
++    @user_profile_form_fields = Rails.configuration.user_profile_form_fields
++  end
++
++  teardown do
++    Rails.configuration.user_profile_form_fields = @user_profile_form_fields
++  end
++
++  # test version info and report issue from help menu
++  def check_version_info_and_report_issue_from_help_menu
++    within('.navbar-fixed-top') do
++      page.find("#arv-help").click
++      within('.dropdown-menu') do
++        assert page.has_link?('Tutorials and User guide'), 'No link - Tutorials and User guide'
++        assert page.has_link?('API Reference'), 'No link - API Reference'
++        assert page.has_link?('SDK Reference'), 'No link - SDK Reference'
++        assert page.has_link?('Show version / debugging info'), 'No link - Show version / debugging info'
++        assert page.has_link?('Report a problem'), 'No 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'), 'No text - Version / debugging info'
++      assert page.has_no_text?('Report a problem'), 'Found text - Report a problem'
++      assert page.has_text?('Server version'), 'No text - Server version'
++      assert page.has_text?('Server restarted at'), 'No text - Server restarted at'
++      assert page.has_text?('Workbench version'), 'No text - Workbench version'
++      assert page.has_text?('Arvados base'), 'No text - Arvados base'
++      assert page.has_text?('Additional info'), 'No text - Additional info'
++      assert page.has_no_text?('Found a problem?'), 'Found text - Found a problem'
++      assert page.has_button?('Close'), 'No button - Close'
++      assert page.has_no_button?('Report issue'), 'Found 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'), 'No text - Report a problem'
++      assert page.has_no_text?('Version / debugging info'), 'Found text - Version / debugging info'
++      assert page.has_text?('Server version'), 'No text - Server version'
++      assert page.has_text?('Server restarted at'), 'No text - Server restarted at'
++      assert page.has_text?('Workbench version'), 'No text - Workbench version'
++      assert page.has_text?('Arvados base'), 'No text - Arvados base'
++      assert page.has_text?('Additional info'), 'No text - Additional info'
++      assert page.has_text?('Found a problem?'), 'No text - Found a problem'
++      assert page.has_no_button?('Close'), 'Found button - Close'
++      assert page.has_button?('Report issue'), 'No button - Report issue'
++      assert page.has_button?('Cancel'), 'No button - Cancel'
++
++      # enter a report text and click on report
++      page.find_field('report_issue_text').set 'my test report text'
++      click_button 'Report issue'
++
++      # ajax success updated button texts and added footer message
++      assert page.has_no_button?('Report issue'), 'Found button - Report issue'
++      assert page.has_no_button?('Cancel'), 'Found button - Cancel'
++      assert page.has_text?('Report sent'), 'No text - Report sent'
++      assert page.has_button?('Close'), 'No text - Close'
++      assert page.has_text?('Thanks for reporting this issue'), 'No text - Thanks for reporting this issue'
++
++      click_button 'Close'
++    end
++  end
++
++  [
++    [nil, nil],
++    ['inactive', api_fixture('users')['inactive']],
++    ['inactive_uninvited', api_fixture('users')['inactive_uninvited']],
++    ['active', api_fixture('users')['active']],
++    ['admin', api_fixture('users')['admin']],
++    ['active_no_prefs', api_fixture('users')['active_no_prefs']],
++    ['active_no_prefs_profile', api_fixture('users')['active_no_prefs_profile']],
++  ].each do |token, user|
++
++    test "check help for user #{token}" do
++      if !token
++        visit ('/')
++      else
++        visit page_with_token(token)
++      end
++
++      check_version_info_and_report_issue_from_help_menu
++    end
++
++  end
++
++end
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..be9931dfde193d43e87c6b77c0e5a58cae1079db
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,97 @@@
++require 'integration_helper'
++require 'selenium-webdriver'
++require 'headless'
++
++class ApplicationLayoutTest < ActionDispatch::IntegrationTest
++  setup do
++    headless = Headless.new
++    headless.start
++    Capybara.current_driver = :selenium
++  end
++
++  # test the search box
++  def verify_search_box user
++    if user && user['is_active']
++      # let's search for a valid uuid
++      within('.navbar-fixed-top') do
++        page.find_field('search').set user['uuid']
++        page.find('.glyphicon-search').click
++      end
++
++      # we should now be in the user's home project as a result of search
++      assert_selector "#Data_collections[data-object-uuid='#{user['uuid']}']", "Expected to be in user page after search click"
++
++      # let's search again for an invalid valid uuid
++      within('.navbar-fixed-top') do
++        search_for = String.new user['uuid']
++        search_for[0]='1'
++        page.find_field('search').set search_for
++        page.find('.glyphicon-search').click
++      end
++
++      # we should see 'not found' error page
++      assert page.has_text?('Not Found'), 'No text - Not Found'
++      assert page.has_link?('Report problem'), 'No text - Report problem'
++      click_link 'Report problem'
++      within '.modal-content' do
++        assert page.has_text?('Report a problem'), 'No text - Report a problem'
++        assert page.has_no_text?('Version / debugging info'), 'No text - Version / debugging info'
++        assert page.has_text?('Server version'), 'No text - Server version'
++        assert page.has_text?('Server restarted at'), 'No text - Server restarted at'
++        assert page.has_text?('Found a problem?'), 'No text - Found a problem'
++        assert page.has_button?('Report issue'), 'No button - Report issue'
++        assert page.has_button?('Cancel'), 'No button - Cancel'
++
++        # enter a report text and click on report
++        page.find_field('report_issue_text').set 'my test report text'
++        click_button 'Report issue'
++
++        # ajax success updated button texts and added footer message
++        assert page.has_no_button?('Report issue'), 'Found button - Report issue'
++        assert page.has_no_button?('Cancel'), 'Found button - Cancel'
++        assert page.has_text?('Report sent'), 'No text - Report sent'
++        assert page.has_button?('Close'), 'No text - Close'
++        assert page.has_text?('Thanks for reporting this issue'), 'No text - Thanks for reporting this issue'
++
++        click_button 'Close'
++      end
++
++      # let's search for the anonymously accessible project
++      publicly_accessible_project = api_fixture('groups')['anonymously_accessible_project']
++
++      within('.navbar-fixed-top') do
++        # search again for the anonymously accessible project
++        page.find_field('search').set publicly_accessible_project['name'][0,10]
++        page.find('.glyphicon-search').click
++      end
++
++      within '.modal-content' do
++        assert page.has_text?('All projects'), 'No text - All projects'
++        assert page.has_text?('Search'), 'No text - Search'
++        assert page.has_text?('Cancel'), 'No text - Cancel'
++        assert_selector('div', text: publicly_accessible_project['name'])
++        find(:xpath, '//div[./span[contains(.,publicly_accessible_project["uuid"])]]').click
++
++        click_button 'Show'
++      end
++
++      # seeing "Unrestricted public data" now
++      assert page.has_text?(publicly_accessible_project['name']), 'No text - publicly accessible project name'
++      assert page.has_text?(publicly_accessible_project['description']), 'No text - publicly accessible project description'
++    end
++  end
++
++  [
++    ['active', api_fixture('users')['active']],
++    ['admin', api_fixture('users')['admin']],
++  ].each do |token, user|
++
++    test "test search for user #{token}" do
++      visit page_with_token(token)
++
++      verify_search_box user
++    end
++
++  end
++
++end