1# frozen_string_literal: true
2
3module QA
4  module Page
5    module Component
6      module Import
7        module Gitlab
8          extend QA::Page::PageConcern
9
10          def self.included(base)
11            super
12
13            base.view 'app/views/import/gitlab_projects/new.html.haml' do
14              element :import_project_button
15            end
16
17            base.view 'app/views/import/shared/_new_project_form.html.haml' do
18              element :project_name_field
19              element :project_slug_field
20            end
21          end
22
23          def set_imported_project_name(name)
24            fill_element(:project_name_field, name)
25          end
26
27          def attach_exported_file(path)
28            page.attach_file("file", path, make_visible: { display: 'block' })
29          end
30
31          def click_import_gitlab_project
32            click_element(:import_project_button)
33
34            wait_until(reload: false) do
35              has_notice?("The project was successfully imported.") || has_element?(:project_name_content)
36            end
37          end
38        end
39      end
40    end
41  end
42end
43