summaryrefslogtreecommitdiff
path: root/qa/qa/page/label/index.rb
blob: de0cfa9f293aeddcde6796d800a99f4549b295ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# frozen_string_literal: true

module QA
  module Page
    module Label
      class Index < Page::Base
        include Component::LazyLoader

        view 'app/views/shared/labels/_nav.html.haml' do
          element :label_create_new
        end

        view 'app/views/shared/empty_states/_labels.html.haml' do
          element :label_svg
        end

        view 'app/views/shared/empty_states/_priority_labels.html.haml' do
          element :label_svg
        end

        def go_to_new_label
          # The 'labels.svg' takes a fraction of a second to load after which the "New label" button shifts up a bit
          # This can cause webdriver to miss the hit so we wait for the svg to load (implicitly with has_element?)
          # before clicking the button.
          within_element(:label_svg) do
            has_element?(:js_lazy_loaded)
          end

          click_element :label_create_new
        end
      end
    end
  end
end