Extract EE specific files/lines for spec/features/issues
We have the following files containing EE specific code. We should move them to ee/
spec/features/issues/filtered_search/dropdown_hint_spec.rb
diff --git a/spec/features/issues/filtered_search/dropdown_hint_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/features/issues/filtered_search/dropdown_hint_spec.rb
index 0e296ab2109..096756f19cc 100644
--- a/spec/features/issues/filtered_search/dropdown_hint_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/features/issues/filtered_search/dropdown_hint_spec.rb
@@ -66,7 +66,7 @@ describe 'Dropdown hint', :js do
it 'filters with text' do
filtered_search.set('a')
- expect(find(js_dropdown_hint)).to have_selector('.filter-dropdown .filter-dropdown-item', count: 4)
+ expect(find(js_dropdown_hint)).to have_selector('.filter-dropdown .filter-dropdown-item', count: 5)
end
end
@@ -119,6 +119,15 @@ describe 'Dropdown hint', :js do
expect_tokens([{ name: 'my-reaction' }])
expect_filtered_search_input_empty
end
+
+ it 'opens the yes-no dropdown when you click on confidential' do
+ click_hint('confidential')
+
+ expect(page).to have_css(js_dropdown_hint, visible: false)
+ expect(page).to have_css('#js-dropdown-confidential', visible: true)
+ expect_tokens([{ name: 'confidential' }])
+ expect_filtered_search_input_empty
+ end
end
describe 'selecting from dropdown with some input' do
spec/features/issues/filtered_search/search_bar_spec.rb
diff --git a/spec/features/issues/filtered_search/search_bar_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/features/issues/filtered_search/search_bar_spec.rb
index 891ef884682..c4468922883 100644
--- a/spec/features/issues/filtered_search/search_bar_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/features/issues/filtered_search/search_bar_spec.rb
@@ -86,7 +86,7 @@ describe 'Search bar', :js do
expect(find('#js-dropdown-hint')).to have_selector('.filter-dropdown .filter-dropdown-item', count: original_size)
end
- it 'resets the dropdown filters', :quarantine do
+ it 'resets the dropdown filters' do
filtered_search.click
hint_offset = get_left_style(find('#js-dropdown-hint')['style'])
@@ -100,7 +100,7 @@ describe 'Search bar', :js do
find('.filtered-search-box .clear-search').click
filtered_search.click
- expect(find('#js-dropdown-hint')).to have_selector('.filter-dropdown .filter-dropdown-item', count: 5)
+ expect(find('#js-dropdown-hint')).to have_selector('.filter-dropdown .filter-dropdown-item', count: 6)
expect(get_left_style(find('#js-dropdown-hint')['style'])).to eq(hint_offset)
end
end
spec/features/issues/filtered_search/visual_tokens_spec.rb
diff --git a/spec/features/issues/filtered_search/visual_tokens_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/features/issues/filtered_search/visual_tokens_spec.rb
index 9fd661d80ae..a4c34ce85f0 100644
--- a/spec/features/issues/filtered_search/visual_tokens_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/features/issues/filtered_search/visual_tokens_spec.rb
@@ -59,6 +59,13 @@ describe 'Visual tokens', :js do
expect(page).to have_css('#js-dropdown-author', visible: false)
end
+ it 'ends editing mode when scroll container is clicked' do
+ find('.scroll-container').click
+
+ expect_filtered_search_input_empty
+ expect(page).to have_css('#js-dropdown-author', visible: false)
+ end
+
describe 'selecting different author from dropdown' do
before do
filter_author_dropdown.find('.filter-dropdown-item .dropdown-light-content', text: "@#{user_rock.username}").click
@@ -102,6 +109,13 @@ describe 'Visual tokens', :js do
expect(page).to have_css('#js-dropdown-assignee', visible: false)
end
+ it 'ends editing mode when scroll container is clicked' do
+ find('.scroll-container').click
+
+ expect_filtered_search_input_empty
+ expect(page).to have_css('#js-dropdown-assignee', visible: false)
+ end
+
describe 'selecting static option from dropdown' do
before do
find("#js-dropdown-assignee").find('.filter-dropdown-item', text: 'None').click
@@ -153,6 +167,13 @@ describe 'Visual tokens', :js do
expect_filtered_search_input_empty
expect(page).to have_css('#js-dropdown-milestone', visible: false)
end
+
+ it 'ends editing mode when scroll container is clicked' do
+ find('.scroll-container').click
+
+ expect_filtered_search_input_empty
+ expect(page).to have_css('#js-dropdown-milestone', visible: false)
+ end
end
describe 'editing label token' do
spec/features/issues/form_spec.rb
diff --git a/spec/features/issues/form_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/features/issues/form_spec.rb
index f2e4c5779df..2fe4256037f 100644
--- a/spec/features/issues/form_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/features/issues/form_spec.rb
@@ -13,6 +13,8 @@ describe 'New/edit issue', :js do
let!(:issue) { create(:issue, project: project, assignees: [user], milestone: milestone) }
before do
+ stub_licensed_features(multiple_issue_assignees: false, issue_weights: false)
+
project.add_maintainer(user)
project.add_maintainer(user2)
sign_in(user)
@@ -30,8 +32,8 @@ describe 'New/edit issue', :js do
# the original method, resulting in infinite recursion when called.
# This is likely a bug with helper modules included into dynamically generated view classes.
# To work around this, we have to hold on to and call to the original implementation manually.
- original_issue_dropdown_options = FormHelper.instance_method(:issue_assignees_dropdown_options)
- allow_any_instance_of(FormHelper).to receive(:issue_assignees_dropdown_options).and_wrap_original do |original, *args|
+ original_issue_dropdown_options = EE::FormHelper.instance_method(:issue_assignees_dropdown_options)
+ allow_any_instance_of(EE::FormHelper).to receive(:issue_assignees_dropdown_options).and_wrap_original do |original, *args|
options = original_issue_dropdown_options.bind(original.receiver).call(*args)
options[:data][:per_page] = 2
spec/features/issues/gfm_autocomplete_spec.rb
diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/features/issues/gfm_autocomplete_spec.rb
index c22ad0d20ef..986f3823275 100644
--- a/spec/features/issues/gfm_autocomplete_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/features/issues/gfm_autocomplete_spec.rb
@@ -278,7 +278,7 @@ describe 'GFM autocomplete', :js do
end
end
- # This context has jsut one example in each contexts in order to improve spec performance.
+ # This context has just one example in each contexts in order to improve spec performance.
context 'labels', :quarantine do
let!(:backend) { create(:label, project: project, title: 'backend') }
let!(:bug) { create(:label, project: project, title: 'bug') }
spec/features/issues/user_uses_quick_actions_spec.rb
diff --git a/spec/features/issues/user_uses_quick_actions_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/features/issues/user_uses_quick_actions_spec.rb
index 27cffdc5f8b..6a7a7f00fe4 100644
--- a/spec/features/issues/user_uses_quick_actions_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/features/issues/user_uses_quick_actions_spec.rb
@@ -117,6 +117,80 @@ describe 'Issues > User uses quick actions', :js do
end
end
+ describe 'adding a weight from a note' do
+ let(:issue) { create(:issue, project: project) }
+
+ context 'when the user can update the weight' do
+ it 'does not create a note, and sets the weight accordingly' do
+ add_note("/weight 5")
+
+ expect(page).not_to have_content '/weight 5'
+ expect(page).to have_content 'Commands applied'
+
+ issue.reload
+
+ expect(issue.weight).to eq(5)
+ end
+ end
+
+ context 'when the current user cannot update the weight' do
+ let(:guest) { create(:user) }
+ before do
+ project.add_guest(guest)
+ gitlab_sign_out
+ sign_in(guest)
+ visit project_issue_path(project, issue)
+ end
+
+ it 'does not create a note or set the weight' do
+ add_note("/weight 5")
+
+ expect(page).not_to have_content 'Commands applied'
+
+ issue.reload
+
+ expect(issue.weight).not_to eq(5)
+ end
+ end
+ end
+
+ describe 'removing weight from a note' do
+ let(:issue) { create(:issue, project: project, weight: 1) }
+
+ context 'when the user can update the weight' do
+ it 'does not create a note, and removes the weight accordingly' do
+ add_note("/clear_weight")
+
+ expect(page).not_to have_content '/clear_weight'
+ expect(page).to have_content 'Commands applied'
+
+ issue.reload
+
+ expect(issue.weight).to eq(nil)
+ end
+ end
+
+ context 'when the current user cannot update the weight' do
+ let(:guest) { create(:user) }
+ before do
+ project.add_guest(guest)
+ gitlab_sign_out
+ sign_in(guest)
+ visit project_issue_path(project, issue)
+ end
+
+ it 'does create a note or set the weight' do
+ add_note("/clear_weight")
+
+ expect(page).not_to have_content 'Commands applied'
+
+ issue.reload
+
+ expect(issue.weight).to eq(1)
+ end
+ end
+ end
+
describe 'mark issue as duplicate' do
let(:issue) { create(:issue, project: project) }
let(:original_issue) { create(:issue, project: project) }
Edited by Coung Ngo