Commit a9d7ef80 authored by Tiffany Rea's avatar Tiffany Rea Committed by Sanad Liaquat

Improving github mirror spec flakiness

parent 7e6c8784
......@@ -101,7 +101,8 @@ export default {
<template>
<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">
<gl-link :href="repo.importSource.providerLink" target="_blank" data-testid="providerLink"
......@@ -112,6 +113,7 @@ export default {
<td
class="gl-display-flex gl-flex-sm-wrap gl-p-4 gl-pt-5 gl-vertical-align-top"
data-testid="fullPath"
data-qa-selector="project_path_content"
>
<template v-if="repo.importSource.target">{{ repo.importSource.target }}</template>
<template v-else-if="isImportNotStarted">
......@@ -124,7 +126,8 @@ export default {
</div>
<gl-form-input
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>
</template>
......@@ -140,12 +143,13 @@ export default {
:href="repo.importedProject.fullPath"
rel="noreferrer noopener"
target="_blank"
data-qa-selector="go_to_project_button"
>{{ __('Go to project') }}
</gl-button>
<gl-button
v-if="isImportNotStarted"
type="button"
class="qa-import-button"
data-qa-selector="import_button"
@click="fetchImport(repo.importSource.id)"
>
{{ importButtonText }}
......
......@@ -17,29 +17,34 @@ module QA
element :project_namespace_select
element :project_path_field
element :import_button
element :project_path_content
element :go_to_project_button
end
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)
click_element(:authenticate_button)
finished_loading?
end
def import!(full_path, name)
unless already_imported(full_path)
choose_test_namespace(full_path)
set_path(full_path, name)
import_project(full_path)
wait_for_success
end
go_to_project(name)
end
private
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)
within(project_import_row) do
......@@ -69,9 +74,9 @@ module QA
def wait_for_success
# 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
page.has_content?('Done', wait: 1.0)
page.has_no_content?('Importing 1 repository', wait: 3.0)
end
end
......@@ -81,6 +86,12 @@ module QA
dashboard.go_to_project(name)
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
......
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