diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-16 03:09:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-16 03:09:40 +0300 |
commit | bfa34fc19c0f74dbbf7caa3063565ec77efe0999 (patch) | |
tree | b2570fe6b5feb3dcef60e74d41265f1bd2716049 /spec/features/tags | |
parent | d22c6f7410966b5288a8b8e904cd24758e9cec50 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/tags')
-rw-r--r-- | spec/features/tags/developer_creates_tag_spec.rb | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/spec/features/tags/developer_creates_tag_spec.rb b/spec/features/tags/developer_creates_tag_spec.rb index 39d34a5ae64..111710ba325 100644 --- a/spec/features/tags/developer_creates_tag_spec.rb +++ b/spec/features/tags/developer_creates_tag_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Developer creates tag', feature_category: :source_code_management do +RSpec.describe 'Developer creates tag', :js, feature_category: :source_code_management do let(:user) { create(:user) } let(:group) { create(:group) } let(:project) { create(:project, :repository, namespace: group) } @@ -15,6 +15,8 @@ RSpec.describe 'Developer creates tag', feature_category: :source_code_managemen context 'from tag list' do before do visit project_tags_path(project) + click_link 'New tag' + wait_for_requests end it 'with an invalid name displays an error' do @@ -23,10 +25,17 @@ RSpec.describe 'Developer creates tag', feature_category: :source_code_managemen expect(page).to have_content 'Tag name invalid' end - it 'with an invalid reference displays an error' do - create_tag_in_form(tag: 'v2.0', ref: 'foo') - - expect(page).to have_content 'Target foo is invalid' + it "doesn't allow to select invalid ref" do + ref_name = 'foo' + fill_in 'tag_name', with: 'v2.0' + ref_selector = '.ref-selector' + find(ref_selector).click + wait_for_requests + page.within(ref_selector) do + fill_in _('Search by Git revision'), with: ref_name + wait_for_requests + expect(find('.gl-dropdown-contents')).not_to have_content(ref_name) + end end it 'that already exists displays an error' do @@ -46,27 +55,34 @@ RSpec.describe 'Developer creates tag', feature_category: :source_code_managemen end end - it 'opens dropdown for ref', :js do - click_link 'New tag' - ref_row = find('.form-group:nth-of-type(2) .col-sm-12') + it 'opens dropdown for ref' do + ref_row = find('.form-group:nth-of-type(2) .col-sm-auto') page.within ref_row do ref_input = find('[name="ref"]', visible: false) expect(ref_input.value).to eq 'master' - expect(find('.dropdown-toggle-text')).to have_content 'master' - - find('.js-branch-select').click - - expect(find('.dropdown-menu')).to have_content 'empty-branch' + expect(find('.gl-dropdown-button-text')).to have_content 'master' + find('.ref-selector').click + expect(find('.dropdown-menu')).to have_content 'test' end end end def create_tag_in_form(tag:, ref:, message: nil, desc: nil) - click_link 'New tag' fill_in 'tag_name', with: tag - find('#ref', visible: false).set(ref) + select_ref(ref: ref) fill_in 'message', with: message unless message.nil? fill_in 'release_description', with: desc unless desc.nil? click_button 'Create tag' end + + def select_ref(ref:) + ref_selector = '.ref-selector' + find(ref_selector).click + wait_for_requests + page.within(ref_selector) do + fill_in _('Search by Git revision'), with: ref + wait_for_requests + find('li', text: ref, match: :prefer_exact).click + end + end end |