Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2024-01-05 18:08:05 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2024-01-05 18:08:05 +0300
commit4ba8ae97071935c39216afc53304c60386bbfa68 (patch)
tree452038ff8d19dcf69453dde0079b1db4870a3aae /spec/support
parent7120254aee218529320c061696a2af530494e6aa (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/features/work_items_shared_examples.rb103
-rw-r--r--spec/support/shared_examples/models/members_notifications_shared_example.rb14
2 files changed, 105 insertions, 12 deletions
diff --git a/spec/support/shared_examples/features/work_items_shared_examples.rb b/spec/support/shared_examples/features/work_items_shared_examples.rb
index 049809f5edd..7ff37030493 100644
--- a/spec/support/shared_examples/features/work_items_shared_examples.rb
+++ b/spec/support/shared_examples/features/work_items_shared_examples.rb
@@ -565,3 +565,106 @@ RSpec.shared_examples 'work items parent' do |type|
expect(find_by_testid('work-item-parent-none')).to have_text('None')
end
end
+
+def find_and_click_edit(selector)
+ within(selector) do
+ click_button 'Edit'
+ end
+end
+
+def find_and_click_clear(selector)
+ within(selector) do
+ click_button 'Clear'
+ end
+end
+
+RSpec.shared_examples 'work items iteration' do
+ let(:work_item_iteration_selector) { '[data-testid="work-item-iteration-with-edit"]' }
+ let_it_be(:iteration_cadence) { create(:iterations_cadence, group: group, active: true) }
+ let_it_be(:iteration) do
+ create(
+ :iteration,
+ iterations_cadence: iteration_cadence,
+ group: group,
+ start_date: 1.day.from_now,
+ due_date: 2.days.from_now
+ )
+ end
+
+ let_it_be(:iteration2) do
+ create(
+ :iteration,
+ iterations_cadence: iteration_cadence,
+ group: group,
+ start_date: 2.days.ago,
+ due_date: 1.day.ago,
+ state: 'closed',
+ skip_future_date_validation: true
+ )
+ end
+
+ before do
+ stub_feature_flags(work_items_mvc_2: true)
+
+ page.refresh
+ wait_for_all_requests
+ end
+
+ context 'for accessibility' do
+ it 'has the work item iteration with edit' do
+ expect(page).to have_selector(work_item_iteration_selector)
+ end
+
+ it 'passes axe automated accessibility testing in closed state' do
+ expect(page).to be_axe_clean.within(work_item_iteration_selector)
+ end
+
+ # TODO, add test for automated accessibility after it is fixed in GlCollapsibleListBox
+ # Invalid ARIA attribute value: aria-owns="listbox-##" when searchable
+ # it 'passes axe automated accessibility testing in open state' do
+ # within(work_item_iteration) do
+ # click_button _('Edit')
+ # wait_for_requests
+
+ # expect(page).to be_axe_clean.within(work_item_iteration)
+ # end
+ # end
+ end
+
+ context 'when edit is clicked' do
+ it 'selects and updates the right iteration', :aggregate_failures do
+ find_and_click_edit(work_item_iteration_selector)
+
+ within(work_item_iteration_selector) do
+ expect(page).to have_text(iteration_cadence.title)
+ expect(page).to have_text(iteration.period)
+ end
+
+ select_listbox_item(iteration.period)
+
+ wait_for_requests
+
+ within(work_item_iteration_selector) do
+ expect(page).to have_text(iteration_cadence.title)
+ expect(page).to have_text(iteration.period)
+ end
+
+ find_and_click_edit(work_item_iteration_selector)
+
+ find_and_click_clear(work_item_iteration_selector)
+
+ expect(find(work_item_iteration_selector)).to have_content('None')
+ end
+
+ it 'searches and sets or removes iteration for the work item' do
+ find_and_click_edit(work_item_iteration_selector)
+ within(work_item_iteration_selector) do
+ send_keys(iteration.title)
+ wait_for_requests
+
+ select_listbox_item(iteration.period)
+ expect(page).to have_text(iteration.period)
+ end
+ end
+ end
+end
diff --git a/spec/support/shared_examples/models/members_notifications_shared_example.rb b/spec/support/shared_examples/models/members_notifications_shared_example.rb
index 58ce3daec40..01212ed950d 100644
--- a/spec/support/shared_examples/models/members_notifications_shared_example.rb
+++ b/spec/support/shared_examples/models/members_notifications_shared_example.rb
@@ -26,27 +26,17 @@ RSpec.shared_examples 'members notifications' do |entity_type|
describe '#accept_request' do
let(:member) { create(:"#{entity_type}_member", :access_request) }
- it "calls NotificationService.new_#{entity_type}_member" do
+ it "calls NotificationService.new_member" do
expect(notification_service).to receive(:new_member).with(member)
member.accept_request(create(:user))
end
end
- describe "#accept_invite!" do
- let(:member) { create(:"#{entity_type}_member", :invited) }
-
- it "calls NotificationService.accept_#{entity_type}_invite" do
- expect(notification_service).to receive(:"accept_#{entity_type}_invite").with(member)
-
- member.accept_invite!(build(:user))
- end
- end
-
describe "#decline_invite!" do
let(:member) { create(:"#{entity_type}_member", :invited) }
- it "calls NotificationService.decline_#{entity_type}_invite" do
+ it "calls NotificationService.decline_invite" do
expect(notification_service).to receive(:decline_invite).with(member)
member.decline_invite!