blob: 820b47a31759abd9340eac38f96652f7828d4a59 (
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# frozen_string_literal: true
module QA
RSpec.describe 'Create', product_group: :editor do
describe 'Open a fork in Web IDE',
skip: {
issue: "https://gitlab.com/gitlab-org/gitlab/-/issues/351696",
type: :flaky
} do
let(:parent_project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'parent-project'
project.initialize_with_readme = true
end
end
context 'when a user does not have permissions to commit to the project' do
let(:user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2) }
context 'when no fork is present' do
it 'suggests to create a fork when a user clicks Web IDE in the main project', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347823' do
Flow::Login.sign_in(as: user)
parent_project.visit!
Page::Project::Show.perform(&:open_web_ide!)
Page::Project::WebIDE::Edit.perform(&:fork_project!)
submit_merge_request_upstream
end
end
context 'when a fork is already created' do
let(:fork_project) do
Resource::Fork.fabricate_via_api! do |fork|
fork.user = user
fork.upstream = parent_project
end
end
it 'opens the fork when a user clicks Web IDE in the main project', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347824' do
Flow::Login.sign_in(as: user)
fork_project.upstream.visit!
Page::Project::Show.perform do |project_page|
expect(project_page).to have_edit_fork_button
project_page.open_web_ide!
end
submit_merge_request_upstream
end
after do
fork_project.project.remove_via_api!
end
end
def submit_merge_request_upstream
Page::Project::WebIDE::Edit.perform do |ide|
expect(ide).to have_project_path("#{user.username}/#{parent_project.name}")
ide.add_file('new file', 'some random text')
ide.commit_changes(open_merge_request: true)
end
Page::MergeRequest::New.perform(&:create_merge_request)
parent_project.visit!
Page::Project::Menu.perform(&:click_merge_requests)
expect(page).to have_content('Update new file')
end
end
end
end
end
|