summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-29 06:09:58 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-29 06:09:58 +0000
commit64d80d99a907c9b5ac0d72b6a958916c496e31b1 (patch)
tree2078fe4c006de14e369e25f613296e6cacd36297 /qa
parent9f02780f4c852f502bd56df2c93b54464b01b5ad (diff)
downloadgitlab-ce-64d80d99a907c9b5ac0d72b6a958916c496e31b1.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/repository/branch_with_unusual_name_spec.rb46
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/repository/file/file_with_unusual_name_spec.rb47
2 files changed, 93 insertions, 0 deletions
diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/branch_with_unusual_name_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/branch_with_unusual_name_spec.rb
new file mode 100644
index 00000000000..db31cadb37d
--- /dev/null
+++ b/qa/qa/specs/features/browser_ui/3_create/repository/branch_with_unusual_name_spec.rb
@@ -0,0 +1,46 @@
+# frozen_string_literal: true
+
+module QA
+ RSpec.describe 'Create' do
+ describe 'Branch with unusual name' do
+ let(:branch_name) { 'unUsually/named#br--anch' }
+ let(:project) do
+ Resource::Project.fabricate_via_api! do |resource|
+ resource.name = 'unusually-named-branch-project'
+ resource.initialize_with_readme = true
+ end
+ end
+
+ before do
+ Flow::Login.sign_in
+ end
+
+ context 'when branch name contains slash, hash, double dash, and capital letter' do
+ it 'renders repository file tree correctly', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1780' do
+ Resource::Repository::Commit.fabricate_via_api! do |commit|
+ commit.project = project
+ commit.branch = branch_name
+ commit.start_branch = project.default_branch
+ commit.commit_message = 'Add new file'
+ commit.add_files([
+ { file_path: 'test-folder/test-file.md', content: 'new content' }
+ ])
+ end
+
+ project.visit!
+
+ Page::Project::Show.perform do |show|
+ show.switch_to_branch(branch_name)
+ show.click_file('test-folder')
+
+ expect(show).to have_file('test-file.md')
+
+ show.click_file('test-file.md')
+
+ expect(show).to have_content('new content')
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/file/file_with_unusual_name_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/file/file_with_unusual_name_spec.rb
new file mode 100644
index 00000000000..98d0a3c5706
--- /dev/null
+++ b/qa/qa/specs/features/browser_ui/3_create/repository/file/file_with_unusual_name_spec.rb
@@ -0,0 +1,47 @@
+# frozen_string_literal: true
+
+module QA
+ RSpec.describe 'Create' do
+ describe 'File with unusual name' do
+ let(:file_name) { '-un:usually;named#file?.md' }
+ let(:project) do
+ Resource::Project.fabricate_via_api! do |resource|
+ resource.name = 'unusually-named-file-project'
+ resource.initialize_with_readme = true
+ end
+ end
+
+ before do
+ Flow::Login.sign_in
+ end
+
+ context 'when file name starts with a dash and contains hash, semicolon, colon, and question mark' do
+ it 'renders repository file tree correctly', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1779' do
+ Resource::File.fabricate_via_api! do |file|
+ file.project = project
+ file.commit_message = 'Add new file'
+ file.name = "test-folder/#{file_name}"
+ file.content = "### Heading\n\n[Gitlab link](https://gitlab.com/)"
+ end
+
+ project.visit!
+
+ Page::Project::Show.perform do |show|
+ show.click_file('test-folder')
+
+ expect(show).to have_file(file_name)
+
+ show.click_file(file_name)
+
+ aggregate_failures 'markdown file contents' do
+ expect(show).to have_content('Heading')
+ expect(show).to have_content('Gitlab link')
+ expect(show).not_to have_content('###')
+ expect(show).not_to have_content('https://gitlab.com/')
+ end
+ end
+ end
+ end
+ end
+ end
+end