apps/workbench/test/integration/application_layout_test.rb
# These tests don't do state-changing API calls. Save some time by
# skipping the database reset.
These tests don't do state-changing API calls. Save some time by
skipping the database reset.
These tests don ' t do state - changing API calls . Save some time by skipping the database reset .
def verify_homepage user, invited, has_profile
    profile_config = Rails.configuration.Workbench.UserProfileFormFields
    if !user
      assert page.has_text?('Please log in'), 'Not found text - Please log in'
      assert page.has_text?('If you have never used Arvados Workbench before'), 'Not found text - If you have never'
      assert page.has_no_text?('My projects'), 'Found text - My projects'
      assert page.has_link?("Log in"), 'Not found text - Log in'
    elsif user['is_active']
      if profile_config && !has_profile
        assert page.has_text?('Save profile'), 'No text - Save profile'
      else
        assert page.has_link?("Projects"), 'Not found link - Projects'
        page.find("#projects-menu").click
        assert_selector 'a', text: 'Search all projects'
        assert_no_selector 'a', text: 'Browse public projects'
        assert_selector 'a', text: 'Add a new project'
        assert_selector 'li[class="dropdown-header"]', text: 'My projects'
      end
    elsif invited
      assert page.has_text?('Please check the box below to indicate that you have read and accepted the user agreement'), 'Not found text - Please check the box below . . .'
    else
      assert page.has_text?('Your account is inactive'), 'Not found text - Your account is inactive'
    end
    within('.navbar-fixed-top') do
      if !user
        assert_text Rails.configuration.Workbench.SiteName.downcase
        assert_no_selector 'a', text: Rails.configuration.Workbench.SiteName.downcase
        assert page.has_link?('Log in'), 'Not found link - Log in'
      else
        assert_selector 'a', text: Rails.configuration.Workbench.SiteName.downcase
        assert(page.has_link?("notifications-menu"), 'no user menu')
        page.find("#notifications-menu").click
        within('.dropdown-menu') do
          if user['is_active']
            assert page.has_no_link?('Not active'), 'Found link - Not active'
            assert page.has_no_link?('Sign agreements'), 'Found link - Sign agreements'
            assert_selector "a[href=\"/projects/#{user['uuid']}\"]", text: 'Home project'
            assert_selector "a[href=\"/users/#{user['uuid']}/virtual_machines\"]", text: 'Virtual machines'
            assert_selector "a[href=\"/repositories\"]", text: 'Repositories'
            assert_selector "a[href=\"/current_token\"]", text: 'Current token'
            assert_selector "a[href=\"/users/#{user['uuid']}/ssh_keys\"]", text: 'SSH keys'
            if profile_config
              assert_selector "a[href=\"/users/#{user['uuid']}/profile\"]", text: 'Manage profile'
            else
              assert_no_selector "a[href=\"/users/#{user['uuid']}/profile\"]", text: 'Manage profile'
            end
          else
            assert_no_selector 'a', text: 'Home project'
            assert page.has_no_link?('Virtual machines'), 'Found link - Virtual machines'
            assert page.has_no_link?('Repositories'), 'Found link - Repositories'
            assert page.has_no_link?('Current token'), 'Found link - Current token'
            assert page.has_no_link?('SSH keys'), 'Found link - SSH keys'
            assert page.has_no_link?('Manage profile'), 'Found link - Manage profile'
          end
          assert page.has_link?('Log out'), 'No link - Log out'
        end
      end
    end
  end
def verify_homepage user , invited , has_profile profile_config = Rails . configuration . Workbench . UserProfileFormFields if ! user assert page . has_text? ( 'Please log in' ) , 'Not found text - Please log in' assert page . has_text? ( 'If you have never used Arvados Workbench before' ) , 'Not found text - If you have never' assert page . has_no_text? ( 'My projects' ) , 'Found text - My projects' assert page . has_link? ( "Log in" ) , 'Not found text - Log in' elsif user [ 'is_active' ] if profile_config && ! has_profile assert page . has_text? ( 'Save profile' ) , 'No text - Save profile' else assert page . has_link? ( "Projects" ) , 'Not found link - Projects' page . find ( "#projects-menu" ) . click assert_selector 'a' , text : 'Search all projects' assert_no_selector 'a' , text : 'Browse public projects' assert_selector 'a' , text : 'Add a new project' assert_selector 'li[class="dropdown-header"]' , text : 'My projects' end elsif invited assert page . has_text? ( 'Please check the box below to indicate that you have read and accepted the user agreement' ) , 'Not found text - Please check the box below . . .' else assert page . has_text? ( 'Your account is inactive' ) , 'Not found text - Your account is inactive' end within ( '.navbar-fixed-top' ) do if ! user assert_text Rails . configuration . Workbench . SiteName . downcase assert_no_selector 'a' , text : Rails . configuration . Workbench . SiteName . downcase assert page . has_link? ( 'Log in' ) , 'Not found link - Log in' else assert_selector 'a' , text : Rails . configuration . Workbench . SiteName . downcase assert ( page . has_link? ( "notifications-menu" ) , 'no user menu' ) page . find ( "#notifications-menu" ) . click within ( '.dropdown-menu' ) do if user [ 'is_active' ] assert page . has_no_link? ( 'Not active' ) , 'Found link - Not active' assert page . has_no_link? ( 'Sign agreements' ) , 'Found link - Sign agreements' assert_selector "a[href=\"/projects/#{user['uuid']}\"]" , text : 'Home project' assert_selector "a[href=\"/users/#{user['uuid']}/virtual_machines\"]" , text : 'Virtual machines' assert_selector "a[href=\"/repositories\"]" , text : 'Repositories' assert_selector "a[href=\"/current_token\"]" , text : 'Current token' assert_selector "a[href=\"/users/#{user['uuid']}/ssh_keys\"]" , text : 'SSH keys' if profile_config assert_selector "a[href=\"/users/#{user['uuid']}/profile\"]" , text : 'Manage profile' else assert_no_selector "a[href=\"/users/#{user['uuid']}/profile\"]" , text : 'Manage profile' end else assert_no_selector 'a' , text : 'Home project' assert page . has_no_link? ( 'Virtual machines' ) , 'Found link - Virtual machines' assert page . has_no_link? ( 'Repositories' ) , 'Found link - Repositories' assert page . has_no_link? ( 'Current token' ) , 'Found link - Current token' assert page . has_no_link? ( 'SSH keys' ) , 'Found link - SSH keys' assert page . has_no_link? ( 'Manage profile' ) , 'Found link - Manage profile' end assert page . has_link? ( 'Log out' ) , 'No link - Log out' end end end end
These tests don't do state-changing API calls.
These tests don ' t do state - changing API calls .
# my account menu
user
invited
has_profile