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
|
# frozen_string_literal: true
module QA
# Failure issue: https://gitlab.com/gitlab-org/gitlab/issues/34551
context 'Create', :quarantine do
describe 'File templates' do
include Runtime::Fixtures
before(:all) do
@project = Resource::Project.fabricate_via_api! do |project|
project.name = 'file-template-project'
project.description = 'Add file templates via the Files view'
project.initialize_with_readme = true
end
end
templates = [
{
file_name: '.gitignore',
name: 'Android',
api_path: 'gitignores',
api_key: 'Android'
},
{
file_name: '.gitlab-ci.yml',
name: 'Julia',
api_path: 'gitlab_ci_ymls',
api_key: 'Julia'
},
{
file_name: 'Dockerfile',
name: 'Python',
api_path: 'dockerfiles',
api_key: 'Python'
},
{
file_name: 'LICENSE',
name: 'Mozilla Public License 2.0',
api_path: 'licenses',
api_key: 'mpl-2.0'
}
]
templates.each do |template|
it "user adds #{template[:file_name]} via file template #{template[:name]}" do
content = fetch_template_from_api(template[:api_path], template[:api_key])
Flow::Login.sign_in
@project.visit!
Page::Project::Show.perform(&:create_new_file!)
Page::File::Form.perform do |form|
form.select_template template[:file_name], template[:name]
end
expect(page).to have_content(content[0..100])
Page::File::Form.perform(&:commit_changes)
expect(page).to have_content('The file has been successfully created.')
expect(page).to have_content(template[:file_name])
expect(page).to have_content('Add new file')
expect(page).to have_content(content[0..100])
end
end
end
end
end
|