diff options
Diffstat (limited to 'qa/qa/specs/features/browser_ui')
20 files changed, 463 insertions, 117 deletions
diff --git a/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb index 5f7a6981f23..0a577aa07f8 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb @@ -3,6 +3,8 @@ module QA context 'Plan', :orchestrated, :smtp do describe 'Email Notification' do + include Support::Api + let(:user) do Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) end diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb index 2cb6a76b6b3..7b4418191a3 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb @@ -17,7 +17,7 @@ module QA end end - context 'when using attachments in comments', :object_storage, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/issues/205408', type: :bug } do + context 'when using attachments in comments', :object_storage do let(:gif_file_name) { 'banana_sample.gif' } let(:file_to_attach) do File.absolute_path(File.join('spec', 'fixtures', gif_file_name)) diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue_boards/focus_mode_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue_boards/focus_mode_spec.rb new file mode 100644 index 00000000000..409c7d321f0 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/2_plan/issue_boards/focus_mode_spec.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module QA + context 'Plan', :reliable do + describe 'Issue board focus mode' do + let(:project) do + QA::Resource::Project.fabricate_via_api! do |project| + project.name = 'sample-project-issue-board-focus-mode' + end + end + + before do + Flow::Login.sign_in + end + + it 'focuses on issue board' do + project.visit! + + Page::Project::Menu.perform(&:go_to_boards) + EE::Page::Component::IssueBoard::Show.perform do |show| + show.click_focus_mode_button + + expect(show.focused_board).to be_visible + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/design_management/add_design_add_annotation.rb b/qa/qa/specs/features/browser_ui/3_create/design_management/add_design_add_annotation.rb new file mode 100644 index 00000000000..b50edcfcf08 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/design_management/add_design_add_annotation.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module QA + context 'Create' do + describe 'Design management' do + let(:issue) { Resource::Issue.fabricate_via_api! } + let(:design_filename) { 'banana_sample.gif' } + let(:design) { File.absolute_path(File.join('spec', 'fixtures', design_filename)) } + let(:annotation) { "This design is great!" } + + before do + Flow::Login.sign_in + end + + it 'user adds a design and annotation' do + issue.visit! + + Page::Project::Issue::Show.perform do |show| + show.click_designs_tab + show.add_design(design) + show.click_design(design_filename) + show.add_annotation(annotation) + + expect(show).to have_annotation(annotation) + + show.click_discussion_tab + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/gitaly/high_availability_spec.rb b/qa/qa/specs/features/browser_ui/3_create/gitaly/high_availability_spec.rb new file mode 100644 index 00000000000..3bb03f68d51 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/gitaly/high_availability_spec.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +module QA + context 'Create' do + context 'Gitaly' do + describe 'High Availability', :orchestrated, :gitaly_ha do + let(:project) do + Resource::Project.fabricate! do |project| + project.name = 'gitaly_high_availability' + end + end + let(:initial_file) { 'pushed_to_primary.txt' } + let(:final_file) { 'pushed_to_secondary.txt' } + + before do + @praefect_manager = Service::PraefectManager.new + Flow::Login.sign_in + end + + after do + @praefect_manager.reset + end + + it 'makes sure that automatic failover is happening' do + Resource::Repository::ProjectPush.fabricate! do |push| + push.project = project + push.commit_message = 'pushed to primary gitaly node' + push.new_branch = true + push.file_name = initial_file + push.file_content = "This should exist on both nodes" + end + + @praefect_manager.stop_primary_node + + project.visit! + + Page::Project::Show.perform do |show| + show.wait_until do + show.has_name?(project.name) + end + expect(show).to have_file(initial_file) + end + + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.add_files([ + { + file_path: 'committed_to_primary.txt', + content: 'This should exist on both nodes too' + } + ]) + end + + project.visit! + + Page::Project::Show.perform do |show| + expect(show).to have_file(final_file) + end + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb index 7d4e6b7efbc..3964ae7eada 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb @@ -10,6 +10,8 @@ module QA merge_request.fork_branch = 'feature-branch' end + merge_request.project.api_put(auto_devops_enabled: false) + Page::Main::Menu.perform(&:sign_out) Page::Main::Login.perform(&:sign_in_using_credentials) diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb index 25866e12185..68bbc1719fc 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb @@ -12,7 +12,7 @@ module QA resource.title = key_title end - expect(page).to have_content("Title: #{key_title}") + expect(page).to have_content(key.title) expect(page).to have_content(key.md5_fingerprint) Page::Main::Menu.perform(&:click_settings_link) diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/move_project_create_fork_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/move_project_create_fork_spec.rb index 13fe8918f97..d0123da53bb 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/move_project_create_fork_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/move_project_create_fork_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'Gitaly repository storage', :orchestrated, :repository_storage, :requires_admin, quarantine: { type: :new } do + context 'Create', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/217002', type: :investigating } do + describe 'Gitaly repository storage', :orchestrated, :repository_storage, :requires_admin do let(:user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) } let(:parent_project) do Resource::Project.fabricate_via_api! do |project| diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb index 9bc4dcbca2a..9b504ad76b4 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb @@ -3,6 +3,8 @@ module QA context 'Create', :requires_admin do describe 'push after setting the file size limit via admin/application_settings' do + include Support::Api + before(:context) do @project = Resource::Project.fabricate_via_api! do |p| p.name = 'project-test-push-limit' @@ -39,12 +41,10 @@ module QA def set_file_size_limit(limit) request = Runtime::API::Request.new(@api_client, '/application/settings') - put request.url, receive_max_input_size: limit + response = put request.url, receive_max_input_size: limit - expect_status(200) - expect(json_body).to match( - a_hash_including(receive_max_input_size: limit) - ) + expect(response.code).to eq(200) + expect(parse_body(response)[:receive_max_input_size]).to eq(limit) end def push_new_file(file_name, wait_for_push: true) diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb new file mode 100644 index 00000000000..341ff39fdf1 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb @@ -0,0 +1,102 @@ +# frozen_string_literal: true + +module QA + context 'Create' do + describe 'Version control for personal snippets' do + let(:new_file) { 'new_snippet_file' } + let(:changed_content) { 'changes' } + let(:commit_message) { 'Changes to snippets' } + let(:added_content) { 'updated ' } + let(:branch_name) { 'master' } + + let(:snippet) do + Resource::Snippet.fabricate! do |snippet| + snippet.file_name = new_file + end + end + + let(:ssh_key) do + Resource::SSHKey.fabricate_via_api! do |resource| + resource.title = "my key title #{Time.now.to_f}" + end + end + + let(:repository_uri_http) do + snippet + Page::Dashboard::Snippet::Show.perform(&:get_repository_uri_http) + end + + let(:repository_uri_ssh) do + ssh_key + snippet + Page::Dashboard::Snippet::Show.perform(&:get_repository_uri_ssh) + end + + before do + Flow::Login.sign_in + end + + it 'clones, pushes, and pulls a snippet over HTTP, edits via UI' do + Resource::Repository::Push.fabricate! do |push| + push.repository_http_uri = repository_uri_http + push.file_name = new_file + push.file_content = changed_content + push.commit_message = commit_message + push.new_branch = false + end + + page.refresh + verify_changes_in_ui + + Page::Dashboard::Snippet::Show.perform(&:click_edit_button) + + Page::Dashboard::Snippet::Edit.perform do |snippet| + snippet.add_to_file_content(added_content) + snippet.save_changes + end + + Git::Repository.perform do |repository| + repository.init_repository + repository.pull(repository_uri_http, branch_name) + + expect(repository.commits.size).to eq(3) + expect(repository.commits.first).to include('Update snippet') + expect(repository.file_content(new_file)).to include("#{added_content}#{changed_content}") + end + end + + it 'clones, pushes, and pulls a snippet over SSH, deletes via UI' do + Resource::Repository::Push.fabricate! do |push| + push.repository_ssh_uri = repository_uri_ssh + push.ssh_key = ssh_key + push.file_name = new_file + push.file_content = changed_content + push.commit_message = commit_message + push.new_branch = false + end + + page.refresh + verify_changes_in_ui + + Page::Dashboard::Snippet::Show.perform(&:click_delete_button) + + # attempt to pull a deleted snippet, get a missing repository error + Git::Repository.perform do |repository| + repository.uri = repository_uri_ssh + repository.use_ssh_key(ssh_key) + repository.init_repository + + expect { repository.pull(repository_uri_ssh, branch_name) } + .to raise_error(QA::Git::Repository::RepositoryCommandError, /[fatal: Could not read from remote repository.]+/) + end + end + + def verify_changes_in_ui + Page::Dashboard::Snippet::Show.perform do |snippet| + expect(snippet).to have_file_name(new_file) + expect(snippet).to have_file_content(changed_content) + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_snippet_spec.rb index d38b8560a38..dfcbf4b44c8 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_snippet_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create', :smoke, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/215031', type: :investigating } do + context 'Create', :smoke do describe 'Snippet creation' do it 'User creates a snippet' do Flow::Login.sign_in diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb index 8ea1534492c..ed988bdf046 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create', quarantine: { type: :new } do + context 'Create' do describe 'Review a merge request in Web IDE' do let(:new_file) { 'awesome_new_file.txt' } let(:original_text) { 'Text' } diff --git a/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb index 2550ee7193b..f8a589ad93b 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb @@ -7,6 +7,7 @@ module QA let!(:runner) do Resource::Runner.fabricate! do |runner| runner.name = executor + runner.tags = ['e2e-test'] end end diff --git a/qa/qa/specs/features/browser_ui/4_verify/testing/view_code_coverage_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/testing/view_code_coverage_spec.rb new file mode 100644 index 00000000000..4d549dde858 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/4_verify/testing/view_code_coverage_spec.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +module QA + context 'Verify', :docker, :runner do + describe 'Code coverage statistics' do + let(:simplecov) { '\(\d+.\d+\%\) covered' } + let(:executor) { "qa-runner-#{Time.now.to_i}" } + let(:runner) do + Resource::Runner.fabricate_via_api! do |runner| + runner.name = executor + runner.tags = ['e2e-test'] + end + end + + let(:merge_request) do + Resource::MergeRequest.fabricate_via_api! do |mr| + mr.project = runner.project + mr.file_name = '.gitlab-ci.yml' + mr.file_content = <<~EOF + test: + tags: [e2e-test] + script: + - echo '(66.67%) covered' + EOF + end + end + + before do + Flow::Login.sign_in + end + + after do + runner.remove_via_api! + end + + it 'creates an MR with code coverage statistics' do + runner.project.visit! + configure_code_coverage(simplecov) + merge_request.visit! + + Page::MergeRequest::Show.perform do |mr_widget| + Support::Retrier.retry_until(max_attempts: 5, sleep_interval: 5) do + mr_widget.has_pipeline_status?(/Pipeline #\d+ passed/) + end + expect(mr_widget).to have_content('Coverage 66.67%') + end + end + end + + private + + def configure_code_coverage(coverage_tool_pattern) + Page::Project::Menu.perform(&:go_to_ci_cd_settings) + Page::Project::Settings::CICD.perform do |settings| + settings.expand_general_pipelines do |coverage| + coverage.configure_coverage_regex(coverage_tool_pattern) + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb index e71212bcb68..b1eb26f0d63 100644 --- a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Release', :docker, quarantine: { type: :new } do + context 'Release', :docker, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/217250', type: :investigating } do describe 'Parent-child pipelines dependent relationship' do let!(:project) do Resource::Project.fabricate_via_api! do |project| diff --git a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb index 633af9c2e8a..c9a61fc6305 100644 --- a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Release', :docker, quarantine: { type: :new } do + context 'Release', :docker, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/217250', type: :investigating } do describe 'Parent-child pipelines independent relationship' do let!(:project) do Resource::Project.fabricate_via_api! do |project| diff --git a/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb b/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb index 0a52b01af03..292fc40bec4 100644 --- a/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb +++ b/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb @@ -35,7 +35,7 @@ module QA end # Connect K8s cluster - Resource::KubernetesCluster.fabricate! do |k8s_cluster| + Resource::KubernetesCluster::ProjectCluster.fabricate! do |k8s_cluster| k8s_cluster.project = project k8s_cluster.cluster = cluster k8s_cluster.install_helm_tiller = true diff --git a/qa/qa/specs/features/browser_ui/7_configure/kubernetes/kubernetes_integration_spec.rb b/qa/qa/specs/features/browser_ui/7_configure/kubernetes/kubernetes_integration_spec.rb index 9a52109c8cb..04c68598239 100644 --- a/qa/qa/specs/features/browser_ui/7_configure/kubernetes/kubernetes_integration_spec.rb +++ b/qa/qa/specs/features/browser_ui/7_configure/kubernetes/kubernetes_integration_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true module QA - context 'Configure' do - describe 'Kubernetes Cluster Integration', :orchestrated, :kubernetes, :requires_admin, quarantine: { type: :new } do + context 'Configure', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/209085', type: :investigating } do + describe 'Kubernetes Cluster Integration', :orchestrated, :kubernetes, :requires_admin do context 'Project Clusters' do let(:cluster) { Service::KubernetesCluster.new(provider_class: Service::ClusterProvider::K3s).create! } let(:project) do @@ -21,12 +21,10 @@ module QA end it 'can create and associate a project cluster', :smoke do - Resource::KubernetesCluster.fabricate_via_browser_ui! do |k8s_cluster| + Resource::KubernetesCluster::ProjectCluster.fabricate_via_browser_ui! do |k8s_cluster| k8s_cluster.project = project k8s_cluster.cluster = cluster - end - - project.visit! + end.project.visit! Page::Project::Menu.perform(&:go_to_operations_kubernetes) diff --git a/qa/qa/specs/features/browser_ui/8_monitor/all_monitor_core_features_spec.rb b/qa/qa/specs/features/browser_ui/8_monitor/all_monitor_core_features_spec.rb new file mode 100644 index 00000000000..45273655bb6 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/8_monitor/all_monitor_core_features_spec.rb @@ -0,0 +1,155 @@ +# frozen_string_literal: true + +module QA + context 'Monitor', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/217705', type: :flaky } do + describe 'with Prometheus Gitlab-managed cluster', :orchestrated, :kubernetes, :docker, :runner do + before :all do + Flow::Login.sign_in + @project, @runner = deploy_project_with_prometheus + end + + before do + Flow::Login.sign_in_unless_signed_in + @project.visit! + end + + after :all do + @runner.remove_via_api! + @cluster.remove! + end + + it 'configures custom metrics' do + verify_add_custom_metric + verify_edit_custom_metric + verify_delete_custom_metric + end + + it 'duplicates to create dashboard to custom' do + Page::Project::Menu.perform(&:go_to_operations_metrics) + + Page::Project::Operations::Metrics::Show.perform do |dashboard| + dashboard.duplicate_dashboard + + expect(dashboard).to have_metrics + expect(dashboard).to have_edit_dashboard_enabled + end + end + + it 'verifies data on filtered deployed environment' do + Page::Project::Menu.perform(&:go_to_operations_metrics) + + Page::Project::Operations::Metrics::Show.perform do |dashboard| + dashboard.filter_environment + + expect(dashboard).to have_metrics + end + end + + it 'filters using the quick range' do + Page::Project::Menu.perform(&:go_to_operations_metrics) + + Page::Project::Operations::Metrics::Show.perform do |dashboard| + dashboard.show_last('30 minutes') + expect(dashboard).to have_metrics + + dashboard.show_last('3 hours') + expect(dashboard).to have_metrics + + dashboard.show_last('1 day') + expect(dashboard).to have_metrics + end + end + + private + + def deploy_project_with_prometheus + project = Resource::Project.fabricate_via_api! do |project| + project.name = 'cluster-with-prometheus' + project.description = 'Cluster with Prometheus' + end + + runner = Resource::Runner.fabricate_via_api! do |runner| + runner.project = project + runner.name = project.name + end + + @cluster = Service::KubernetesCluster.new.create! + + cluster_props = Resource::KubernetesCluster::ProjectCluster.fabricate! do |cluster_settings| + cluster_settings.project = project + cluster_settings.cluster = @cluster + cluster_settings.install_helm_tiller = true + cluster_settings.install_ingress = true + cluster_settings.install_prometheus = true + end + + Resource::CiVariable.fabricate_via_api! do |ci_variable| + ci_variable.project = project + ci_variable.key = 'AUTO_DEVOPS_DOMAIN' + ci_variable.value = cluster_props.ingress_ip + ci_variable.masked = false + end + + Resource::Repository::ProjectPush.fabricate! do |push| + push.project = project + push.directory = Pathname + .new(__dir__) + .join('../../../../fixtures/monitored_auto_devops') + push.commit_message = 'Create AutoDevOps compatible Project for Monitoring' + end + + Page::Project::Menu.perform(&:click_ci_cd_pipelines) + Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_success_or_retry) + + [project, runner] + end + + def verify_add_custom_metric + Page::Project::Menu.perform(&:go_to_integrations_settings) + Page::Project::Settings::Integrations.perform(&:click_on_prometheus_integration) + + Page::Project::Settings::Services::Prometheus.perform do |metrics_panel| + metrics_panel.click_on_new_metric + metrics_panel.add_custom_metric + end + + Page::Project::Menu.perform(&:go_to_operations_metrics) + + Page::Project::Operations::Metrics::Show.perform do |dashboard| + expect(dashboard).to have_custom_metric('HTTP Requests Total') + end + end + + def verify_edit_custom_metric + Page::Project::Menu.perform(&:go_to_integrations_settings) + Page::Project::Settings::Integrations.perform(&:click_on_prometheus_integration) + Page::Project::Settings::Services::Prometheus.perform do |metrics_panel| + metrics_panel.click_on_custom_metric('Business / HTTP Requests Total (req/sec)') + metrics_panel.edit_custom_metric + end + + Page::Project::Menu.perform(&:go_to_operations_metrics) + + Page::Project::Operations::Metrics::Show.perform do |dashboard| + expect(dashboard).to have_custom_metric('Throughput') + end + end + + def verify_delete_custom_metric + Page::Project::Menu.perform(&:go_to_integrations_settings) + Page::Project::Settings::Integrations.perform(&:click_on_prometheus_integration) + + Page::Project::Settings::Services::Prometheus.perform do |metrics_panel| + metrics_panel.click_on_custom_metric('Business / Throughput (req/sec)') + metrics_panel.delete_custom_metric + end + + Page::Project::Menu.perform(&:go_to_operations_metrics) + + Page::Project::Operations::Metrics::Show.perform do |dashboard| + expect(dashboard).not_to have_custom_metric('Throughput') + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/8_monitor/apm/dashboards_spec.rb b/qa/qa/specs/features/browser_ui/8_monitor/apm/dashboards_spec.rb deleted file mode 100644 index f7463c69db1..00000000000 --- a/qa/qa/specs/features/browser_ui/8_monitor/apm/dashboards_spec.rb +++ /dev/null @@ -1,97 +0,0 @@ -# frozen_string_literal: true - -module QA - context 'Monitor' do - describe 'Dashboards', :orchestrated, :kubernetes, quarantine: { type: :new } do - before(:all) do - @cluster = Service::KubernetesCluster.new.create! - Flow::Login.sign_in - create_project_to_monitor - wait_for_deployment - end - - before do - Flow::Login.sign_in_unless_signed_in - @project.visit! - end - - after(:all) do - @cluster&.remove! - end - - it 'duplicates to create dashboard to custom' do - Page::Project::Menu.perform(&:go_to_operations_metrics) - - Page::Project::Operations::Metrics::Show.perform do |dashboard| - dashboard.duplicate_dashboard - - expect(dashboard).to have_metrics - expect(dashboard).to have_edit_dashboard_enabled - end - end - - it 'verifies data on filtered deployed environment' do - Page::Project::Menu.perform(&:go_to_operations_metrics) - - Page::Project::Operations::Metrics::Show.perform do |dashboard| - dashboard.filter_environment - - expect(dashboard).to have_metrics - end - end - - it 'filters using the quick range' do - Page::Project::Menu.perform(&:go_to_operations_metrics) - - Page::Project::Operations::Metrics::Show.perform do |dashboard| - dashboard.show_last('30 minutes') - expect(dashboard).to have_metrics - - dashboard.show_last('3 hours') - expect(dashboard).to have_metrics - - dashboard.show_last('1 day') - expect(dashboard).to have_metrics - end - end - - private - - def wait_for_deployment - Page::Project::Menu.perform(&:click_ci_cd_pipelines) - Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_success_or_retry) - Page::Project::Menu.perform(&:go_to_operations_metrics) - end - - def create_project_to_monitor - @project = Resource::Project.fabricate_via_api! do |project| - project.name = 'cluster-with-prometheus' - project.description = 'Cluster with Prometheus' - end - - @cluster_props = Resource::KubernetesCluster.fabricate_via_browser_ui! do |cluster_settings| - cluster_settings.project = @project - cluster_settings.cluster = @cluster - cluster_settings.install_helm_tiller = true - cluster_settings.install_ingress = true - cluster_settings.install_prometheus = true - end - - Resource::CiVariable.fabricate_via_api! do |ci_variable| - ci_variable.project = @project - ci_variable.key = 'AUTO_DEVOPS_DOMAIN' - ci_variable.value = @cluster_props.ingress_ip - ci_variable.masked = false - end - - Resource::Repository::ProjectPush.fabricate! do |push| - push.project = @project - push.directory = Pathname - .new(__dir__) - .join('../../../../../fixtures/monitored_auto_devops') - push.commit_message = 'Create AutoDevOps compatible Project for Monitoring' - end - end - end - end -end |