diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2019-07-03 11:55:56 +0200 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2019-07-03 11:55:56 +0200 |
commit | c20c9e2940b0f94547246d05b7b526f0b1571027 (patch) | |
tree | c548960a37ab7447ff542e0844e838f973c118fb /spec/features | |
parent | 49d689fb3c7781c861f995aaafef4b224581020b (diff) | |
parent | 2ca9bda400c0ed647c3ef342dcc0aa56c558cebe (diff) | |
download | gitlab-ce-c20c9e2940b0f94547246d05b7b526f0b1571027.tar.gz |
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
Diffstat (limited to 'spec/features')
12 files changed, 117 insertions, 72 deletions
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 45ef5d07ff0..4a9037afb43 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -40,7 +40,7 @@ describe 'Admin updates settings' do end it 'Modify import sources' do - expect(Gitlab::CurrentSettings.import_sources).not_to be_empty + expect(current_settings.import_sources).not_to be_empty page.within('.as-visibility-access') do Gitlab::ImportSources.options.map do |name, _| @@ -51,7 +51,7 @@ describe 'Admin updates settings' do end expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.import_sources).to be_empty + expect(current_settings.import_sources).to be_empty page.within('.as-visibility-access') do check "Repo by URL" @@ -59,7 +59,7 @@ describe 'Admin updates settings' do end expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.import_sources).to eq(['git']) + expect(current_settings.import_sources).to eq(['git']) end it 'Change Visibility and Access Controls' do @@ -68,7 +68,7 @@ describe 'Admin updates settings' do click_button 'Save changes' end - expect(Gitlab::CurrentSettings.project_export_enabled).to be_falsey + expect(current_settings.project_export_enabled).to be_falsey expect(page).to have_content "Application settings saved successfully" end @@ -96,7 +96,7 @@ describe 'Admin updates settings' do click_button 'Save changes' end - expect(Gitlab::CurrentSettings.gravatar_enabled).to be_falsey + expect(current_settings.gravatar_enabled).to be_falsey expect(page).to have_content "Application settings saved successfully" end @@ -118,7 +118,7 @@ describe 'Admin updates settings' do click_button 'Save changes' end - expect(Gitlab::CurrentSettings.home_page_url).to eq "https://about.gitlab.com/" + expect(current_settings.home_page_url).to eq "https://about.gitlab.com/" expect(page).to have_content "Application settings saved successfully" end @@ -133,13 +133,13 @@ describe 'Admin updates settings' do click_button 'Save changes' end - expect(Gitlab::CurrentSettings.enforce_terms).to be(true) - expect(Gitlab::CurrentSettings.terms).to eq 'Be nice!' + expect(current_settings.enforce_terms).to be(true) + expect(current_settings.terms).to eq 'Be nice!' expect(page).to have_content 'Application settings saved successfully' end it 'Modify oauth providers' do - expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to be_empty + expect(current_settings.disabled_oauth_sign_in_sources).to be_empty page.within('.as-signin') do uncheck 'Google' @@ -147,7 +147,7 @@ describe 'Admin updates settings' do end expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to include('google_oauth2') + expect(current_settings.disabled_oauth_sign_in_sources).to include('google_oauth2') page.within('.as-signin') do check "Google" @@ -155,11 +155,11 @@ describe 'Admin updates settings' do end expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).not_to include('google_oauth2') + expect(current_settings.disabled_oauth_sign_in_sources).not_to include('google_oauth2') end it 'Oauth providers do not raise validation errors when saving unrelated changes' do - expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to be_empty + expect(current_settings.disabled_oauth_sign_in_sources).to be_empty page.within('.as-signin') do uncheck 'Google' @@ -167,7 +167,7 @@ describe 'Admin updates settings' do end expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to include('google_oauth2') + expect(current_settings.disabled_oauth_sign_in_sources).to include('google_oauth2') # Remove google_oauth2 from the Omniauth strategies allow(Devise).to receive(:omniauth_providers).and_return([]) @@ -178,7 +178,7 @@ describe 'Admin updates settings' do end expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to include('google_oauth2') + expect(current_settings.disabled_oauth_sign_in_sources).to include('google_oauth2') end it 'Configure web terminal' do @@ -188,7 +188,7 @@ describe 'Admin updates settings' do end expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.terminal_max_session_time).to eq(15) + expect(current_settings.terminal_max_session_time).to eq(15) end end @@ -204,7 +204,7 @@ describe 'Admin updates settings' do end expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.hide_third_party_offers).to be true + expect(current_settings.hide_third_party_offers).to be true end it 'Change Slack Notifications Service template settings' do @@ -249,8 +249,8 @@ describe 'Admin updates settings' do click_button 'Save changes' end - expect(Gitlab::CurrentSettings.auto_devops_enabled?).to be true - expect(Gitlab::CurrentSettings.auto_devops_domain).to eq('domain.com') + expect(current_settings.auto_devops_enabled?).to be true + expect(current_settings.auto_devops_domain).to eq('domain.com') expect(page).to have_content "Application settings saved successfully" end end @@ -268,8 +268,8 @@ describe 'Admin updates settings' do end expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.recaptcha_enabled).to be true - expect(Gitlab::CurrentSettings.unique_ips_limit_per_user).to eq(15) + expect(current_settings.recaptcha_enabled).to be true + expect(current_settings.unique_ips_limit_per_user).to eq(15) end end @@ -284,7 +284,7 @@ describe 'Admin updates settings' do click_button 'Save changes' end - expect(Gitlab::CurrentSettings.metrics_enabled?).to be true + expect(current_settings.metrics_enabled?).to be true expect(page).to have_content "Application settings saved successfully" end @@ -294,7 +294,7 @@ describe 'Admin updates settings' do click_button 'Save changes' end - expect(Gitlab::CurrentSettings.prometheus_metrics_enabled?).to be true + expect(current_settings.prometheus_metrics_enabled?).to be true expect(page).to have_content "Application settings saved successfully" end @@ -343,8 +343,8 @@ describe 'Admin updates settings' do end expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.allow_local_requests_from_hooks_and_services).to be true - expect(Gitlab::CurrentSettings.dns_rebinding_protection_enabled).to be false + expect(current_settings.allow_local_requests_from_hooks_and_services).to be true + expect(current_settings.dns_rebinding_protection_enabled).to be false end end @@ -361,9 +361,9 @@ describe 'Admin updates settings' do click_button 'Save changes' end - expect(Gitlab::CurrentSettings.help_page_text).to eq "Example text" - expect(Gitlab::CurrentSettings.help_page_hide_commercial_content).to be_truthy - expect(Gitlab::CurrentSettings.help_page_support_url).to eq "http://example.com/help" + expect(current_settings.help_page_text).to eq "Example text" + expect(current_settings.help_page_hide_commercial_content).to be_truthy + expect(current_settings.help_page_support_url).to eq "http://example.com/help" expect(page).to have_content "Application settings saved successfully" end @@ -374,8 +374,8 @@ describe 'Admin updates settings' do click_button 'Save changes' end - expect(Gitlab::CurrentSettings.max_pages_size).to eq 15 - expect(Gitlab::CurrentSettings.pages_domain_verification_enabled?).to be_truthy + expect(current_settings.max_pages_size).to eq 15 + expect(current_settings.pages_domain_verification_enabled?).to be_truthy expect(page).to have_content "Application settings saved successfully" end @@ -385,7 +385,7 @@ describe 'Admin updates settings' do click_button 'Save changes' end - expect(Gitlab::CurrentSettings.polling_interval_multiplier).to eq 5.0 + expect(current_settings.polling_interval_multiplier).to eq 5.0 expect(page).to have_content "Application settings saved successfully" end @@ -395,7 +395,7 @@ describe 'Admin updates settings' do click_button 'Save changes' end - expect(Gitlab::CurrentSettings.polling_interval_multiplier).not_to eq(-1.0) + expect(current_settings.polling_interval_multiplier).not_to eq(-1.0) expect(page) .to have_content "The form contains the following error: Polling interval multiplier must be greater than or equal to 0" end @@ -413,8 +413,8 @@ describe 'Admin updates settings' do click_button 'Save changes' end - expect(Gitlab::CurrentSettings.lets_encrypt_notification_email).to eq 'my@test.example.com' - expect(Gitlab::CurrentSettings.lets_encrypt_terms_of_service_accepted).to eq true + expect(current_settings.lets_encrypt_notification_email).to eq 'my@test.example.com' + expect(current_settings.lets_encrypt_terms_of_service_accepted).to eq true end end @@ -445,4 +445,8 @@ describe 'Admin updates settings' do page.check('Wiki page') page.check('Deployment') end + + def current_settings + ApplicationSetting.current_without_cache + end end diff --git a/spec/features/container_registry_spec.rb b/spec/features/container_registry_spec.rb index 21d97aba0c5..1b5943bd5d8 100644 --- a/spec/features/container_registry_spec.rb +++ b/spec/features/container_registry_spec.rb @@ -19,7 +19,7 @@ describe "Container Registry", :js do it 'user visits container registry main page' do visit_container_registry - expect(page).to have_content 'No container images' + expect(page).to have_content 'no container images' end end diff --git a/spec/features/groups/issues_spec.rb b/spec/features/groups/issues_spec.rb index c000165ccd9..0ada530781c 100644 --- a/spec/features/groups/issues_spec.rb +++ b/spec/features/groups/issues_spec.rb @@ -150,6 +150,25 @@ describe 'Group issues page' do check_issue_order end + it 'issues should not be draggable when user is not logged in', :js do + sign_out(user_in_group) + + visit issues_group_path(group, sort: 'relative_position') + + drag_to(selector: '.manual-ordering', + from_index: 0, + to_index: 2) + + wait_for_requests + + # Issue order should remain the same + page.within('.manual-ordering') do + expect(find('.issue:nth-child(1) .title')).to have_content('Issue #1') + expect(find('.issue:nth-child(2) .title')).to have_content('Issue #2') + expect(find('.issue:nth-child(3) .title')).to have_content('Issue #3') + end + end + def check_issue_order page.within('.manual-ordering') do expect(find('.issue:nth-child(1) .title')).to have_content('Issue #2') diff --git a/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb b/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb index b20730bdb22..d56568a7a9d 100644 --- a/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb +++ b/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb @@ -54,7 +54,7 @@ describe 'Resolve an open discussion in a merge request by creating an issue', : context 'creating the issue' do before do - find(resolve_discussion_selector).click + find(resolve_discussion_selector, match: :first).click end it 'has a hidden field for the discussion' do diff --git a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb index 08fa4a98feb..f3de4bb596f 100644 --- a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb +++ b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb @@ -362,14 +362,14 @@ describe 'Merge request > User resolves diff notes and discussions', :js do end end - it 'shows jump to next discussion button except on last discussion' do + it 'shows jump to next discussion button on all discussions' do wait_for_requests all_discussion_replies = page.all('.discussion-reply-holder') expect(all_discussion_replies.count).to eq(2) - expect(all_discussion_replies.first.all('.discussion-next-btn').count).to eq(1) - expect(all_discussion_replies.last.all('.discussion-next-btn').count).to eq(0) + expect(all_discussion_replies.first.all('.discussion-next-btn').count).to eq(2) + expect(all_discussion_replies.last.all('.discussion-next-btn').count).to eq(2) end it 'displays next discussion even if hidden' do diff --git a/spec/features/projects/clusters/applications_spec.rb b/spec/features/projects/clusters/applications_spec.rb index 527508b3519..c75259d1b0c 100644 --- a/spec/features/projects/clusters/applications_spec.rb +++ b/spec/features/projects/clusters/applications_spec.rb @@ -21,8 +21,7 @@ describe 'Clusters Applications', :js do it 'user is unable to install applications' do page.within('.js-cluster-application-row-helm') do - expect(page.find(:css, '.js-cluster-application-install-button')['disabled']).to eq('true') - expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Install') + expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Install') end end end @@ -53,19 +52,16 @@ describe 'Clusters Applications', :js do it 'they see status transition' do page.within('.js-cluster-application-row-helm') do # FE sends request and gets the response, then the buttons is "Installing" - expect(page.find(:css, '.js-cluster-application-install-button')['disabled']).to eq('true') - expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Installing') + expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Installing') Clusters::Cluster.last.application_helm.make_installing! # FE starts polling and update the buttons to "Installing" - expect(page.find(:css, '.js-cluster-application-install-button')['disabled']).to eq('true') - expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Installing') + expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Installing') Clusters::Cluster.last.application_helm.make_installed! - expect(page.find(:css, '.js-cluster-application-install-button')['disabled']).to eq('true') - expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Installed') + expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Installed') end expect(page).to have_content('Helm Tiller was successfully installed on your Kubernetes cluster') @@ -212,26 +208,25 @@ describe 'Clusters Applications', :js do it 'they see status transition' do page.within('.js-cluster-application-row-ingress') do # FE sends request and gets the response, then the buttons is "Installing" - expect(page).to have_css('.js-cluster-application-install-button[disabled]') - expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Installing') + expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Installing') Clusters::Cluster.last.application_ingress.make_installing! # FE starts polling and update the buttons to "Installing" - expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Installing') - expect(page).to have_css('.js-cluster-application-install-button[disabled]') + expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Installing') # The application becomes installed but we keep waiting for external IP address Clusters::Cluster.last.application_ingress.make_installed! - expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Installed') - expect(page).to have_css('.js-cluster-application-install-button[disabled]') + expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Installed') expect(page).to have_selector('.js-no-endpoint-message') expect(page).to have_selector('.js-ingress-ip-loading-icon') # We receive the external IP address and display Clusters::Cluster.last.application_ingress.update!(external_ip: '192.168.1.100') + expect(page).not_to have_css('.js-cluster-application-install-button') + expect(page).to have_css('.js-cluster-application-uninstall-button:not([disabled])', exact_text: 'Uninstall') expect(page).not_to have_selector('.js-no-endpoint-message') expect(page.find('.js-endpoint').value).to eq('192.168.1.100') end diff --git a/spec/features/projects/files/user_reads_pipeline_status_spec.rb b/spec/features/projects/files/user_reads_pipeline_status_spec.rb index ff0aa933a3e..5bce96d9b80 100644 --- a/spec/features/projects/files/user_reads_pipeline_status_spec.rb +++ b/spec/features/projects/files/user_reads_pipeline_status_spec.rb @@ -7,6 +7,8 @@ describe 'user reads pipeline status', :js do let(:x110_pipeline) { create_pipeline('x1.1.0', 'failed') } before do + stub_feature_flags(vue_file_list: false) + project.add_maintainer(user) project.repository.add_tag(user, 'x1.1.0', 'v1.1.0') diff --git a/spec/features/projects/releases/user_views_releases_spec.rb b/spec/features/projects/releases/user_views_releases_spec.rb index 317ffb6a2ff..725d7173bce 100644 --- a/spec/features/projects/releases/user_views_releases_spec.rb +++ b/spec/features/projects/releases/user_views_releases_spec.rb @@ -16,6 +16,7 @@ describe 'User views releases', :js do expect(page).to have_content(release.name) expect(page).to have_content(release.tag) + expect(page).not_to have_content('Upcoming Release') end context 'when there is a link as an asset' do @@ -43,4 +44,15 @@ describe 'User views releases', :js do end end end + + context 'with an upcoming release' do + let(:tomorrow) { Time.zone.now + 1.day } + let!(:release) { create(:release, project: project, released_at: tomorrow ) } + + it 'sees the upcoming tag' do + visit project_releases_path(project) + + expect(page).to have_content('Upcoming Release') + end + end end diff --git a/spec/features/projects/services/user_activates_jira_spec.rb b/spec/features/projects/services/user_activates_jira_spec.rb index 08e1855d034..c52f38e2806 100644 --- a/spec/features/projects/services/user_activates_jira_spec.rb +++ b/spec/features/projects/services/user_activates_jira_spec.rb @@ -29,27 +29,27 @@ describe 'User activates Jira', :js do server_info = { key: 'value' }.to_json WebMock.stub_request(:get, test_url).with(basic_auth: %w(username password)).to_return(body: server_info) - click_link('JIRA') + click_link('Jira') fill_form click_button('Test settings and save changes') wait_for_requests end - it 'activates the JIRA service' do - expect(page).to have_content('JIRA activated.') + it 'activates the Jira service' do + expect(page).to have_content('Jira activated.') expect(current_path).to eq(project_settings_integrations_path(project)) end - it 'shows the JIRA link in the menu' do + it 'shows the Jira link in the menu' do page.within('.nav-sidebar') do - expect(page).to have_link('JIRA', href: url) + expect(page).to have_link('Jira', href: url) end end end context 'when Jira connection test fails' do it 'shows errors when some required fields are not filled in' do - click_link('JIRA') + click_link('Jira') check 'Active' fill_in 'service_password', with: 'password' @@ -60,11 +60,11 @@ describe 'User activates Jira', :js do end end - it 'activates the JIRA service' do + it 'activates the Jira service' do WebMock.stub_request(:get, test_url).with(basic_auth: %w(username password)) .to_raise(JIRA::HTTPError.new(double(message: 'message'))) - click_link('JIRA') + click_link('Jira') fill_form click_button('Test settings and save changes') wait_for_requests @@ -75,7 +75,7 @@ describe 'User activates Jira', :js do find('.flash-alert .flash-action').click wait_for_requests - expect(page).to have_content('JIRA activated.') + expect(page).to have_content('Jira activated.') expect(current_path).to eq(project_settings_integrations_path(project)) end end @@ -83,19 +83,19 @@ describe 'User activates Jira', :js do describe 'user sets Jira Service but keeps it disabled' do before do - click_link('JIRA') + click_link('Jira') fill_form(false) click_button('Save changes') end - it 'saves but does not activate the JIRA service' do - expect(page).to have_content('JIRA settings saved, but not activated.') + it 'saves but does not activate the Jira service' do + expect(page).to have_content('Jira settings saved, but not activated.') expect(current_path).to eq(project_settings_integrations_path(project)) end - it 'does not show the JIRA link in the menu' do + it 'does not show the Jira link in the menu' do page.within('.nav-sidebar') do - expect(page).not_to have_link('JIRA', href: url) + expect(page).not_to have_link('Jira', href: url) end end end diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index 8c7bc192c50..1edfee705c8 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -112,11 +112,17 @@ describe 'Projects > Settings > Repository settings' do it 'add a new deploy token' do fill_in 'deploy_token_name', with: 'new_deploy_key' fill_in 'deploy_token_expires_at', with: (Date.today + 1.month).to_s + fill_in 'deploy_token_username', with: 'deployer' check 'deploy_token_read_repository' check 'deploy_token_read_registry' click_button 'Create deploy token' expect(page).to have_content('Your new project deploy token has been created') + + within('.created-deploy-token-container') do + expect(page).to have_selector("input[name='deploy-token-user'][value='deployer']") + expect(page).to have_selector("input[name='deploy-token'][readonly='readonly']") + end end end diff --git a/spec/features/projects/show/user_sees_last_commit_ci_status_spec.rb b/spec/features/projects/show/user_sees_last_commit_ci_status_spec.rb index e277bfb8011..89ce4b50781 100644 --- a/spec/features/projects/show/user_sees_last_commit_ci_status_spec.rb +++ b/spec/features/projects/show/user_sees_last_commit_ci_status_spec.rb @@ -3,6 +3,10 @@ require 'spec_helper' describe 'Projects > Show > User sees last commit CI status' do set(:project) { create(:project, :repository, :public) } + before do + stub_feature_flags(vue_file_list: false) + end + it 'shows the project README', :js do project.enable_ci pipeline = create(:ci_pipeline, project: project, sha: project.commit.sha, ref: 'master') diff --git a/spec/features/users/terms_spec.rb b/spec/features/users/terms_spec.rb index 84df1016594..a770309e6b0 100644 --- a/spec/features/users/terms_spec.rb +++ b/spec/features/users/terms_spec.rb @@ -81,15 +81,18 @@ describe 'Users > Terms' do enforce_terms - within('.nav-sidebar') do - click_link 'Issues' - end + # Application settings are cached for a minute + Timecop.travel 2.minutes do + within('.nav-sidebar') do + click_link 'Issues' + end - expect_to_be_on_terms_page + expect_to_be_on_terms_page - click_button('Accept terms') + click_button('Accept terms') - expect(current_path).to eq(project_issues_path(project)) + expect(current_path).to eq(project_issues_path(project)) + end end # Disabled until https://gitlab.com/gitlab-org/gitlab-ce/issues/37162 is solved properly |