diff options
Diffstat (limited to 'qa/qa/page/project/import/github.rb')
-rw-r--r-- | qa/qa/page/project/import/github.rb | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/qa/qa/page/project/import/github.rb b/qa/qa/page/project/import/github.rb index 6890c7de9f8..58c82fa14c1 100644 --- a/qa/qa/page/project/import/github.rb +++ b/qa/qa/page/project/import/github.rb @@ -17,28 +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) - choose_test_namespace(full_path) - set_path(full_path, name) - import_project(full_path) - wait_for_success + 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 @@ -68,9 +74,22 @@ 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 + + def go_to_project(name) + Page::Main::Menu.perform(&:go_to_projects) + Page::Dashboard::Projects.perform do |dashboard| + 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 |