Commit 579ce053 authored by Sanad Liaquat's avatar Sanad Liaquat

Merge branch '322819-fix-project-namespace-not-found' into 'master'

Improving github mirror spec flakiness

See merge request gitlab-org/gitlab!56163
parents 2a14bc00 a9d7ef80
...@@ -101,7 +101,8 @@ export default { ...@@ -101,7 +101,8 @@ export default {
<template> <template>
<tr <tr
class="qa-project-import-row gl-h-11 gl-border-0 gl-border-solid gl-border-t-1 gl-border-gray-100 gl-h-11" class="gl-h-11 gl-border-0 gl-border-solid gl-border-t-1 gl-border-gray-100 gl-h-11"
data-qa-selector="project_import_row"
> >
<td class="gl-p-4"> <td class="gl-p-4">
<gl-link :href="repo.importSource.providerLink" target="_blank" data-testid="providerLink" <gl-link :href="repo.importSource.providerLink" target="_blank" data-testid="providerLink"
...@@ -112,6 +113,7 @@ export default { ...@@ -112,6 +113,7 @@ export default {
<td <td
class="gl-display-flex gl-flex-sm-wrap gl-p-4 gl-pt-5 gl-vertical-align-top" class="gl-display-flex gl-flex-sm-wrap gl-p-4 gl-pt-5 gl-vertical-align-top"
data-testid="fullPath" data-testid="fullPath"
data-qa-selector="project_path_content"
> >
<template v-if="repo.importSource.target">{{ repo.importSource.target }}</template> <template v-if="repo.importSource.target">{{ repo.importSource.target }}</template>
<template v-else-if="isImportNotStarted"> <template v-else-if="isImportNotStarted">
...@@ -124,7 +126,8 @@ export default { ...@@ -124,7 +126,8 @@ export default {
</div> </div>
<gl-form-input <gl-form-input
v-model="newNameInput" v-model="newNameInput"
class="gl-rounded-top-left-none gl-rounded-bottom-left-none qa-project-path-field" class="gl-rounded-top-left-none gl-rounded-bottom-left-none"
data-qa-selector="project_path_field"
/> />
</div> </div>
</template> </template>
...@@ -140,12 +143,13 @@ export default { ...@@ -140,12 +143,13 @@ export default {
:href="repo.importedProject.fullPath" :href="repo.importedProject.fullPath"
rel="noreferrer noopener" rel="noreferrer noopener"
target="_blank" target="_blank"
data-qa-selector="go_to_project_button"
>{{ __('Go to project') }} >{{ __('Go to project') }}
</gl-button> </gl-button>
<gl-button <gl-button
v-if="isImportNotStarted" v-if="isImportNotStarted"
type="button" type="button"
class="qa-import-button" data-qa-selector="import_button"
@click="fetchImport(repo.importSource.id)" @click="fetchImport(repo.importSource.id)"
> >
{{ importButtonText }} {{ importButtonText }}
......
...@@ -17,29 +17,34 @@ module QA ...@@ -17,29 +17,34 @@ module QA
element :project_namespace_select element :project_namespace_select
element :project_path_field element :project_path_field
element :import_button element :import_button
element :project_path_content
element :go_to_project_button
end end
def add_personal_access_token(personal_access_token) def add_personal_access_token(personal_access_token)
# If for some reasons this process is retried, user cannot re-enter github token in the same group
# In this case skip this step and proceed to import project row
return unless has_element?(:personal_access_token_field)
fill_element(:personal_access_token_field, personal_access_token) fill_element(:personal_access_token_field, personal_access_token)
click_element(:authenticate_button) click_element(:authenticate_button)
finished_loading? finished_loading?
end end
def import!(full_path, name) def import!(full_path, name)
choose_test_namespace(full_path) unless already_imported(full_path)
set_path(full_path, name) choose_test_namespace(full_path)
import_project(full_path) set_path(full_path, name)
wait_for_success import_project(full_path)
wait_for_success
end
go_to_project(name) go_to_project(name)
end end
private private
def within_repo_path(full_path) def within_repo_path(full_path)
wait_until(reload: false) do
has_element?(:project_import_row, text: full_path)
end
project_import_row = find_element(:project_import_row, text: full_path) project_import_row = find_element(:project_import_row, text: full_path)
within(project_import_row) do within(project_import_row) do
...@@ -69,9 +74,9 @@ module QA ...@@ -69,9 +74,9 @@ module QA
def wait_for_success def wait_for_success
# TODO: set reload:false and remove skip_finished_loading_check_on_refresh when # TODO: set reload:false and remove skip_finished_loading_check_on_refresh when
# https://gitlab.com/gitlab-org/gitlab/-/issues/231542 is fixed # https://gitlab.com/gitlab-org/gitlab/-/issues/292861 is fixed
wait_until(max_duration: 60, sleep_interval: 5.0, reload: true, skip_finished_loading_check_on_refresh: true) do 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_no_content?('Importing 1 repository', wait: 3.0)
end end
end end
...@@ -81,6 +86,12 @@ module QA ...@@ -81,6 +86,12 @@ module QA
dashboard.go_to_project(name) dashboard.go_to_project(name)
end end
end end
def already_imported(full_path)
within_repo_path(full_path) do
has_element?(:project_path_content) && has_element?(:go_to_project_button)
end
end
end end
end end
end end
......
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