diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 11:43:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 11:43:02 +0300 |
commit | d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch) | |
tree | 2341ef426af70ad1e289c38036737e04b0aa5007 /spec/features/issues/related_issues_spec.rb | |
parent | d6e514dd13db8947884cd58fe2a9c2a063400a9b (diff) |
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'spec/features/issues/related_issues_spec.rb')
-rw-r--r-- | spec/features/issues/related_issues_spec.rb | 98 |
1 files changed, 52 insertions, 46 deletions
diff --git a/spec/features/issues/related_issues_spec.rb b/spec/features/issues/related_issues_spec.rb index 837859bbe26..a95229d4f1b 100644 --- a/spec/features/issues/related_issues_spec.rb +++ b/spec/features/issues/related_issues_spec.rb @@ -41,13 +41,13 @@ RSpec.describe 'Related issues', :js do visit project_issue_path(project, issue) expect(page).to have_css('.related-issues-block') - expect(page).not_to have_selector('.js-issue-count-badge-add-button') + expect(page).not_to have_button 'Add a related issue' end end context 'when logged in but not a member' do before do - gitlab_sign_in(user) + sign_in(user) end it 'shows widget when internal project' do @@ -57,7 +57,7 @@ RSpec.describe 'Related issues', :js do visit project_issue_path(project, issue) expect(page).to have_css('.related-issues-block') - expect(page).not_to have_selector('.js-issue-count-badge-add-button') + expect(page).not_to have_button 'Add a related issue' end it 'does not show widget when private project' do @@ -76,7 +76,7 @@ RSpec.describe 'Related issues', :js do visit project_issue_path(project, issue) expect(page).to have_css('.related-issues-block') - expect(page).not_to have_selector('.js-issue-count-badge-add-button') + expect(page).not_to have_button 'Add a related issue' end it 'shows widget on their own public issue' do @@ -86,13 +86,13 @@ RSpec.describe 'Related issues', :js do visit project_issue_path(project, issue) expect(page).to have_css('.related-issues-block') - expect(page).not_to have_selector('.js-issue-count-badge-add-button') + expect(page).not_to have_button 'Add a related issue' end end context 'when logged in and a guest' do before do - gitlab_sign_in(user) + sign_in(user) end it 'shows widget when internal project' do @@ -103,7 +103,7 @@ RSpec.describe 'Related issues', :js do visit project_issue_path(project, issue) expect(page).to have_css('.related-issues-block') - expect(page).not_to have_selector('.js-issue-count-badge-add-button') + expect(page).not_to have_button 'Add a related issue' end it 'shows widget when private project' do @@ -114,7 +114,7 @@ RSpec.describe 'Related issues', :js do visit project_issue_path(project, issue) expect(page).to have_css('.related-issues-block') - expect(page).not_to have_selector('.js-issue-count-badge-add-button') + expect(page).not_to have_button 'Add a related issue' end it 'shows widget when public project' do @@ -125,13 +125,13 @@ RSpec.describe 'Related issues', :js do visit project_issue_path(project, issue) expect(page).to have_css('.related-issues-block') - expect(page).not_to have_selector('.js-issue-count-badge-add-button') + expect(page).not_to have_button 'Add a related issue' end end context 'when logged in and a reporter' do before do - gitlab_sign_in(user) + sign_in(user) end it 'shows widget when internal project' do @@ -142,7 +142,7 @@ RSpec.describe 'Related issues', :js do visit project_issue_path(project, issue) expect(page).to have_css('.related-issues-block') - expect(page).to have_selector('.js-issue-count-badge-add-button') + expect(page).to have_button 'Add a related issue' end it 'shows widget when private project' do @@ -153,7 +153,7 @@ RSpec.describe 'Related issues', :js do visit project_issue_path(project, issue) expect(page).to have_css('.related-issues-block') - expect(page).to have_selector('.js-issue-count-badge-add-button') + expect(page).to have_button 'Add a related issue' end it 'shows widget when public project' do @@ -164,7 +164,7 @@ RSpec.describe 'Related issues', :js do visit project_issue_path(project, issue) expect(page).to have_css('.related-issues-block') - expect(page).to have_selector('.js-issue-count-badge-add-button') + expect(page).to have_button 'Add a related issue' end it 'shows widget on their own public issue' do @@ -175,7 +175,7 @@ RSpec.describe 'Related issues', :js do visit project_issue_path(project, issue) expect(page).to have_css('.related-issues-block') - expect(page).to have_selector('.js-issue-count-badge-add-button') + expect(page).to have_button 'Add a related issue' end end end @@ -186,7 +186,7 @@ RSpec.describe 'Related issues', :js do before do project.add_guest(user) - gitlab_sign_in(user) + sign_in(user) end context 'visiting some issue someone else created' do @@ -216,7 +216,7 @@ RSpec.describe 'Related issues', :js do before do project.add_maintainer(user) project_b.add_maintainer(user) - gitlab_sign_in(user) + sign_in(user) end context 'without existing related issues' do @@ -230,9 +230,9 @@ RSpec.describe 'Related issues', :js do end it 'add related issue' do - find('.js-issue-count-badge-add-button').click - find('.js-add-issuable-form-input').set "#{issue_b.to_reference(project)} " - find('.js-add-issuable-form-add-button').click + click_button 'Add a related issue' + fill_in 'Paste issue link', with: "#{issue_b.to_reference(project)} " + click_button 'Add' wait_for_requests @@ -247,9 +247,9 @@ RSpec.describe 'Related issues', :js do end it 'add cross-project related issue' do - find('.js-issue-count-badge-add-button').click - find('.js-add-issuable-form-input').set "#{issue_project_b_a.to_reference(project)} " - find('.js-add-issuable-form-add-button').click + click_button 'Add a related issue' + fill_in 'Paste issue link', with: "#{issue_project_b_a.to_reference(project)} " + click_button 'Add' wait_for_requests @@ -261,9 +261,9 @@ RSpec.describe 'Related issues', :js do end it 'pressing enter should submit the form' do - find('.js-issue-count-badge-add-button').click - find('.js-add-issuable-form-input').set "#{issue_project_b_a.to_reference(project)} " - find('.js-add-issuable-form-input').native.send_key(:enter) + click_button 'Add a related issue' + fill_in 'Paste issue link', with: "#{issue_project_b_a.to_reference(project)} " + find_field('Paste issue link').native.send_key(:enter) wait_for_requests @@ -275,10 +275,10 @@ RSpec.describe 'Related issues', :js do end it 'disallows duplicate entries' do - find('.js-issue-count-badge-add-button').click - find('.js-add-issuable-form-input').set 'duplicate duplicate duplicate' + click_button 'Add a related issue' + fill_in 'Paste issue link', with: 'duplicate duplicate duplicate' - items = all('.js-add-issuable-form-token-list-item') + items = all('.issue-token') expect(items.count).to eq(1) expect(items[0].text).to eq('duplicate') @@ -288,29 +288,35 @@ RSpec.describe 'Related issues', :js do it 'allows us to remove pending issues' do # Tests against https://gitlab.com/gitlab-org/gitlab/issues/11625 - find('.js-issue-count-badge-add-button').click - find('.js-add-issuable-form-input').set 'issue1 issue2 issue3 ' + click_button 'Add a related issue' + fill_in 'Paste issue link', with: 'issue1 issue2 issue3 ' - items = all('.js-add-issuable-form-token-list-item') + items = all('.issue-token') expect(items.count).to eq(3) expect(items[0].text).to eq('issue1') expect(items[1].text).to eq('issue2') expect(items[2].text).to eq('issue3') # Remove pending issues left to right to make sure none get stuck - items[0].find('.js-issue-token-remove-button').click - items = all('.js-add-issuable-form-token-list-item') + within items[0] do + click_button 'Remove' + end + items = all('.issue-token') expect(items.count).to eq(2) expect(items[0].text).to eq('issue2') expect(items[1].text).to eq('issue3') - items[0].find('.js-issue-token-remove-button').click - items = all('.js-add-issuable-form-token-list-item') + within items[0] do + click_button 'Remove' + end + items = all('.issue-token') expect(items.count).to eq(1) expect(items[0].text).to eq('issue3') - items[0].find('.js-issue-token-remove-button').click - items = all('.js-add-issuable-form-token-list-item') + within items[0] do + click_button 'Remove' + end + items = all('.issue-token') expect(items.count).to eq(0) end end @@ -351,9 +357,9 @@ RSpec.describe 'Related issues', :js do end it 'add related issue' do - find('.js-issue-count-badge-add-button').click - find('.js-add-issuable-form-input').set "##{issue_d.iid} " - find('.js-add-issuable-form-add-button').click + click_button 'Add a related issue' + fill_in 'Paste issue link', with: "##{issue_d.iid} " + click_button 'Add' wait_for_requests @@ -367,9 +373,9 @@ RSpec.describe 'Related issues', :js do end it 'add invalid related issue' do - find('.js-issue-count-badge-add-button').click - find('.js-add-issuable-form-input').set "#9999999 " - find('.js-add-issuable-form-add-button').click + click_button 'Add a related issue' + fill_in 'Paste issue link', with: '#9999999 ' + click_button 'Add' wait_for_requests @@ -382,9 +388,9 @@ RSpec.describe 'Related issues', :js do end it 'add unauthorized related issue' do - find('.js-issue-count-badge-add-button').click - find('.js-add-issuable-form-input').set "#{issue_project_unauthorized_a.to_reference(project)} " - find('.js-add-issuable-form-add-button').click + click_button 'Add a related issue' + fill_in 'Paste issue link', with: "#{issue_project_unauthorized_a.to_reference(project)} " + click_button 'Add' wait_for_requests |