Commit 993ee13f authored by Imre Farkas's avatar Imre Farkas

Merge branch 'ek-minor-refactor-remaining-vsa-specs' into 'master'

Minor refactor analytics/cycle_analytics feature specs

See merge request gitlab-org/gitlab!44412
parents 4660b823 52f0ee7d
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
RSpec.describe 'Group Value Stream Analytics', :js do RSpec.describe 'Multiple value streams', :js do
let_it_be(:group) { create(:group, name: 'CA-test-group') } let_it_be(:group) { create(:group, name: 'CA-test-group') }
let_it_be(:project) { create(:project, :repository, namespace: group, group: group, name: 'Cool fun project') } let_it_be(:project) { create(:project, :repository, namespace: group, group: group, name: 'Cool fun project') }
let_it_be(:user) do let_it_be(:user) do
...@@ -15,6 +15,9 @@ RSpec.describe 'Group Value Stream Analytics', :js do ...@@ -15,6 +15,9 @@ RSpec.describe 'Group Value Stream Analytics', :js do
duration_stage_selector = '.js-dropdown-stages' duration_stage_selector = '.js-dropdown-stages'
value_stream_selector = '[data-testid="dropdown-value-streams"]' value_stream_selector = '[data-testid="dropdown-value-streams"]'
let(:value_stream_dropdown) { page.find(value_stream_selector) }
let!(:default_value_stream) { create(:cycle_analytics_group_value_stream, group: group, name: 'default') }
3.times do |i| 3.times do |i|
let_it_be("issue_#{i}".to_sym) { create(:issue, title: "New Issue #{i}", project: project, created_at: 2.days.ago) } let_it_be("issue_#{i}".to_sym) { create(:issue, title: "New Issue #{i}", project: project, created_at: 2.days.ago) }
end end
...@@ -57,54 +60,49 @@ RSpec.describe 'Group Value Stream Analytics', :js do ...@@ -57,54 +60,49 @@ RSpec.describe 'Group Value Stream Analytics', :js do
wait_for_requests wait_for_requests
end end
describe 'Multiple value streams', :js do describe 'Create value stream' do
let(:value_stream_dropdown) { page.find(value_stream_selector) } before do
let!(:default_value_stream) { create(:cycle_analytics_group_value_stream, group: group, name: 'default') } select_group
describe 'Create value stream' do
before do
select_group
wait_for_requests wait_for_requests
end end
it 'can create a value stream' do it 'can create a value stream' do
custom_value_stream_name = "New created value stream" custom_value_stream_name = "New created value stream"
toggle_value_stream_dropdown toggle_value_stream_dropdown
page.find_button(_('Create new Value Stream')).click page.find_button(_('Create new Value Stream')).click
fill_in 'create-value-stream-name', with: custom_value_stream_name fill_in 'create-value-stream-name', with: custom_value_stream_name
page.find_button(_('Create Value Stream')).click page.find_button(_('Create Value Stream')).click
wait_for_requests wait_for_requests
expect(page).to have_text(_("'%{name}' Value Stream created") % { name: custom_value_stream_name }) expect(page).to have_text(_("'%{name}' Value Stream created") % { name: custom_value_stream_name })
end
end end
end
describe 'Delete value stream' do describe 'Delete value stream' do
let(:custom_value_stream_name) { "Test value stream" } let(:custom_value_stream_name) { "Test value stream" }
before do before do
value_stream = create(:cycle_analytics_group_value_stream, name: custom_value_stream_name, group: group) value_stream = create(:cycle_analytics_group_value_stream, name: custom_value_stream_name, group: group)
create(:cycle_analytics_group_stage, value_stream: value_stream) create(:cycle_analytics_group_stage, value_stream: value_stream)
select_group select_group
wait_for_requests wait_for_requests
end end
it 'can delete a value stream' do it 'can delete a value stream' do
select_value_stream(custom_value_stream_name) select_value_stream(custom_value_stream_name)
toggle_value_stream_dropdown toggle_value_stream_dropdown
page.find_button(_('Delete %{name}') % { name: custom_value_stream_name }).click page.find_button(_('Delete %{name}') % { name: custom_value_stream_name }).click
page.find_button(_('Delete')).click page.find_button(_('Delete')).click
wait_for_requests wait_for_requests
expect(page).to have_text(_("'%{name}' Value Stream deleted") % { name: custom_value_stream_name }) expect(page).to have_text(_("'%{name}' Value Stream deleted") % { name: custom_value_stream_name })
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment