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
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(:project) { create(:project, :repository, namespace: group, group: group, name: 'Cool fun project') }
let_it_be(:user) do
......@@ -15,6 +15,9 @@ RSpec.describe 'Group Value Stream Analytics', :js do
duration_stage_selector = '.js-dropdown-stages'
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|
let_it_be("issue_#{i}".to_sym) { create(:issue, title: "New Issue #{i}", project: project, created_at: 2.days.ago) }
end
......@@ -57,54 +60,49 @@ RSpec.describe 'Group Value Stream Analytics', :js do
wait_for_requests
end
describe 'Multiple value streams', :js do
let(:value_stream_dropdown) { page.find(value_stream_selector) }
let!(:default_value_stream) { create(:cycle_analytics_group_value_stream, group: group, name: 'default') }
describe 'Create value stream' do
before do
select_group
describe 'Create value stream' do
before do
select_group
wait_for_requests
end
wait_for_requests
end
it 'can create a value stream' do
custom_value_stream_name = "New created value stream"
toggle_value_stream_dropdown
it 'can create a value stream' do
custom_value_stream_name = "New created value stream"
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
page.find_button(_('Create Value Stream')).click
wait_for_requests
fill_in 'create-value-stream-name', with: custom_value_stream_name
page.find_button(_('Create Value Stream')).click
wait_for_requests
expect(page).to have_text(_("'%{name}' Value Stream created") % { name: custom_value_stream_name })
end
expect(page).to have_text(_("'%{name}' Value Stream created") % { name: custom_value_stream_name })
end
end
describe 'Delete value stream' do
let(:custom_value_stream_name) { "Test value stream" }
describe 'Delete value stream' do
let(:custom_value_stream_name) { "Test value stream" }
before do
value_stream = create(:cycle_analytics_group_value_stream, name: custom_value_stream_name, group: group)
create(:cycle_analytics_group_stage, value_stream: value_stream)
before do
value_stream = create(:cycle_analytics_group_value_stream, name: custom_value_stream_name, group: group)
create(:cycle_analytics_group_stage, value_stream: value_stream)
select_group
select_group
wait_for_requests
end
wait_for_requests
end
it 'can delete a value stream' do
select_value_stream(custom_value_stream_name)
it 'can delete a value stream' do
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')).click
wait_for_requests
page.find_button(_('Delete %{name}') % { name: custom_value_stream_name }).click
page.find_button(_('Delete')).click
wait_for_requests
expect(page).to have_text(_("'%{name}' Value Stream deleted") % { name: custom_value_stream_name })
end
expect(page).to have_text(_("'%{name}' Value Stream deleted") % { name: custom_value_stream_name })
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