<commit_before># frozen_string_literal: true

module QA
  module Page
    module Project
      class Menu < Page::Base
        view 'app/views/layouts/nav/sidebar/_project.html.haml' do
          element :settings_item
          element :settings_link, 'link_to edit_project_path' # rubocop:disable QA/ElementWithPattern
          element :repository_link, "title: _('Repository')" # rubocop:disable QA/ElementWithPattern
          element :link_pipelines
          element :link_members_settings
          element :pipelines_settings_link, "title: _('CI / CD')" # rubocop:disable QA/ElementWithPattern
          element :operations_kubernetes_link, "title: _('Kubernetes')" # rubocop:disable QA/ElementWithPattern
          element :operations_environments_link
          element :issues_link, /link_to.*shortcuts-issues/ # rubocop:disable QA/ElementWithPattern
          element :issues_link_text, "Issues" # rubocop:disable QA/ElementWithPattern
          element :merge_requests_link, /link_to.*shortcuts-merge_requests/ # rubocop:disable QA/ElementWithPattern
          element :merge_requests_link_text, "Merge Requests" # rubocop:disable QA/ElementWithPattern
          element :top_level_items, '.sidebar-top-level-items' # rubocop:disable QA/ElementWithPattern
          element :operations_section, "class: 'shortcuts-operations'" # rubocop:disable QA/ElementWithPattern
          element :activity_link, "title: _('Activity')" # rubocop:disable QA/ElementWithPattern
          element :wiki_link_text, "Wiki" # rubocop:disable QA/ElementWithPattern
          element :milestones_link
          element :labels_link
        end

        view 'app/assets/javascripts/fly_out_nav.js' do
          element :fly_out, "classList.add('fly-out-list')" # rubocop:disable QA/ElementWithPattern
        end

        def click_ci_cd_pipelines
          within_sidebar do
            click_element :link_pipelines
          end
        end

        def click_ci_cd_settings
          hover_settings do
            within_submenu do
              click_link('CI / CD')
            end
          end
        end

        def click_issues
          within_sidebar do
            click_link('Issues')
          end
        end

        def click_members_settings
          hover_settings do
            within_submenu do
              click_element :link_members_settings
            end
          end
        end

        def click_merge_requests
          within_sidebar do
            click_link('Merge Requests')
          end
        end

        def click_operations_environments
          hover_operations do
            within_submenu do
              click_element(:operations_environments_link)
            end
          end
        end

        def click_operations_kubernetes
          hover_operations do
            within_submenu do
              click_link('Kubernetes')
            end
          end
        end

        def click_milestones
          within_sidebar do
            click_element :milestones_link
          end
        end

        def click_repository
          within_sidebar do
            click_link('Repository')
          end
        end

        def click_repository_settings
          hover_settings do
            within_submenu do
              click_link('Repository')
            end
          end
        end

        def click_wiki
          within_sidebar do
            click_link('Wiki')
          end
        end

        def go_to_activity
          within_sidebar do
            click_on 'Activity'
          end
        end

        def go_to_labels
          hover_issues do
            within_submenu do
              click_element(:labels_link)
            end
          end
        end

        def go_to_settings
          within_sidebar do
            click_on 'Settings'
          end
        end

        private

        def hover_issues
          within_sidebar do
            find_element(:issues_item).hover

            yield
          end
        end

        def hover_operations
          within_sidebar do
            find('.shortcuts-operations').hover

            yield
          end
        end

        def hover_settings
          within_sidebar do
            find('.qa-settings-item').hover

            yield
          end
        end

        def within_sidebar
          page.within('.sidebar-top-level-items') do
            yield
          end
        end

        def within_submenu
          page.within('.fly-out-list') do
            yield
          end
        end
      end
    end<commit_msg>Try scroll to project menu elements before hovering<commit_after># frozen_string_literal: true

