diff options
Diffstat (limited to 'qa/qa/specs')
18 files changed, 592 insertions, 110 deletions
diff --git a/qa/qa/specs/features/api/3_create/repository/changing_repository_storage_spec.rb b/qa/qa/specs/features/api/3_create/repository/changing_repository_storage_spec.rb new file mode 100644 index 00000000000..d5ab6a3544d --- /dev/null +++ b/qa/qa/specs/features/api/3_create/repository/changing_repository_storage_spec.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +module QA + context 'Create' do + describe 'Changing Gitaly repository storage', :orchestrated, :requires_admin do + shared_examples 'repository storage move' do + it 'confirms a `finished` status after moving project repository storage' do + expect(project).to have_file('README.md') + + project.change_repository_storage(destination_storage) + + expect(Runtime::API::RepositoryStorageMoves).to have_status(project, 'finished', destination_storage) + + Resource::Repository::ProjectPush.fabricate! do |push| + push.project = project + push.file_name = 'new_file' + push.file_content = '# This is a new file' + push.commit_message = 'Add new file' + push.new_branch = false + end + + expect(project).to have_file('README.md') + expect(project).to have_file('new_file') + end + end + + context 'when moving from one Gitaly storage to another', :repository_storage do + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'repo-storage-move-status' + project.initialize_with_readme = true + end + end + let(:destination_storage) { QA::Runtime::Env.additional_repository_storage } + + it_behaves_like 'repository storage move' + end + + context 'when moving from Gitaly to Gitaly Cluster', :requires_praefect do + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'repo-storage-move' + project.initialize_with_readme = true + project.repository_storage = 'gitaly' + end + end + let(:destination_storage) { QA::Runtime::Env.praefect_repository_storage } + + it_behaves_like 'repository storage move' + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb index e30afbf8ae0..67055537567 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb @@ -12,8 +12,8 @@ module QA project.name = 'add-member-project' end.visit! - Page::Project::Menu.perform(&:go_to_members_settings) - Page::Project::Settings::Members.perform do |members| + Page::Project::Menu.perform(&:click_members) + Page::Project::Members.perform do |members| members.add_member(user.username) 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 7b4418191a3..57b0859856e 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 @@ -3,6 +3,8 @@ module QA context 'Plan', :smoke do describe 'Issue creation' do + let(:closed_issue) { Resource::Issue.fabricate_via_api! } + before do Flow::Login.sign_in end @@ -17,6 +19,25 @@ module QA end end + it 'closes an issue' do + closed_issue.visit! + + Page::Project::Issue::Show.perform do |issue_page| + issue_page.click_close_issue_button + + expect(issue_page).to have_element(:reopen_issue_button) + end + + Page::Project::Menu.perform(&:click_issues) + Page::Project::Issue::Index.perform do |index| + expect(index).not_to have_issue(closed_issue) + + index.click_closed_issues_link + + expect(index).to have_issue(closed_issue) + end + end + context 'when using attachments in comments', :object_storage do let(:gif_file_name) { 'banana_sample.gif' } let(:file_to_attach) do diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/issue_suggestions_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/issue_suggestions_spec.rb index 9b46a066c8e..623573a1397 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/issue_suggestions_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/issue_suggestions_spec.rb @@ -16,10 +16,10 @@ module QA it 'shows issue suggestions when creating a new issue' do Page::Project::Show.perform(&:go_to_new_issue) Page::Project::Issue::New.perform do |new_page| - new_page.add_title("issue") + new_page.fill_title("issue") expect(new_page).to have_content(issue_title) - new_page.add_title("Issue Board") + new_page.fill_title("Issue Board") expect(new_page).not_to have_content(issue_title) end end 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 index 409c7d321f0..c81a6f9281c 100644 --- 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 @@ -17,7 +17,7 @@ module QA project.visit! Page::Project::Menu.perform(&:go_to_boards) - EE::Page::Component::IssueBoard::Show.perform do |show| + Page::Component::IssueBoard::Show.perform do |show| show.click_focus_mode_button expect(show.focused_board).to be_visible diff --git a/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb b/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb new file mode 100644 index 00000000000..05a932fd53e --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb @@ -0,0 +1,105 @@ +# frozen_string_literal: true + +module QA + context 'Create' do + include Support::Api + + describe 'Jira integration', :jira, :orchestrated, :requires_admin do + let(:jira_project_key) { 'JITP' } + + before(:all) do + page.visit Vendor::Jira::JiraAPI.perform(&:base_url) + + QA::Support::Retrier.retry_until(sleep_interval: 3, reload_page: page, max_attempts: 20, raise_on_failure: true) do + page.has_text? 'Welcome to Jira' + end + + @project = Resource::Project.fabricate_via_api! do |project| + project.name = "project_with_jira_integration" + end + + # Retry is required because allow_local_requests_from_web_hooks_and_services + # takes some time to get enabled. + # Bug issue: https://gitlab.com/gitlab-org/gitlab/-/issues/217010 + QA::Support::Retrier.retry_on_exception(max_attempts: 5, sleep_interval: 3) do + Runtime::ApplicationSettings.set_application_settings(allow_local_requests_from_web_hooks_and_services: true) + + page.visit Runtime::Scenario.gitlab_address + Flow::Login.sign_in_unless_signed_in + + @project.visit! + + Page::Project::Menu.perform(&:go_to_integrations_settings) + QA::Page::Project::Settings::Integrations.perform(&:click_jira_link) + + QA::Page::Project::Settings::Services::Jira.perform do |jira| + jira.setup_service_with(url: Vendor::Jira::JiraAPI.perform(&:base_url)) + end + + expect(page).not_to have_text("Requests to the local network are not allowed") + end + end + + it 'closes an issue via pushing a commit' do + issue_key = Vendor::Jira::JiraAPI.perform do |jira_api| + jira_api.create_issue(jira_project_key) + end + + push_commit("Closes #{issue_key}") + + expect_issue_done(issue_key) + end + + it 'closes an issue via a merge request' do + issue_key = Vendor::Jira::JiraAPI.perform do |jira_api| + jira_api.create_issue(jira_project_key) + end + + page.visit Runtime::Scenario.gitlab_address + Flow::Login.sign_in_unless_signed_in + + merge_request = create_mr_with_description("Closes #{issue_key}") + + merge_request.visit! + + Page::MergeRequest::Show.perform(&:merge!) + + expect_issue_done(issue_key) + end + + def create_mr_with_description(description) + Resource::MergeRequest.fabricate! do |merge_request| + merge_request.project = @project + merge_request.target_new_branch = !master_branch_exists? + merge_request.description = description + end + end + + def push_commit(commit_message) + Resource::Repository::ProjectPush.fabricate! do |push| + push.branch_name = 'master' + push.commit_message = commit_message + push.file_content = commit_message + push.project = @project + push.new_branch = !master_branch_exists? + end + end + + def expect_issue_done(issue_key) + expect do + Support::Waiter.wait_until(raise_on_failure: true) do + jira_issue = Vendor::Jira::JiraAPI.perform do |jira_api| + jira_api.fetch_issue(issue_key) + end + + jira_issue[:fields][:status][:name] == 'Done' + end + end.not_to raise_error + end + + def master_branch_exists? + @project.repository_branches.map { |item| item[:name] }.include?("master") + end + end + end +end 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 9b504ad76b4..21ae10774c9 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,12 @@ module QA context 'Create', :requires_admin do describe 'push after setting the file size limit via admin/application_settings' do + # Note: The file size limits in this test should be greater than the limits in + # ee/browser_ui/3_create/repository/push_rules_spec to prevent that test from + # triggering the limit set in this test (which can happen on Staging where the + # tests are run in parallel). + # See: https://gitlab.com/gitlab-org/gitlab/-/issues/218620#note_361634705 + include Support::Api before(:context) do @@ -31,7 +37,7 @@ module QA end it 'push fails when the file size is above the limit' do - set_file_size_limit(1) + set_file_size_limit(2) retry_on_fail do expect { push_new_file('oversize_file_2.bin', wait_for_push: false) } @@ -52,7 +58,7 @@ module QA output = Resource::Repository::Push.fabricate! do |p| p.repository_http_uri = @project.repository_http_location.uri p.file_name = file_name - p.file_content = SecureRandom.random_bytes(2000000) + p.file_content = SecureRandom.random_bytes(3000000) p.commit_message = commit_message p.new_branch = false end diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb new file mode 100644 index 00000000000..a3011550db8 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb @@ -0,0 +1,101 @@ +# frozen_string_literal: true + +module QA + context 'Create' do + describe 'Version control for project 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::ProjectSnippet.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 project 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 project 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_personal_snippet_spec.rb index dfcbf4b44c8..451a7847f8b 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_personal_snippet_spec.rb @@ -2,8 +2,8 @@ module QA context 'Create', :smoke do - describe 'Snippet creation' do - it 'User creates a snippet' do + describe 'Personal snippet creation' do + it 'User creates a personal snippet' do Flow::Login.sign_in Page::Main::Menu.perform(&:go_to_snippets) diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb new file mode 100644 index 00000000000..8fc4427bda7 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module QA + context 'Create' do # to be converted to a smoke test once proved to be stable + describe 'Project snippet creation' do + it 'User creates a project snippet' do + Flow::Login.sign_in + + Resource::ProjectSnippet.fabricate_via_browser_ui! do |snippet| + snippet.title = 'Project snippet' + snippet.description = ' ' + snippet.visibility = 'Private' + snippet.file_name = 'markdown_file.md' + snippet.file_content = "### Snippet heading\n\n[Gitlab link](https://gitlab.com/)" + end + + Page::Dashboard::Snippet::Show.perform do |snippet| + expect(snippet).to have_snippet_title('Project snippet') + expect(snippet).to have_no_snippet_description + expect(snippet).to have_visibility_type(/private/i) + expect(snippet).to have_file_name('markdown_file.md') + expect(snippet).to have_file_content('Snippet heading') + expect(snippet).to have_file_content('Gitlab link') + expect(snippet).not_to have_file_content('###') + expect(snippet).not_to have_file_content('https://gitlab.com/') + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/create_first_file_in_web_ide_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/create_first_file_in_web_ide_spec.rb new file mode 100644 index 00000000000..3bf6e156967 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/create_first_file_in_web_ide_spec.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module QA + context 'Create' do + describe 'First file using Web IDE' do + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'empty-project' + project.initialize_with_readme = false + end + end + + let(:web_ide_url) { current_url + '-/ide/project/' + project.path_with_namespace } + let(:file_name) { 'the very first file.txt' } + + before do + Flow::Login.sign_in + end + + it "creates the first file in an empty project via Web IDE" do + # In the first iteration, the test opens Web IDE by modifying the URL to address past regressions. + # Once the Web IDE button is introduced for empty projects, the test will be modified to go through UI. + # See https://gitlab.com/gitlab-org/gitlab/-/issues/27915 and https://gitlab.com/gitlab-org/gitlab/-/issues/27535. + page.visit(web_ide_url) + + Page::Project::WebIDE::Edit.perform do |ide| + ide.create_first_file(file_name) + ide.commit_changes + end + + project.visit! + + Page::Project::Show.perform do |project| + expect(project).to have_file(file_name) + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/create_edit_clone_push_wiki_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/create_edit_clone_push_wiki_spec.rb deleted file mode 100644 index 185d10a64ed..00000000000 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/create_edit_clone_push_wiki_spec.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -module QA - context 'Create' do - describe 'Wiki management' do - it 'user creates, edits, clones, and pushes to the wiki' do - Flow::Login.sign_in - - wiki = Resource::Wiki.fabricate_via_browser_ui! do |resource| - resource.title = 'Home' - resource.content = '# My First Wiki Content' - resource.message = 'Update home' - end - - validate_content('My First Wiki Content') - - Page::Project::Wiki::Edit.perform(&:click_edit) - Page::Project::Wiki::New.perform do |wiki| - wiki.set_content("My Second Wiki Content") - wiki.save_changes - end - - validate_content('My Second Wiki Content') - - Resource::Repository::WikiPush.fabricate! do |push| - push.wiki = wiki - push.file_name = 'Home.md' - push.file_content = '# My Third Wiki Content' - push.commit_message = 'Update Home.md' - end - Page::Project::Menu.perform(&:click_wiki) - - expect(page).to have_content('My Third Wiki Content') - end - - def validate_content(content) - expect(page).to have_content('Wiki was successfully updated') - expect(page).to have_content(/#{content}/) - end - end - end -end diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_creation_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_creation_spec.rb new file mode 100644 index 00000000000..1d0c8ee60d4 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_creation_spec.rb @@ -0,0 +1,93 @@ +# frozen_string_literal: true + +module QA + context 'Create' do + context 'Wiki' do + describe 'testing wiki content creation inside a project' do + let(:new_wiki_title) { "just_another_wiki_page" } + let(:new_wiki_content) { "this content is changed or added" } + let(:commit_message) { "this is a new addition to the wiki" } + + let(:project) { Resource::Project.fabricate_via_api! } + let(:wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } + + before do + Flow::Login.sign_in + end + + it 'by adding a home page to the wiki' do + project.visit! + + Page::Project::Menu.perform(&:click_wiki) + Page::Project::Wiki::Show.perform(&:click_create_your_first_page) + + Page::Project::Wiki::Edit.perform do |edit| + edit.set_title new_wiki_title + edit.set_content new_wiki_content + edit.set_message commit_message + end + + Page::Project::Wiki::Edit.perform(&:click_create_page) + + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_title new_wiki_title + expect(wiki).to have_content new_wiki_content + end + end + + it 'by adding a second page to the wiki' do + wiki.visit! + + Page::Project::Wiki::Show.perform(&:click_new_page) + + Page::Project::Wiki::Edit.perform do |edit| + edit.set_title new_wiki_title + edit.set_content new_wiki_content + edit.set_message commit_message + end + + Page::Project::Wiki::Edit.perform(&:click_create_page) + + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_title new_wiki_title + expect(wiki).to have_content new_wiki_content + end + end + + it 'by adding a home page to the wiki using git push' do + empty_wiki = Resource::Wiki::ProjectPage.new do |empty_wiki| + empty_wiki.project = project + end + + Resource::Repository::WikiPush.fabricate! do |push| + push.file_name = "#{new_wiki_title}.md" + push.file_content = new_wiki_content + push.commit_message = commit_message + push.wiki = empty_wiki + push.new_branch = true + end.visit! + + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_title new_wiki_title + expect(wiki).to have_content new_wiki_content + end + end + + it 'by adding a second page to the wiki using git push' do + Resource::Repository::WikiPush.fabricate! do |push| + push.file_name = "#{new_wiki_title}.md" + push.file_content = new_wiki_content + push.commit_message = commit_message + push.wiki = wiki + push.new_branch = false + end.visit! + + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_title new_wiki_title + expect(wiki).to have_content new_wiki_content + end + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_manipulation_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_manipulation_spec.rb new file mode 100644 index 00000000000..10370c80476 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_manipulation_spec.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +module QA + context 'Create' do + context 'Wiki' do + describe 'testing wiki content manipulation inside a project' do + let(:new_wiki_title) { "just_another_wiki_page" } + let(:new_wiki_content) { "this content is changed or added" } + let(:commit_message) { "this is a new addition to the wiki" } + + let(:wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } + + before do + Flow::Login.sign_in + end + + it 'by manipulating content on the page' do + wiki.visit! + + Page::Project::Wiki::Show.perform(&:click_edit) + + Page::Project::Wiki::Edit.perform do |edit| + edit.set_title new_wiki_title + edit.set_content new_wiki_content + edit.set_message commit_message + end + + Page::Project::Wiki::Edit.perform(&:click_save_changes) + + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_title new_wiki_title + expect(wiki).to have_content new_wiki_content + end + end + + it 'by manipulating content on the page using git push' do + Resource::Repository::WikiPush.fabricate! do |push| + push.file_content = new_wiki_content + push.commit_message = commit_message + push.wiki = wiki + push.new_branch = false + end.visit! + + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_content new_wiki_content + end + 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 b1eb26f0d63..e1d8c50ab75 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 @@ -29,10 +29,12 @@ module QA view_pipelines Page::Project::Pipeline::Show.perform do |parent_pipeline| - parent_pipeline.click_linked_job(project.name) + expect(parent_pipeline).to have_passed + parent_pipeline.retry_on_exception(sleep_interval: 1.0) do + parent_pipeline.click_linked_job(project.name) + end expect(parent_pipeline).to have_job("child_job") - expect(parent_pipeline).to have_passed end end @@ -41,10 +43,12 @@ module QA view_pipelines Page::Project::Pipeline::Show.perform do |parent_pipeline| - parent_pipeline.click_linked_job(project.name) + expect(parent_pipeline).to have_failed + parent_pipeline.retry_on_exception(sleep_interval: 1.0) do + parent_pipeline.click_linked_job(project.name) + end expect(parent_pipeline).to have_job("child_job") - expect(parent_pipeline).to have_failed end end 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 c9a61fc6305..c365e084991 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 @@ -29,10 +29,12 @@ module QA view_pipelines Page::Project::Pipeline::Show.perform do |parent_pipeline| - parent_pipeline.click_linked_job(project.name) + expect(parent_pipeline).to have_passed + parent_pipeline.retry_on_exception(reload: true, sleep_interval: 1.0) do + parent_pipeline.click_linked_job(project.name) + end expect(parent_pipeline).to have_job("child_job") - expect(parent_pipeline).to have_passed end end @@ -41,10 +43,12 @@ module QA view_pipelines Page::Project::Pipeline::Show.perform do |parent_pipeline| - parent_pipeline.click_linked_job(project.name) + expect(parent_pipeline).to have_passed + parent_pipeline.retry_on_exception(reload: true, sleep_interval: 1.0) do + parent_pipeline.click_linked_job(project.name) + end expect(parent_pipeline).to have_job("child_job") - expect(parent_pipeline).to have_passed end end 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 04c68598239..0e9c369e97f 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,10 +1,10 @@ # frozen_string_literal: true module QA - 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 'Configure' do + describe 'Kubernetes Cluster Integration', :orchestrated, :kubernetes, :requires_admin, :skip_live_env do context 'Project Clusters' do - let(:cluster) { Service::KubernetesCluster.new(provider_class: Service::ClusterProvider::K3s).create! } + let!(:cluster) { Service::KubernetesCluster.new(provider_class: Service::ClusterProvider::K3s).create! } let(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'project-with-k8s' @@ -13,7 +13,7 @@ module QA end before do - Flow::Login.sign_in + Flow::Login.sign_in_as_admin end after do 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 index 45273655bb6..a9ed6651069 100644 --- 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 @@ -1,11 +1,16 @@ # 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 + context 'Monitor' do + describe 'with Prometheus in a Gitlab-managed cluster', :orchestrated, :kubernetes do before :all do - Flow::Login.sign_in - @project, @runner = deploy_project_with_prometheus + @cluster = Service::KubernetesCluster.new.create! + @project = Resource::Project.fabricate_via_api! do |project| + project.name = 'monitoring-project' + project.auto_devops_enabled = true + end + + deploy_project_with_prometheus end before do @@ -14,7 +19,6 @@ module QA end after :all do - @runner.remove_via_api! @cluster.remove! end @@ -27,81 +31,94 @@ module QA 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 + Page::Project::Operations::Metrics::Show.perform do |on_dashboard| + on_dashboard.duplicate_dashboard - expect(dashboard).to have_metrics - expect(dashboard).to have_edit_dashboard_enabled + expect(on_dashboard).to have_metrics + expect(on_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 + Page::Project::Operations::Metrics::Show.perform do |on_dashboard| + on_dashboard.filter_environment - expect(dashboard).to have_metrics + expect(on_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 + Page::Project::Operations::Metrics::Show.perform do |on_dashboard| + on_dashboard.show_last('30 minutes') + expect(on_dashboard).to have_metrics - dashboard.show_last('3 hours') - expect(dashboard).to have_metrics + on_dashboard.show_last('3 hours') + expect(on_dashboard).to have_metrics - dashboard.show_last('1 day') - expect(dashboard).to have_metrics + on_dashboard.show_last('1 day') + expect(on_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' + %w[ + CODE_QUALITY_DISABLED TEST_DISABLED LICENSE_MANAGEMENT_DISABLED + SAST_DISABLED DAST_DISABLED DEPENDENCY_SCANNING_DISABLED + CONTAINER_SCANNING_DISABLED PERFORMANCE_DISABLED + ].each do |key| + Resource::CiVariable.fabricate_via_api! do |resource| + resource.project = @project + resource.key = key + resource.value = '1' + resource.masked = false + end end - runner = Resource::Runner.fabricate_via_api! do |runner| - runner.project = project - runner.name = project.name - end - - @cluster = Service::KubernetesCluster.new.create! + Flow::Login.sign_in - cluster_props = Resource::KubernetesCluster::ProjectCluster.fabricate! do |cluster_settings| - cluster_settings.project = project + Resource::KubernetesCluster::ProjectCluster.fabricate! do |cluster_settings| + cluster_settings.project = @project cluster_settings.cluster = @cluster cluster_settings.install_helm_tiller = true + cluster_settings.install_runner = 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.project = @project push.directory = Pathname .new(__dir__) - .join('../../../../fixtures/monitored_auto_devops') + .join('../../../../fixtures/auto_devops_rack') 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) + Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline) + + Page::Project::Pipeline::Show.perform do |pipeline| + pipeline.click_job('build') + end + Page::Project::Job::Show.perform do |job| + expect(job).to be_successful(timeout: 600) + + job.click_element(:pipeline_path) + end + + Page::Project::Pipeline::Show.perform do |pipeline| + pipeline.click_job('production') + end + Page::Project::Job::Show.perform do |job| + expect(job).to be_successful(timeout: 1200) - [project, runner] + job.click_element(:pipeline_path) + end end def verify_add_custom_metric @@ -115,8 +132,8 @@ module QA 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') + Page::Project::Operations::Metrics::Show.perform do |on_dashboard| + expect(on_dashboard).to have_custom_metric('HTTP Requests Total') end end @@ -130,8 +147,8 @@ module QA Page::Project::Menu.perform(&:go_to_operations_metrics) - Page::Project::Operations::Metrics::Show.perform do |dashboard| - expect(dashboard).to have_custom_metric('Throughput') + Page::Project::Operations::Metrics::Show.perform do |on_dashboard| + expect(on_dashboard).to have_custom_metric('Throughput') end end @@ -146,8 +163,8 @@ module QA Page::Project::Menu.perform(&:go_to_operations_metrics) - Page::Project::Operations::Metrics::Show.perform do |dashboard| - expect(dashboard).not_to have_custom_metric('Throughput') + Page::Project::Operations::Metrics::Show.perform do |on_dashboard| + expect(on_dashboard).not_to have_custom_metric('Throughput') end end end |