blob: 73f1b0b969502881eba30cc7eba7e0c32752c925 (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# frozen_string_literal: true
module QA
module Resource
class Fork < Base
attribute :project do
Resource::Project.fabricate! do |resource|
resource.name = upstream.project.name
resource.path_with_namespace = "#{user.name}/#{upstream.project.name}"
end
end
attribute :upstream do
Repository::ProjectPush.fabricate!
end
attribute :user do
User.fabricate! do |resource|
if Runtime::Env.forker?
resource.username = Runtime::Env.forker_username
resource.password = Runtime::Env.forker_password
end
end
end
def fabricate!
populate(:upstream, :user)
# Sign out as admin and sign is as the fork user
Page::Main::Menu.perform(&:sign_out)
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform do |login|
login.sign_in_using_credentials(user: user)
end
upstream.project.visit!
Page::Project::Show.perform(&:fork_project)
Page::Project::Fork::New.perform do |fork_new|
fork_new.choose_namespace(user.name)
end
Page::Layout::Banner.perform do |banner|
banner.has_notice?('The project was successfully forked.')
end
populate(:project)
end
end
end
end
|