module QA
  module Page
    module Project
      class Menu < Page::Base
        view 'app/views/layouts/nav/sidebar/_project.html.haml' do
          element :settings_item
          element :settings_link, 'link_to edit_project_path' # rubocop:disable QA/ElementWithPattern
          element :repository_link, "title: _('Repository')" # rubocop:disable QA/ElementWithPattern
          element :link_pipelines
          element :link_members_settings
          element :pipelines_settings_link, "title: _('CI / CD')" # rubocop:disable QA/ElementWithPattern
          element :operations_kubernetes_link, "title: _('Kubernetes')" # rubocop:disable QA/ElementWithPattern
          element :operations_environments_link
          element :issues_link, /link_to.*shortcuts-issues/ # rubocop:disable QA/ElementWithPattern
          element :issues_link_text, "Issues" # rubocop:disable QA/ElementWithPattern
          element :merge_requests_link, /link_to.*shortcuts-merge_requests/ # rubocop:disable QA/ElementWithPattern
          element :merge_requests_link_text, "Merge Requests" # rubocop:disable QA/ElementWithPattern
          element :top_level_items, '.sidebar-top-level-items' # rubocop:disable QA/ElementWithPattern
          element :operations_section, "class: 'shortcuts-operations'" # rubocop:disable QA/ElementWithPattern
          element :activity_link, "title: _('Activity')" # rubocop:disable QA/ElementWithPattern
          element :wiki_link_text, "Wiki" # rubocop:disable QA/ElementWithPattern
          element :milestones_link
          element :labels_link
        end

        view 'app/assets/javascripts/fly_out_nav.js' do
          element :fly_out, "classList.add('fly-out-list')" # rubocop:disable QA/ElementWithPattern
        end

        def click_ci_cd_pipelines
          within_sidebar do
            click_element :link_pipelines
          end
        end

        def click_ci_cd_settings
          hover_settings do
            within_submenu do
              click_link('CI / CD')
            end
          end
        end

        def click_issues
          within_sidebar do
            click_link('Issues')
          end
        end

        def click_members_settings
          hover_settings do
            within_submenu do
              click_element :link_members_settings
            end
          end
        end

        def click_merge_requests
          within_sidebar do
            click_link('Merge Requests')
          end
        end

        def click_operations_environments
          hover_operations do
            within_submenu do
              click_element(:operations_environments_link)
            end
          end
        end

        def click_operations_kubernetes
          hover_operations do
            within_submenu do
              click_link('Kubernetes')
            end
          end
        end

        def click_milestones
          within_sidebar do
            click_element :milestones_link
          end
        end

        def click_repository
          within_sidebar do
            click_link('Repository')
          end
        end

        def click_repository_settings
          hover_settings do
            within_submenu do
              click_link('Repository')
            end
          end
        end

        def click_wiki
          within_sidebar do
            click_link('Wiki')
          end
        end

        def go_to_activity
          within_sidebar do
            click_on 'Activity'
          end
        end

        def go_to_labels
          hover_issues do
            within_submenu do
              click_element(:labels_link)
            end
          end
        end

        def go_to_settings
          within_sidebar do
            click_on 'Settings'
          end
        end

        private

        def hover_issues
          within_sidebar do
            scroll_to_element(:issues_item)
            find_element(:issues_item).hover

            yield
          end
        end

        def hover_operations
          within_sidebar do
            scroll_to('.shortcuts-operations')
            find('.shortcuts-operations').hover

            yield
          end
        end

        def hover_settings
          within_sidebar do
            scroll_to('.qa-settings-item')
            find('.qa-settings-item').hover

            yield
          end
        end

        def within_sidebar
          page.within('.sidebar-top-level-items') do
            yield
          end
        end

        def within_submenu
          page.within('.fly-out-list') do
            yield
          end
        end
      end
    end
{'fraction_non_alphanumeric': 0.05318464507827579, 'fraction_numerical': 0.0, 'mean_word_length': 1.6648571428571428, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7628959', 'n_tokens_mistral': 2437, 'n_tokens_neox': 2358, 'n_words': 547}