Commit 8e5ada04 authored by Rémy Coutable's avatar Rémy Coutable Committed by Ramya Authappan

Make sure end-to-end tests use unique filenames in template tests

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent f509b553
# frozen_string_literal: true
require 'securerandom'
module QA
RSpec.describe 'Create' do
describe 'File templates' do
......@@ -54,12 +56,14 @@ module QA
expect(form).to have_normalized_ws_text(content[0..100])
form.add_name("#{SecureRandom.hex(8)}/#{template[:file_name]}")
form.commit_changes
expect(form).to have_content('The file has been successfully created.')
aggregate_failures "indications of file created" do
expect(form).to have_content(template[:file_name])
expect(form).to have_content('Add new file')
expect(form).to have_normalized_ws_text(content[0..100])
expect(form).to have_content('Add new file')
end
end
end
end
......
# frozen_string_literal: true
require 'securerandom'
module QA
RSpec.describe 'Manage' do
describe 'Group file templates', :requires_admin do
......@@ -7,19 +9,19 @@ module QA
templates = [
{
type: 'Dockerfile',
file_name: 'Dockerfile',
template: 'custom_dockerfile',
file_path: 'Dockerfile/custom_dockerfile.dockerfile',
content: 'dockerfile template test'
},
{
type: '.gitignore',
file_name: '.gitignore',
template: 'custom_gitignore',
file_path: 'gitignore/custom_gitignore.gitignore',
content: 'gitignore template test'
},
{
type: '.gitlab-ci.yml',
file_name: '.gitlab-ci.yml',
template: 'custom_gitlab-ci',
file_path: 'gitlab-ci/custom_gitlab-ci.yml',
content:
......@@ -31,7 +33,7 @@ module QA
CI
},
{
type: 'LICENSE',
file_name: 'LICENSE',
template: 'custom_license',
file_path: 'LICENSE/custom_license.txt',
content: 'license template test'
......@@ -92,7 +94,7 @@ module QA
end
templates.each do |template|
it "creates file via custom #{template[:type]} file template" do
it "creates file via custom #{template[:file_name]} file template" do
Flow::Login.sign_in_as_admin
set_file_template_if_not_already_set
......@@ -101,18 +103,18 @@ module QA
Page::Project::Show.perform(&:create_new_file!)
Page::File::Form.perform do |form|
form.select_template template[:type], template[:template]
form.select_template template[:file_name], template[:template]
expect(form).to have_normalized_ws_text(template[:content])
form.add_name("#{SecureRandom.hex(8)}/#{template[:file_name]}")
form.commit_changes
form.finished_loading?
aggregate_failures "indications of file created" do
expect(form).to have_content('The file has been successfully created.')
expect(form).to have_content(template[:type])
expect(form).to have_content('Add new file')
expect(form).to have_content(template[:file_name])
expect(form).to have_normalized_ws_text(template[:content].chomp)
expect(form).to have_content('Add new file')
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