diff options
Diffstat (limited to 'spec/support/helpers/features')
-rw-r--r-- | spec/support/helpers/features/branches_helpers.rb | 33 | ||||
-rw-r--r-- | spec/support/helpers/features/notes_helpers.rb | 27 | ||||
-rw-r--r-- | spec/support/helpers/features/sorting_helpers.rb | 26 |
3 files changed, 86 insertions, 0 deletions
diff --git a/spec/support/helpers/features/branches_helpers.rb b/spec/support/helpers/features/branches_helpers.rb new file mode 100644 index 00000000000..3525d9a70a7 --- /dev/null +++ b/spec/support/helpers/features/branches_helpers.rb @@ -0,0 +1,33 @@ +# These helpers allow you to manipulate with sorting features. +# +# Usage: +# describe "..." do +# include Spec::Support::Helpers::Features::BranchesHelpers +# ... +# +# create_branch("feature") +# select_branch("master") +# +module Spec + module Support + module Helpers + module Features + module BranchesHelpers + 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) + find(".git-revision-dropdown-toggle").click + + page.within("#new-branch-form .dropdown-menu") do + click_link(branch_name) + end + end + end + end + end + end +end diff --git a/spec/support/helpers/features/notes_helpers.rb b/spec/support/helpers/features/notes_helpers.rb new file mode 100644 index 00000000000..2b9f8b30c60 --- /dev/null +++ b/spec/support/helpers/features/notes_helpers.rb @@ -0,0 +1,27 @@ +# These helpers allow you to manipulate with notes. +# +# Usage: +# describe "..." do +# include Spec::Support::Helpers::Features::NotesHelpers +# ... +# +# add_note("Hello world!") +# +module Spec + module Support + module Helpers + module Features + module NotesHelpers + def add_note(text) + perform_enqueued_jobs do + page.within(".js-main-target-form") do + fill_in("note[note]", with: text) + find(".js-comment-submit-button").click + end + end + end + end + end + end + end +end diff --git a/spec/support/helpers/features/sorting_helpers.rb b/spec/support/helpers/features/sorting_helpers.rb new file mode 100644 index 00000000000..ad0053ec5cf --- /dev/null +++ b/spec/support/helpers/features/sorting_helpers.rb @@ -0,0 +1,26 @@ +# These helpers allow you to manipulate with sorting features. +# +# Usage: +# describe "..." do +# include Spec::Support::Helpers::Features::SortingHelpers +# ... +# +# sort_by("Last updated") +# +module Spec + module Support + module Helpers + module Features + module SortingHelpers + def sort_by(value) + find('button.dropdown-toggle').click + + page.within('.content ul.dropdown-menu.dropdown-menu-right li') do + click_link(value) + end + end + end + end + end + end +end |