Commit ece2b378 authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'qa-e2e-add-tests-for-unuasual-strings' into 'master'

Add E2Es for unusual names in branches and files

See merge request gitlab-org/gitlab!60451
parents 731b5ff0 8ff1a5bb
# 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
# 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment