diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
commit | 7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch) | |
tree | 5bdc2229f5198d516781f8d24eace62fc7e589e9 /spec/features/projects/network_graph_spec.rb | |
parent | 185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff) |
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'spec/features/projects/network_graph_spec.rb')
-rw-r--r-- | spec/features/projects/network_graph_spec.rb | 138 |
1 files changed, 75 insertions, 63 deletions
diff --git a/spec/features/projects/network_graph_spec.rb b/spec/features/projects/network_graph_spec.rb index 1ee0ea51e53..97b743b4d73 100644 --- a/spec/features/projects/network_graph_spec.rb +++ b/spec/features/projects/network_graph_spec.rb @@ -13,98 +13,110 @@ RSpec.describe 'Project Network Graph', :js do allow(Network::Graph).to receive(:max_count).and_return(10) end - context 'when branch is master' do - def switch_ref_to(ref_name) - first('.js-project-refs-dropdown').click - - page.within '.project-refs-form' do - click_link ref_name + shared_examples 'network graph' do + context 'when branch is master' do + def switch_ref_to(ref_name) + first('.js-project-refs-dropdown').click + + page.within '.project-refs-form' do + click_link ref_name + end end - end - def click_show_only_selected_branch_checkbox - find('#filter_ref').click - end + def click_show_only_selected_branch_checkbox + find('#filter_ref').click + end - before do - visit project_network_path(project, 'master') - end + before do + visit project_network_path(project, 'master') + end - it 'renders project network' do - expect(page).to have_selector ".network-graph" - expect(page).to have_selector '.dropdown-menu-toggle', text: "master" - page.within '.network-graph' do - expect(page).to have_content 'master' + it 'renders project network' do + expect(page).to have_selector ".network-graph" + expect(page).to have_selector '.dropdown-menu-toggle', text: "master" + page.within '.network-graph' do + expect(page).to have_content 'master' + end end - end - it 'switches ref to branch' do - switch_ref_to('feature') + it 'switches ref to branch' do + switch_ref_to('feature') - expect(page).to have_selector '.dropdown-menu-toggle', text: 'feature' - page.within '.network-graph' do - expect(page).to have_content 'feature' + expect(page).to have_selector '.dropdown-menu-toggle', text: 'feature' + page.within '.network-graph' do + expect(page).to have_content 'feature' + end end - end - it 'switches ref to tag' do - switch_ref_to('v1.0.0') + it 'switches ref to tag' do + switch_ref_to('v1.0.0') - expect(page).to have_selector '.dropdown-menu-toggle', text: 'v1.0.0' - page.within '.network-graph' do - expect(page).to have_content 'v1.0.0' + expect(page).to have_selector '.dropdown-menu-toggle', text: 'v1.0.0' + page.within '.network-graph' do + expect(page).to have_content 'v1.0.0' + end end - end - it 'renders by commit sha of "v1.0.0"' do - page.within ".network-form" do - fill_in 'extended_sha1', with: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9' - find('button').click + it 'renders by commit sha of "v1.0.0"' do + page.within ".network-form" do + fill_in 'extended_sha1', with: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9' + find('button').click + end + + expect(page).to have_selector ".network-graph" + expect(page).to have_selector '.dropdown-menu-toggle', text: "master" + page.within '.network-graph' do + expect(page).to have_content 'v1.0.0' + end end - expect(page).to have_selector ".network-graph" - expect(page).to have_selector '.dropdown-menu-toggle', text: "master" - page.within '.network-graph' do - expect(page).to have_content 'v1.0.0' - end - end + it 'filters select tag' do + switch_ref_to('v1.0.0') - it 'filters select tag' do - switch_ref_to('v1.0.0') + expect(page).to have_css 'title', text: 'Graph · v1.0.0', visible: false + page.within '.network-graph' do + expect(page).to have_content 'Change some files' + end - expect(page).to have_css 'title', text: 'Graph · v1.0.0', visible: false - page.within '.network-graph' do - expect(page).to have_content 'Change some files' - end + click_show_only_selected_branch_checkbox - click_show_only_selected_branch_checkbox + page.within '.network-graph' do + expect(page).not_to have_content 'Change some files' + end - page.within '.network-graph' do - expect(page).not_to have_content 'Change some files' + click_show_only_selected_branch_checkbox + + page.within '.network-graph' do + expect(page).to have_content 'Change some files' + end end - click_show_only_selected_branch_checkbox + it 'renders error message when sha commit not exists' do + page.within ".network-form" do + fill_in 'extended_sha1', with: ';' + find('button').click + end - page.within '.network-graph' do - expect(page).to have_content 'Change some files' + expect(page).to have_selector '[data-testid="alert-danger"]', text: "Git revision ';' does not exist." end end - it 'renders error message when sha commit not exists' do - page.within ".network-form" do - fill_in 'extended_sha1', with: ';' - find('button').click - end + it 'renders project network with test branch' do + visit project_network_path(project, "'test'") - expect(page).to have_selector '[data-testid="alert-danger"]', text: "Git revision ';' does not exist." + page.within '.network-graph' do + expect(page).to have_content "'test'" + end end end - it 'renders project network with test branch' do - visit project_network_path(project, "'test'") + it_behaves_like 'network graph' - page.within '.network-graph' do - expect(page).to have_content "'test'" + context 'when disable_network_graph_notes_count is disabled' do + before do + stub_feature_flags(disable_network_graph_notes_count: false) end + + it_behaves_like 'network graph' end end |