summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/3_create/repository/push_over_ssh_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/specs/features/browser_ui/3_create/repository/push_over_ssh_spec.rb')
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/repository/push_over_ssh_spec.rb67
1 files changed, 67 insertions, 0 deletions
diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_ssh_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_ssh_spec.rb
new file mode 100644
index 00000000000..d0f0cabbbca
--- /dev/null
+++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_ssh_spec.rb
@@ -0,0 +1,67 @@
+# frozen_string_literal: true
+
+module QA
+ RSpec.describe 'Create' do
+ describe 'SSH key support' do
+ # Note: If you run these tests against GDK make sure you've enabled sshd
+ # See: https://gitlab.com/gitlab-org/gitlab-qa/blob/master/docs/run_qa_against_gdk.md
+
+ let(:project) do
+ Resource::Project.fabricate! do |project|
+ project.name = 'ssh-tests'
+ end
+ end
+
+ before(:context) do
+ @key = Resource::SSHKey.fabricate_via_api! do |resource|
+ resource.title = "key for ssh tests #{Time.now.to_f}"
+ end
+ end
+
+ after(:context) do
+ @key.remove_via_api!
+ end
+
+ before do
+ Flow::Login.sign_in
+ end
+
+ it 'pushes code to the repository via SSH', :smoke do
+ Resource::Repository::ProjectPush.fabricate! do |push|
+ push.project = project
+ push.ssh_key = @key
+ push.file_name = 'README.md'
+ push.file_content = '# Test Use SSH Key'
+ push.commit_message = 'Add README.md'
+ end.project.visit!
+
+ Page::Project::Show.perform do |project|
+ expect(project).to have_file('README.md')
+ expect(project).to have_readme_content('Test Use SSH Key')
+ end
+ end
+
+ it 'pushes multiple branches and tags together', :smoke do
+ branches = []
+ tags = []
+ Git::Repository.perform do |repository|
+ repository.uri = project.repository_ssh_location.uri
+ repository.use_ssh_key(@key)
+ repository.clone
+ repository.configure_identity('GitLab QA', 'root@gitlab.com')
+ 1.upto(3) do |i|
+ branches << "branch#{i}"
+ tags << "tag#{i}"
+ repository.checkout("branch#{i}", new_branch: true)
+ repository.commit_file("file#{i}", SecureRandom.random_bytes(10000), "Add file#{i}")
+ repository.add_tag("tag#{i}")
+ end
+ repository.push_tags_and_branches(branches)
+ end
+
+ expect(project).to have_branches(branches)
+ expect(project).to have_tags(tags)
+ end
+ end
+ end
+end