From 39a659a1350553900c0efe500da752665dd4a376 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 18 Jan 2018 22:23:35 +0800 Subject: Scrap the deploy key title and match it in test --- qa/qa/factory/resource/deploy_key.rb | 6 ++++++ qa/qa/page/project/settings/deploy_keys.rb | 6 ++++-- qa/qa/specs/features/project/add_deploy_key_spec.rb | 12 ++++-------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/qa/qa/factory/resource/deploy_key.rb b/qa/qa/factory/resource/deploy_key.rb index 7c58e70bcc4..671114d38b1 100644 --- a/qa/qa/factory/resource/deploy_key.rb +++ b/qa/qa/factory/resource/deploy_key.rb @@ -4,6 +4,12 @@ module QA class DeployKey < Factory::Base attr_accessor :title, :key + product :title do + Page::Project::Settings::Repository.act do + expand_deploy_keys(&:key_title) + end + end + dependency Factory::Resource::Project, as: :project do |project| project.name = 'project-to-deploy' project.description = 'project for adding deploy key test' diff --git a/qa/qa/page/project/settings/deploy_keys.rb b/qa/qa/page/project/settings/deploy_keys.rb index bf42767c707..211699599e1 100644 --- a/qa/qa/page/project/settings/deploy_keys.rb +++ b/qa/qa/page/project/settings/deploy_keys.rb @@ -29,9 +29,11 @@ module QA click_on 'Add key' end - def has_key_title?(title) + def key_title page.within('.deploy-keys') do - page.find('.title', text: title) + # The instance might have public keys available, here we want + # the one from the project + page.first('.title').text end end end diff --git a/qa/qa/specs/features/project/add_deploy_key_spec.rb b/qa/qa/specs/features/project/add_deploy_key_spec.rb index 43a85213501..7a123e539e1 100644 --- a/qa/qa/specs/features/project/add_deploy_key_spec.rb +++ b/qa/qa/specs/features/project/add_deploy_key_spec.rb @@ -7,16 +7,12 @@ module QA Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } - Factory::Resource::DeployKey.fabricate! do |deploy_key| - deploy_key.title = deploy_key_title - deploy_key.key = deploy_key_value + deploy_key = Factory::Resource::DeployKey.fabricate! do |resource| + resource.title = deploy_key_title + resource.key = deploy_key_value end - Page::Project::Settings::Repository.perform do |setting| - setting.expand_deploy_keys do |page| - expect(page).to have_key_title(deploy_key_title) - end - end + expect(deploy_key.title).to eq(deploy_key_title) end end end -- cgit v1.2.1 From 09e9a50272c516997e41afff81d98d05a8b6c728 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Fri, 19 Jan 2018 22:34:21 +0800 Subject: Add .qa-project-deploy-keys to locate it Without this, it's very hard to locate it. --- app/assets/javascripts/deploy_keys/components/app.vue | 1 + qa/qa/page/project/settings/deploy_keys.rb | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/deploy_keys/components/app.vue b/app/assets/javascripts/deploy_keys/components/app.vue index 7b68b19de75..5a782237b7d 100644 --- a/app/assets/javascripts/deploy_keys/components/app.vue +++ b/app/assets/javascripts/deploy_keys/components/app.vue @@ -87,6 +87,7 @@