summaryrefslogtreecommitdiff
path: root/qa/qa/resource/project_imported_from_github.rb
blob: e5ecaeae139a8ac3b5349c6850726f7dd9f0aa83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

require 'securerandom'

module QA
  module Resource
    class ProjectImportedFromGithub < Base
      attr_accessor :name
      attr_writer :personal_access_token, :github_repository_path

      attribute :group do
        Group.fabricate!
      end

      def fabricate!
        group.visit!

        Page::Group::Show.perform(&:go_to_new_project)

        Page::Project::New.perform(&:click_import_project)

        Page::Project::New.perform(&:click_github_link)

        Page::Project::Import::Github.perform do |import_page|
          import_page.add_personal_access_token(@personal_access_token)
          import_page.import!(@github_repository_path, @name)
        end
      end
    end
  end
end