diff options
Diffstat (limited to 'qa/qa/specs/features/browser_ui/1_manage')
9 files changed, 99 insertions, 59 deletions
diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/2fa_recovery_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/2fa_recovery_spec.rb index 23de213012e..163469e1e88 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/2fa_recovery_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/2fa_recovery_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Manage', :requires_admin, :skip_live_env do + RSpec.describe 'Manage', :requires_admin, :skip_live_env do describe '2FA' do let(:owner_user) do Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_2fa_owner_username_1, Runtime::Env.gitlab_qa_2fa_owner_password_1) diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/2fa_ssh_recovery_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/2fa_ssh_recovery_spec.rb index e81ebd5fa9d..7f3c3049499 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/2fa_ssh_recovery_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/2fa_ssh_recovery_spec.rb @@ -22,7 +22,7 @@ module QA it 'allows 2FA code recovery via ssh' do recovery_code = Support::SSH.perform do |ssh| ssh.key = ssh_key - ssh.uri = address.gsub(uri.port.to_s, ssh_port) + ssh.uri = address.gsub(/(?<=:)(#{uri.port})/, ssh_port) ssh.setup output = ssh.reset_2fa_codes output.scan(/([A-Za-z0-9]{16})\n/).flatten.first diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb index e514507fcb6..12a1b419f8b 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Manage', :requires_admin, :skip_live_env do + RSpec.describe 'Manage', :requires_admin, :skip_live_env do describe '2FA' do let(:owner_user) do Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_2fa_owner_username_1, Runtime::Env.gitlab_qa_2fa_owner_password_1) diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb index f6aecff9f26..e4ac59cf5e0 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb @@ -12,7 +12,9 @@ module QA login_page.login('user1', 'user1pass') end - expect(page).to have_content('Welcome to GitLab') + Page::Dashboard::Welcome.perform do |welcome| + expect(welcome).to have_content('Welcome to GitLab') + end end end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb index 11a6bf6fdfa..2bb03b6154f 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb @@ -13,11 +13,39 @@ module QA end end - RSpec.describe 'Manage', :skip_signup_disabled do + RSpec.describe 'Manage', :skip_signup_disabled, :requires_admin do + describe 'while LDAP is enabled', :orchestrated, :ldap_no_tls, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/935' do + before do + # When LDAP is enabled, a previous test might have created a token for the LDAP 'tanuki' user who is not an admin + # So we need to set it to nil in order to create a new token for admin user so that we are able to set_application_settings + # Also, when GITLAB_LDAP_USERNAME is provided, it is used to create a token. This also needs to be set to nil temporarily + # for the same reason as above. + + @personal_access_token = Runtime::Env.personal_access_token + Runtime::Env.personal_access_token = nil + ldap_username = Runtime::Env.ldap_username + Runtime::Env.ldap_username = nil + + disable_require_admin_approval_after_user_signup + + Runtime::Env.ldap_username = ldap_username + end + + it_behaves_like 'registration and login' + + after do + Runtime::Env.personal_access_token = @personal_access_token + end + end + describe 'standard', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/936' do + before(:all) do + disable_require_admin_approval_after_user_signup + end + it_behaves_like 'registration and login' - context 'when user account is deleted', :requires_admin do + context 'when user account is deleted' do let(:user) do Resource::User.fabricate_via_api! do |resource| resource.api_client = admin_api_client @@ -61,11 +89,10 @@ module QA end end end - end - RSpec.describe 'Manage', :orchestrated, :ldap_no_tls, :skip_signup_disabled do - describe 'while LDAP is enabled', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/935' do - it_behaves_like 'registration and login' + def disable_require_admin_approval_after_user_signup + Runtime::ApplicationSettings.set_application_settings(require_admin_approval_after_user_signup: false) + sleep 10 # It takes a moment for the setting to come into effect 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 27350176a1e..e71cbeb9837 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 @@ -15,9 +15,9 @@ module QA Page::Project::Menu.perform(&:click_members) Page::Project::Members.perform do |members| members.add_member(user.username) - end - expect(page).to have_content(/@#{user.username}(\n| )?Given access/) + expect(members).to have_content(/@#{user.username}( Is using seat)?(\n| )?Given access/) + end end end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb index 6d07f72a044..2f2f40cba3b 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb @@ -11,12 +11,14 @@ module QA project.description = 'create awesome project test' end - expect(page).to have_content(created_project.name) - expect(page).to have_content( - /Project \S?awesome-project\S+ was successfully created/ - ) - expect(page).to have_content('create awesome project test') - expect(page).to have_content('The repository for this project is empty') + Page::Project::Show.perform do |project| + expect(project).to have_content(created_project.name) + expect(project).to have_content( + /Project \S?awesome-project\S+ was successfully created/ + ) + expect(project).to have_content('create awesome project test') + expect(project).to have_content('The repository for this project is empty') + end end end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb index 83dfb2d9639..d54ce0ac0fc 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb @@ -1,30 +1,35 @@ # frozen_string_literal: true module QA - RSpec.describe 'Manage', :github, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/issues/26952', type: :bug } do - describe 'Project import from GitHub' do + RSpec.describe 'Manage', :github, :requires_admin do + describe 'Project import' do + let!(:user) do + Resource::User.fabricate_via_api! do |resource| + resource.api_client = Runtime::API::Client.as_admin + end + end + + let(:group) { Resource::Group.fabricate_via_api! } + let(:imported_project) do - Resource::ProjectImportedFromGithub.fabricate! do |project| + Resource::ProjectImportedFromGithub.fabricate_via_browser_ui! do |project| project.name = 'imported-project' - project.personal_access_token = Runtime::Env.github_access_token - project.github_repository_path = 'gitlab-qa/test-project' + project.group = group + project.github_personal_access_token = Runtime::Env.github_access_token + project.github_repository_path = 'gitlab-qa-github/test-project' end end - after do - # We need to delete the imported project because it's impossible to import - # the same GitHub project twice for a given user. - api_client = Runtime::API::Client.new(:gitlab) - delete_project_request = Runtime::API::Request.new(api_client, "/projects/#{CGI.escape("#{Runtime::Namespace.path}/#{imported_project.name}")}") - delete delete_project_request.url - - expect_status(202) + before do + group.add_member(user, Resource::Members::AccessLevel::MAINTAINER) + end - Page::Main::Menu.perform(&:sign_out_if_signed_in) + after do + user.remove_via_api! end - it 'user imports a GitHub repo', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/385' do - Flow::Login.sign_in + it 'imports a GitHub repo', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/385' do + Flow::Login.sign_in(as: user) imported_project # import the project @@ -44,25 +49,28 @@ module QA end def verify_repository_import - expect(page).to have_content('This test project is used for automated GitHub import by GitLab QA.') - expect(page).to have_content(imported_project.name) + Page::Project::Show.perform do |project| + expect(project).to have_content('This test project is used for automated GitHub import by GitLab QA.') + expect(project).to have_content(imported_project.name) + end end def verify_issues_import QA::Support::Retrier.retry_on_exception do Page::Project::Menu.perform(&:click_issues) - expect(page).to have_content('This is a sample issue') - click_link 'This is a sample issue' + Page::Project::Issue::Show.perform do |issue_page| + expect(issue_page).to have_content('This is a sample issue') - expect(page).to have_content('We should populate this project with issues, pull requests and wiki pages.') + click_link 'This is a sample issue' - # Comments - comment_text = 'This is a comment from @rymai.' + expect(issue_page).to have_content('This is a sample first comment') + + # Comments + comment_text = 'This is a comment from @sliaquat' - Page::Project::Issue::Show.perform do |issue_page| expect(issue_page).to have_comment(comment_text) - expect(issue_page).to have_label('enhancement') + expect(issue_page).to have_label('custom new label') expect(issue_page).to have_label('help wanted') expect(issue_page).to have_label('good first issue') end @@ -71,26 +79,23 @@ module QA def verify_merge_requests_import Page::Project::Menu.perform(&:click_merge_requests) - expect(page).to have_content('Improve README.md') - click_link 'Improve README.md' + Page::MergeRequest::Show.perform do |merge_request| + expect(merge_request).to have_content('Improve readme') - expect(page).to have_content('This improves the README file a bit.') + click_link 'Improve readme' - # Review comment are not supported yet - expect(page).not_to have_content('Really nice change.') + expect(merge_request).to have_content('This improves the README file a bit.') - # Comments - expect(page).to have_content('Nice work! This is a comment from @rymai.') + # Comments + expect(merge_request).to have_content('[PR comment by @sliaquat] Nice work!') - # Diff comments - expect(page).to have_content('[Review comment] I like that!') - expect(page).to have_content('[Review comment] Nice blank line.') - expect(page).to have_content('[Single diff comment] Much better without this line!') + # Diff comments + expect(merge_request).to have_content('[Single diff comment] Good riddance') + expect(merge_request).to have_content('[Single diff comment] Nice addition') - Page::MergeRequest::Show.perform do |merge_request| expect(merge_request).to have_label('bug') - expect(merge_request).to have_label('enhancement') + expect(merge_request).to have_label('documentation') end end @@ -107,7 +112,9 @@ module QA def verify_wiki_import Page::Project::Menu.perform(&:click_wiki) - expect(page).to have_content('Welcome to the test-project wiki!') + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_content('Welcome to the test-project wiki!') + end end end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb index fd6d26153ea..3609d083fde 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb @@ -13,9 +13,11 @@ module QA end.project.visit! Page::Project::Menu.perform(&:click_activity) - Page::Project::Activity.perform(&:click_push_events) + Page::Project::Activity.perform do |activity| + activity.click_push_events - expect(page).to have_content('pushed new branch master') + expect(activity).to have_content('pushed new branch master') + end end end end |