blob: b83a95694de0b29d508b9a3ba56e828591063bcb (
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# frozen_string_literal: true
module QA
RSpec.describe 'Create', product_group: :editor,
feature_flag: { name: 'vscode_web_ide', scope: :global },
quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/387032', type: :stale } do
describe 'Upload a file in Web IDE' do
let(:file_path) { File.join(Runtime::Path.fixtures_path, 'web_ide', file_name) }
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'upload-file-project'
project.initialize_with_readme = true
end
end
before do
Runtime::Feature.disable(:vscode_web_ide)
Flow::Login.sign_in
project.visit!
Page::Project::Show.perform(&:open_web_ide!)
end
after do
Runtime::Feature.enable(:vscode_web_ide)
end
context 'when a file with the same name already exists' do
let(:file_name) { 'README.md' }
it 'throws an error', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347850' do
Page::Project::WebIDE::Edit.perform do |ide|
ide.wait_until_ide_loads
ide.upload_file(file_path)
end
expect(page).to have_content('The name "README.md" is already taken in this directory.')
end
end
context 'when the file is a text file' do
let(:file_name) { 'text_file.txt' }
it 'shows the Edit tab with the text',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347852' do
Page::Project::WebIDE::Edit.perform do |ide|
ide.wait_until_ide_loads
ide.upload_file(file_path)
expect(ide).to have_file(file_name)
expect(ide).to have_file_addition_icon(file_name)
expect(ide).to have_text('Simple text')
ide.commit_changes
expect(ide).to have_file(file_name)
end
end
end
context 'when the file is binary' do
let(:file_name) { 'logo_sample.svg' }
it 'shows a Download button', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347851' do
Page::Project::WebIDE::Edit.perform do |ide|
ide.upload_file(file_path)
expect(ide).to have_file(file_name)
expect(ide).to have_file_addition_icon(file_name)
expect(ide).to have_download_button(file_name)
ide.commit_changes
expect(ide).to have_file(file_name)
end
end
end
context 'when the file is an image' do
let(:file_name) { 'dk.png' }
it 'shows an image viewer', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347853' do
Page::Project::WebIDE::Edit.perform do |ide|
ide.upload_file(file_path)
expect(ide).to have_file(file_name)
expect(ide).to have_file_addition_icon(file_name)
expect(ide).to have_image_viewer(file_name)
ide.commit_changes
expect(ide).to have_file(file_name)
end
end
end
end
end
end
|