Commit c0e5eee3 authored by Sanad Liaquat's avatar Sanad Liaquat

Merge branch 'qa-shl-fix-and-enable-import-github-spec' into 'master'

Fix and un-quarantines import GitHub e2e spec

See merge request gitlab-org/gitlab!46878
parents cf61e6be 162964e1
...@@ -38,15 +38,15 @@ module QA ...@@ -38,15 +38,15 @@ module QA
assert_no_selector(element_selector_css(name)) assert_no_selector(element_selector_css(name))
end end
def refresh def refresh(skip_finished_loading_check: false)
page.refresh page.refresh
wait_for_requests wait_for_requests(skip_finished_loading_check: skip_finished_loading_check)
end end
def wait_until(max_duration: 60, sleep_interval: 0.1, reload: true, raise_on_failure: true) def wait_until(max_duration: 60, sleep_interval: 0.1, reload: true, raise_on_failure: true, skip_finished_loading_check_on_refresh: false)
Support::Waiter.wait_until(max_duration: max_duration, sleep_interval: sleep_interval, raise_on_failure: raise_on_failure) do Support::Waiter.wait_until(max_duration: max_duration, sleep_interval: sleep_interval, raise_on_failure: raise_on_failure) do
yield || (reload && refresh && false) yield || (reload && refresh(skip_finished_loading_check: skip_finished_loading_check_on_refresh) && false)
end end
end end
......
...@@ -67,7 +67,9 @@ module QA ...@@ -67,7 +67,9 @@ module QA
end end
def wait_for_success def wait_for_success
wait_until(max_duration: 60, sleep_interval: 1.0, reload: false) do # TODO: set reload:false and remove skip_finished_loading_check_on_refresh when
# https://gitlab.com/gitlab-org/gitlab/-/issues/231542 is fixed
wait_until(max_duration: 60, sleep_interval: 5.0, reload: true, skip_finished_loading_check_on_refresh: true) do
page.has_content?('Done', wait: 1.0) page.has_content?('Done', wait: 1.0)
end end
end end
......
...@@ -6,6 +6,7 @@ module QA ...@@ -6,6 +6,7 @@ module QA
module Resource module Resource
class ProjectImportedFromGithub < Resource::Project class ProjectImportedFromGithub < Resource::Project
def fabricate! def fabricate!
self.import = true
super super
group.visit! group.visit!
......
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
RSpec.describe 'Manage', :github, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/issues/26952', type: :bug } do RSpec.describe 'Manage', :github, :requires_admin do
describe 'Project import from GitHub' 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 let(:imported_project) do
Resource::ProjectImportedFromGithub.fabricate! do |project| Resource::ProjectImportedFromGithub.fabricate_via_browser_ui! do |project|
project.name = 'imported-project' project.name = 'imported-project'
project.personal_access_token = Runtime::Env.github_access_token project.group = group
project.github_repository_path = 'gitlab-qa/test-project' project.github_personal_access_token = Runtime::Env.github_access_token
project.github_repository_path = 'gitlab-qa-github/test-project'
end end
end end
after do before do
# We need to delete the imported project because it's impossible to import group.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
# the same GitHub project twice for a given user. end
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)
Page::Main::Menu.perform(&:sign_out_if_signed_in) after do
user.remove_via_api!
end end
it 'user imports a GitHub repo', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/385' do it 'imports a GitHub repo', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/385' do
Flow::Login.sign_in Flow::Login.sign_in(as: user)
imported_project # import the project imported_project # import the project
...@@ -55,14 +60,14 @@ module QA ...@@ -55,14 +60,14 @@ module QA
click_link 'This is a sample issue' click_link 'This is a sample issue'
expect(page).to have_content('We should populate this project with issues, pull requests and wiki pages.') expect(page).to have_content('This is a sample first comment')
# Comments # Comments
comment_text = 'This is a comment from @rymai.' comment_text = 'This is a comment from @sliaquat'
Page::Project::Issue::Show.perform do |issue_page| Page::Project::Issue::Show.perform do |issue_page|
expect(issue_page).to have_comment(comment_text) 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('help wanted')
expect(issue_page).to have_label('good first issue') expect(issue_page).to have_label('good first issue')
end end
...@@ -71,26 +76,22 @@ module QA ...@@ -71,26 +76,22 @@ module QA
def verify_merge_requests_import def verify_merge_requests_import
Page::Project::Menu.perform(&:click_merge_requests) Page::Project::Menu.perform(&:click_merge_requests)
expect(page).to have_content('Improve README.md') expect(page).to have_content('Improve readme')
click_link 'Improve README.md' click_link 'Improve readme'
expect(page).to have_content('This improves the README file a bit.') expect(page).to have_content('This improves the README file a bit.')
# Review comment are not supported yet
expect(page).not_to have_content('Really nice change.')
# Comments # Comments
expect(page).to have_content('Nice work! This is a comment from @rymai.') expect(page).to have_content('[PR comment by @sliaquat] Nice work!')
# Diff comments # Diff comments
expect(page).to have_content('[Review comment] I like that!') expect(page).to have_content('[Single diff comment] Good riddance')
expect(page).to have_content('[Review comment] Nice blank line.') expect(page).to have_content('[Single diff comment] Nice addition')
expect(page).to have_content('[Single diff comment] Much better without this line!')
Page::MergeRequest::Show.perform do |merge_request| Page::MergeRequest::Show.perform do |merge_request|
expect(merge_request).to have_label('bug') expect(merge_request).to have_label('bug')
expect(merge_request).to have_label('enhancement') expect(merge_request).to have_label('documentation')
end end
end end
......
...@@ -10,7 +10,7 @@ module QA ...@@ -10,7 +10,7 @@ module QA
super super
end end
def refresh def refresh(skip_finished_loading_check: false)
log("refreshing #{current_url}") log("refreshing #{current_url}")
super super
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment