Commit 479ad83e authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'qa-wiki-ssh-spec' into 'master'

E2E Test wiki SSH push to Geo primary node

See merge request gitlab-org/gitlab-ee!16351
parents ab79cf35 c0b6f729
- is_admin = local_assigns.fetch(:admin, false)
- if @keys.any?
%ul.content-list
%ul.content-list{ data: { qa_selector: 'ssh_keys_list' } }
= render partial: 'profiles/keys/key', collection: @keys, locals: { is_admin: is_admin }
- else
%p.settings-message.text-center
......
......@@ -26,7 +26,7 @@
= (s_("WikiHistoricalPage|You can view the %{most_recent_link} or browse the %{history_link}.") % { most_recent_link: most_recent_link, history_link: history_link }).html_safe
.prepend-top-default.append-bottom-default
.md.md-file
.md.md-file{ data: { qa_selector: 'wiki_page_content' } }
= render_wiki_content(@page)
= render 'sidebar'
......@@ -14,6 +14,10 @@ module QA
element :delete_key_button
end
view 'app/views/profiles/keys/_key_table.html.haml' do
element :ssh_keys_list
end
def add_key(public_key, title)
fill_element :key_public_key_field, public_key
fill_element :key_title_field, title
......@@ -28,6 +32,10 @@ module QA
click_element :delete_key_button
end
end
def keys_list
find_element(:ssh_keys_list).text
end
end
end
end
......
......@@ -11,9 +11,17 @@ module QA
element :clone_repository_link, 'Clone repository' # rubocop:disable QA/ElementWithPattern
end
view 'app/views/projects/wikis/show.html.haml' do
element :wiki_page_content
end
def click_clone_repository
click_on 'Clone repository'
end
def wiki_text
find_element(:wiki_page_content).text
end
end
end
end
......
......@@ -31,6 +31,17 @@ module QA
end
end
def repository_ssh_uri
@repository_ssh_uri ||= begin
wiki.visit!
Page::Project::Wiki::Show.act do
click_clone_repository
choose_repository_clone_ssh
repository_location.uri
end
end
end
def fabricate!
super
wiki.visit!
......
# frozen_string_literal: true
module QA
context 'Geo', :orchestrated, :geo do
describe 'GitLab wiki SSH push' do
context 'wiki commit' do
it 'is replicated to the secondary' do
wiki_title = 'Geo Replication Wiki'
wiki_content = 'This tests replication of wikis via SSH'
push_content = 'This is from the Geo wiki push via SSH!'
project_name = "geo-wiki-project-#{SecureRandom.hex(8)}"
key_title = "key for ssh tests #{Time.now.to_f}"
project = nil
key = nil
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
Page::Main::Login.perform(&:sign_in_using_credentials)
# Create a new SSH key
key = Resource::SSHKey.fabricate! do |resource|
resource.title = key_title
end
# Create a new project and wiki
project = Resource::Project.fabricate! do |project|
project.name = project_name
project.description = 'Geo project for wiki ssh spec'
end
wiki = Resource::Wiki.fabricate! do |wiki|
wiki.project = project
wiki.title = wiki_title
wiki.content = wiki_content
wiki.message = 'First commit'
end
validate_content(wiki_content)
# Perform a git push over SSH directly to the primary
Resource::Repository::WikiPush.fabricate! do |push|
push.ssh_key = key
push.wiki = wiki
push.file_name = 'Home.md'
push.file_content = push_content
push.commit_message = 'Update Home.md'
end
Page::Project::Menu.perform(&:click_wiki)
validate_content(push_content)
end
Runtime::Browser.visit(:geo_secondary, QA::Page::Main::Login) do
Page::Main::Login.perform(&:sign_in_using_credentials)
EE::Page::Main::Banner.perform do |banner|
expect(banner).to have_secondary_read_only_banner
end
# Ensure the SSH key has replicated
Page::Main::Menu.perform(&:click_settings_link)
Page::Profile::Menu.perform(&:click_ssh_keys)
Page::Profile::SSHKeys.perform do |ssh|
expect(ssh.keys_list).to have_content(key_title)
expect(ssh.keys_list).to have_content(key.fingerprint)
end
Page::Main::Menu.perform(&:go_to_projects)
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(project_name)
dashboard.go_to_project(project_name)
end
# Validate git push worked and new content is visible
Page::Project::Menu.perform(&:click_wiki)
Page::Project::Wiki::Show.perform do |show|
show.wait_for_repository_replication_with(push_content)
show.refresh
end
validate_content(push_content)
end
end
end
def validate_content(content)
Page::Project::Wiki::Show.perform do |show|
expect(show.wiki_text).to have_content(content)
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