summaryrefslogtreecommitdiff
path: root/qa/qa/page/dashboard/todos.rb
blob: d8baadcf73ddb9cc8680ec85fdfcbb76caf493b4 (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
# frozen_string_literal: true

module QA
  module Page
    module Dashboard
      class Todos < Page::Base
        include Page::Component::Snippet

        view 'app/views/dashboard/todos/index.html.haml' do
          element :todos_list_container, required: true
        end

        view 'app/views/dashboard/todos/_todo.html.haml' do
          element :todo_item_container
          element :todo_action_name_content
          element :todo_target_title_content
        end

        def has_todo_list?
          has_element? :todo_item_container
        end

        def has_latest_todo_item_with_content?(action, title)
          within_element(:todos_list_container) do
            within_element_by_index(:todo_item_container, 0) do
              has_element?(:todo_action_name_content, text: action) && has_element?(:todo_target_title_content, text: title)
            end
          end
        end
      end
    end
  end
end