summaryrefslogtreecommitdiff
path: root/spec/support/helpers/features/branches_helpers.rb
blob: 9fb6236d052fc3ed12e170fcb503f8eaf3e1f8e0 (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
# frozen_string_literal: true

# These helpers allow you to manipulate with sorting features.
#
# Usage:
#   describe "..." do
#     include Features::BranchesHelpers
#     ...
#
#     create_branch("feature")
#     select_branch("master")
#
module Features
  module BranchesHelpers
    include ListboxHelpers

    def create_branch(branch_name, source_branch_name = "master")
      fill_in("branch_name", with: branch_name)
      select_branch(source_branch_name)
      click_button("Create branch")
    end

    def select_branch(branch_name)
      wait_for_requests

      click_button branch_name
      send_keys branch_name
      select_listbox_item(branch_name)
    end
  end
end