2020-08-25 02:10:18 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
# These helpers fill fields on the "New Release" and "Edit Release" pages.
|
2020-08-25 02:10:18 -04:00
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
# describe "..." do
|
|
|
|
# include Spec::Support::Helpers::Features::ReleasesHelpers
|
|
|
|
# ...
|
|
|
|
#
|
|
|
|
# fill_tag_name("v1.0")
|
|
|
|
# select_create_from("my-feature-branch")
|
|
|
|
#
|
|
|
|
module Spec
|
|
|
|
module Support
|
|
|
|
module Helpers
|
|
|
|
module Features
|
|
|
|
module ReleasesHelpers
|
2021-03-10 07:09:14 -05:00
|
|
|
def select_new_tag_name(tag_name)
|
|
|
|
page.within '[data-testid="tag-name-field"]' do
|
|
|
|
find('button').click
|
2020-08-25 02:10:18 -04:00
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
wait_for_all_requests
|
2020-08-25 02:10:18 -04:00
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
find('input[aria-label="Search or create tag"]').set(tag_name)
|
2020-08-25 02:10:18 -04:00
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
wait_for_all_requests
|
2020-08-25 02:10:18 -04:00
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
click_button("Create tag #{tag_name}")
|
|
|
|
end
|
|
|
|
end
|
2020-08-25 02:10:18 -04:00
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
def select_create_from(branch_name)
|
|
|
|
page.within '[data-testid="create-from-field"]' do
|
|
|
|
find('button').click
|
2020-08-25 02:10:18 -04:00
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
wait_for_all_requests
|
2020-08-25 02:10:18 -04:00
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
find('input[aria-label="Search branches, tags, and commits"]').set(branch_name)
|
2020-08-25 02:10:18 -04:00
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
wait_for_all_requests
|
2020-08-25 02:10:18 -04:00
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
click_button("#{branch_name}")
|
|
|
|
end
|
2020-08-25 02:10:18 -04:00
|
|
|
end
|
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
def fill_release_title(release_title)
|
|
|
|
fill_in('Release title', with: release_title)
|
2020-08-25 02:10:18 -04:00
|
|
|
end
|
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
def select_milestone(milestone_title)
|
|
|
|
page.within '[data-testid="milestones-field"]' do
|
|
|
|
find('button').click
|
2020-08-25 02:10:18 -04:00
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
wait_for_all_requests
|
2020-08-25 02:10:18 -04:00
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
find('input[aria-label="Search Milestones"]').set(milestone_title)
|
2020-09-03 14:08:29 -04:00
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
wait_for_all_requests
|
2020-08-25 02:10:18 -04:00
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
find('button', text: milestone_title, match: :first).click
|
|
|
|
end
|
2020-08-25 02:10:18 -04:00
|
|
|
end
|
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
def fill_release_notes(release_notes)
|
|
|
|
fill_in('Release notes', with: release_notes)
|
2020-08-25 02:10:18 -04:00
|
|
|
end
|
|
|
|
|
2021-03-10 07:09:14 -05:00
|
|
|
def fill_asset_link(link)
|
|
|
|
all('input[name="asset-url"]').last.set(link[:url])
|
|
|
|
all('input[name="asset-link-name"]').last.set(link[:title])
|
|
|
|
all('select[name="asset-type"]').last.find("option[value=\"#{link[:type]}\"").select_option
|
2020-08-25 02:10:18 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
# Click "Add another link" and tab back to the beginning of the new row
|
|
|
|
def add_another_asset_link
|
2021-03-10 07:09:14 -05:00
|
|
|
click_button('Add another link')
|
2020-08-25 02:10:18 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|