diff options
Diffstat (limited to 'spec/features/projects/clusters')
-rw-r--r-- | spec/features/projects/clusters/eks_spec.rb | 36 | ||||
-rw-r--r-- | spec/features/projects/clusters/gcp_spec.rb | 95 |
2 files changed, 1 insertions, 130 deletions
diff --git a/spec/features/projects/clusters/eks_spec.rb b/spec/features/projects/clusters/eks_spec.rb deleted file mode 100644 index 7e599ff1198..00000000000 --- a/spec/features/projects/clusters/eks_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'AWS EKS Cluster', :js do - let(:project) { create(:project) } - let(:user) { create(:user) } - - before do - project.add_maintainer(user) - gitlab_sign_in(user) - allow(Projects::ClustersController).to receive(:STATUS_POLLING_INTERVAL) { 100 } - stub_application_setting(eks_integration_enabled: true) - end - - context 'when user does not have a cluster and visits cluster index page' do - let(:project_id) { 'test-project-1234' } - - before do - visit project_clusters_path(project) - - click_button(class: 'dropdown-toggle-split') - click_link 'Create a cluster (certificate - deprecated)' - end - - context 'when user creates a cluster on AWS EKS' do - before do - click_link 'Amazon EKS' - end - - it 'highlights Amazon EKS logo' do - expect(page).to have_css('.js-create-aws-cluster-button.active') - end - end - end -end diff --git a/spec/features/projects/clusters/gcp_spec.rb b/spec/features/projects/clusters/gcp_spec.rb index 491121a3743..a8a23ba1c85 100644 --- a/spec/features/projects/clusters/gcp_spec.rb +++ b/spec/features/projects/clusters/gcp_spec.rb @@ -14,11 +14,6 @@ RSpec.describe 'Gcp Cluster', :js do allow(Projects::ClustersController).to receive(:STATUS_POLLING_INTERVAL) { 100 } end - def submit_form - execute_script('document.querySelector(".js-gke-cluster-creation-submit").removeAttribute("disabled")') - execute_script('document.querySelector(".js-gke-cluster-creation-submit").click()') - end - context 'when user has signed with Google' do let(:project_id) { 'test-project-1234' } @@ -29,82 +24,7 @@ RSpec.describe 'Gcp Cluster', :js do .to receive(:expires_at_in_session).and_return(1.hour.since.to_i.to_s) end - context 'when user does not have a cluster and visits cluster index page' do - before do - visit project_clusters_path(project) - - visit_create_cluster_page - click_link 'Google GKE' - end - - it 'highlights Google GKE logo' do - expect(page).to have_css('.js-create-gcp-cluster-button.active') - end - - context 'when user filled form with valid parameters' do - subject { submit_form } - - before do - allow_any_instance_of(GoogleApi::CloudPlatform::Client) - .to receive(:projects_zones_clusters_create) do - double( - 'cluster', - self_link: 'projects/gcp-project-12345/zones/us-central1-a/operations/ope-123', - status: 'RUNNING' - ) - end - - allow(WaitForClusterCreationWorker).to receive(:perform_in).and_return(nil) - - expect(page).to have_css('.js-gcp-project-id-dropdown') - - execute_script('document.querySelector(".js-gcp-project-id-dropdown input").setAttribute("type", "text")') - execute_script('document.querySelector(".js-gcp-zone-dropdown input").setAttribute("type", "text")') - execute_script('document.querySelector(".js-gcp-machine-type-dropdown input").setAttribute("type", "text")') - - fill_in 'cluster[name]', with: 'dev-cluster' - fill_in 'cluster[provider_gcp_attributes][gcp_project_id]', with: 'gcp-project-123' - fill_in 'cluster[provider_gcp_attributes][zone]', with: 'us-central1-a' - fill_in 'cluster[provider_gcp_attributes][machine_type]', with: 'n1-standard-2' - end - - it 'users sees a form with the GCP token' do - expect(page).to have_selector(:css, 'form[data-token="token"]') - end - - it 'user sees a cluster details page and creation status' do - subject - - expect(page).to have_content('Kubernetes cluster is being created...') - - Clusters::Cluster.last.provider.make_created! - - expect(page).to have_content('Kubernetes cluster was successfully created') - end - - it 'user sees a error if something wrong during creation' do - subject - - expect(page).to have_content('Kubernetes cluster is being created...') - - Clusters::Cluster.last.provider.make_errored!('Something wrong!') - - expect(page).to have_content('Something wrong!') - end - end - - context 'when user filled form with invalid parameters' do - before do - submit_form - end - - it 'user sees a validation error' do - expect(page).to have_css('.gl-field-error') - end - end - end - - context 'when user does have a cluster and visits cluster page' do + context 'when user have a cluster and visits cluster page' do let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } before do @@ -167,12 +87,6 @@ RSpec.describe 'Gcp Cluster', :js do it 'user sees offer on cluster index page' do expect(page).to have_css('.gcp-signup-offer') end - - it 'user sees offer on cluster create page' do - visit_create_cluster_page - - expect(page).to have_css('.gcp-signup-offer') - end end context 'when user has dismissed GCP signup offer' do @@ -187,8 +101,6 @@ RSpec.describe 'Gcp Cluster', :js do find('.gcp-signup-offer .js-close').click wait_for_requests - visit_create_cluster_page - expect(page).not_to have_css('.gcp-signup-offer') end end @@ -216,9 +128,4 @@ RSpec.describe 'Gcp Cluster', :js do expect(page).not_to have_css('.gcp-signup-offer') end end - - def visit_create_cluster_page - click_button(class: 'dropdown-toggle-split') - click_link 'Create a cluster (certificate - deprecated)' - end end |