debian-mirror-gitlab/spec/support/helpers/features/releases_helpers.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

87 lines
2.2 KiB
Ruby
Raw Permalink Normal View History

2020-11-24 15:15:51 +05:30
# frozen_string_literal: true
2021-04-17 20:07:23 +05:30
# These helpers fill fields on the "New Release" and "Edit Release" pages.
2020-11-24 15:15:51 +05:30
#
# Usage:
# describe "..." do
2023-06-20 00:43:36 +05:30
# include Features::ReleasesHelpers
2020-11-24 15:15:51 +05:30
# ...
#
# fill_tag_name("v1.0")
# select_create_from("my-feature-branch")
#
2023-06-20 00:43:36 +05:30
module Features
module ReleasesHelpers
include ListboxHelpers
2023-04-23 21:23:45 +05:30
2023-06-20 00:43:36 +05:30
def select_new_tag_name(tag_name)
open_tag_popover
2020-11-24 15:15:51 +05:30
2023-06-20 00:43:36 +05:30
page.within '[data-testid="tag-name-search"]' do
find('input[type="search"]').set(tag_name)
wait_for_all_requests
2020-11-24 15:15:51 +05:30
2023-06-20 00:43:36 +05:30
click_button("Create tag #{tag_name}")
end
end
2020-11-24 15:15:51 +05:30
2023-06-20 00:43:36 +05:30
def select_create_from(branch_name)
open_tag_popover
2020-11-24 15:15:51 +05:30
2023-06-20 00:43:36 +05:30
page.within '[data-testid="create-from-field"]' do
find('.ref-selector button').click
2020-11-24 15:15:51 +05:30
2023-06-20 00:43:36 +05:30
wait_for_all_requests
2020-11-24 15:15:51 +05:30
2023-06-20 00:43:36 +05:30
find('input[aria-label="Search branches, tags, and commits"]').set(branch_name)
2020-11-24 15:15:51 +05:30
2023-06-20 00:43:36 +05:30
wait_for_all_requests
2020-11-24 15:15:51 +05:30
2023-06-20 00:43:36 +05:30
select_listbox_item(branch_name.to_s, exact_text: true)
2020-11-24 15:15:51 +05:30
2023-06-20 00:43:36 +05:30
click_button _('Save')
end
end
2020-11-24 15:15:51 +05:30
2023-06-20 00:43:36 +05:30
def fill_release_title(release_title)
fill_in('Release title', with: release_title)
end
2020-11-24 15:15:51 +05:30
2023-06-20 00:43:36 +05:30
def select_milestone(milestone_title)
page.within '[data-testid="milestones-field"]' do
find('button').click
2020-11-24 15:15:51 +05:30
2023-06-20 00:43:36 +05:30
wait_for_all_requests
2020-11-24 15:15:51 +05:30
2023-06-20 00:43:36 +05:30
find('input[aria-label="Search Milestones"]').set(milestone_title)
2020-11-24 15:15:51 +05:30
2023-06-20 00:43:36 +05:30
wait_for_all_requests
2020-11-24 15:15:51 +05:30
2023-06-20 00:43:36 +05:30
find('button', text: milestone_title, match: :first).click
2020-11-24 15:15:51 +05:30
end
end
2023-06-20 00:43:36 +05:30
def fill_release_notes(release_notes)
fill_in('Release notes', with: release_notes)
end
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
end
# Click "Add another link" and tab back to the beginning of the new row
def add_another_asset_link
click_button('Add another link')
end
def open_tag_popover(name = s_('Release|Search or create tag name'))
return if page.has_css? '.release-tag-selector'
click_button name
wait_for_all_requests
end
2020-11-24 15:15:51 +05:30
end
end