Merge branch 'ce-backport-of-ml-web-terminal-spec-qa' into 'master'
Backport changes from EE MR 8186 See merge request gitlab-org/gitlab-ce!31707
This commit is contained in:
commit
739ecdb664
11 changed files with 153 additions and 23 deletions
|
@ -44,7 +44,7 @@ export default {
|
|||
|
||||
<template>
|
||||
<div class="flash-container flash-container-page" @click="clickFlash">
|
||||
<div class="flash-alert">
|
||||
<div class="flash-alert" data-qa-selector="flash_alert">
|
||||
<span v-html="message.text"> </span>
|
||||
<button
|
||||
v-if="message.action"
|
||||
|
|
|
@ -89,7 +89,7 @@ export default {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="multi-file-commit-panel ide-right-sidebar">
|
||||
<div class="multi-file-commit-panel ide-right-sidebar" data-qa-selector="ide_right_sidebar">
|
||||
<resizable-panel
|
||||
v-show="isOpen"
|
||||
:collapsible="false"
|
||||
|
@ -120,6 +120,7 @@ export default {
|
|||
}"
|
||||
data-container="body"
|
||||
data-placement="left"
|
||||
:data-qa-selector="`${tab.title.toLowerCase()}_tab_button`"
|
||||
class="ide-sidebar-link is-right"
|
||||
type="button"
|
||||
@click="clickTab($event, tab)"
|
||||
|
|
5
qa/qa.rb
5
qa/qa.rb
|
@ -73,6 +73,7 @@ module QA
|
|||
end
|
||||
|
||||
module Repository
|
||||
autoload :Commit, 'qa/resource/repository/commit'
|
||||
autoload :Push, 'qa/resource/repository/push'
|
||||
autoload :ProjectPush, 'qa/resource/repository/project_push'
|
||||
autoload :WikiPush, 'qa/resource/repository/wiki_push'
|
||||
|
@ -346,6 +347,10 @@ module QA
|
|||
module Issuable
|
||||
autoload :Common, 'qa/page/component/issuable/common'
|
||||
end
|
||||
|
||||
module WebIDE
|
||||
autoload :Alert, 'qa/page/component/web_ide/alert'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
27
qa/qa/page/component/web_ide/alert.rb
Normal file
27
qa/qa/page/component/web_ide/alert.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
module Page
|
||||
module Component
|
||||
module WebIDE
|
||||
module Alert
|
||||
def self.prepended(page)
|
||||
page.module_eval do
|
||||
view 'app/assets/javascripts/ide/components/error_message.vue' do
|
||||
element :flash_alert
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def has_no_alert?(message = nil)
|
||||
return has_no_element?(:flash_alert) if message.nil?
|
||||
|
||||
within_element(:flash_alert) do
|
||||
has_no_text?(message)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -5,6 +5,7 @@ module QA
|
|||
module Project
|
||||
module WebIDE
|
||||
class Edit < Page::Base
|
||||
prepend Page::Component::WebIDE::Alert
|
||||
include Page::Component::DropdownFilter
|
||||
|
||||
view 'app/assets/javascripts/ide/components/activity_bar.vue' do
|
||||
|
@ -123,3 +124,5 @@ module QA
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
QA::Page::Project::WebIDE::Edit.prepend_if_ee('QA::EE::Page::Component::WebIDE::WebTerminalPanel')
|
||||
|
|
|
@ -15,6 +15,7 @@ module QA
|
|||
attribute :add_name_uuid
|
||||
attribute :description
|
||||
attribute :standalone
|
||||
attribute :runners_token
|
||||
|
||||
attribute :group do
|
||||
Group.fabricate!
|
||||
|
|
66
qa/qa/resource/repository/commit.rb
Normal file
66
qa/qa/resource/repository/commit.rb
Normal file
|
@ -0,0 +1,66 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
module Resource
|
||||
module Repository
|
||||
class Commit < Base
|
||||
attr_accessor :author_email,
|
||||
:author_name,
|
||||
:branch,
|
||||
:commit_message,
|
||||
:file_path,
|
||||
:sha
|
||||
|
||||
attribute :project do
|
||||
Project.fabricate! do |resource|
|
||||
resource.name = 'project-with-commit'
|
||||
end
|
||||
end
|
||||
|
||||
def initialize
|
||||
@commit_message = 'QA Test - Commit message'
|
||||
end
|
||||
|
||||
def files=(files)
|
||||
if !files.is_a?(Array) ||
|
||||
files.empty? ||
|
||||
files.any? { |file| !file.has_key?(:file_path) || !file.has_key?(:content) }
|
||||
raise ArgumentError, "Please provide an array of hashes e.g.: [{file_path: 'file1', content: 'foo'}]"
|
||||
end
|
||||
|
||||
@files = files
|
||||
end
|
||||
|
||||
def resource_web_url(resource)
|
||||
super
|
||||
rescue ResourceURLMissingError
|
||||
# this particular resource does not expose a web_url property
|
||||
end
|
||||
|
||||
def api_get_path
|
||||
"#{api_post_path}/#{@sha}"
|
||||
end
|
||||
|
||||
def api_post_path
|
||||
"/projects/#{CGI.escape(project.path_with_namespace)}/repository/commits"
|
||||
end
|
||||
|
||||
def api_post_body
|
||||
{
|
||||
branch: @branch || "master",
|
||||
author_email: @author_email || Runtime::User.default_email,
|
||||
author_name: @author_name || Runtime::User.username,
|
||||
commit_message: commit_message,
|
||||
actions: actions
|
||||
}
|
||||
end
|
||||
|
||||
def actions
|
||||
@files.map do |file|
|
||||
file.merge({ action: "create" })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -6,9 +6,10 @@ module QA
|
|||
module Resource
|
||||
class Runner < Base
|
||||
attr_writer :name, :tags, :image
|
||||
attr_accessor :config
|
||||
|
||||
attribute :project do
|
||||
Project.fabricate! do |resource|
|
||||
Project.fabricate_via_api! do |resource|
|
||||
resource.name = 'project-with-ci-cd'
|
||||
resource.description = 'Project with CI/CD Pipelines'
|
||||
end
|
||||
|
@ -26,24 +27,27 @@ module QA
|
|||
@image || 'gitlab/gitlab-runner:alpine'
|
||||
end
|
||||
|
||||
def fabricate!
|
||||
project.visit!
|
||||
|
||||
Page::Project::Menu.perform(&:go_to_ci_cd_settings)
|
||||
|
||||
def fabricate_via_api!
|
||||
Service::Runner.new(name).tap do |runner|
|
||||
Page::Project::Settings::CICD.perform do |settings|
|
||||
settings.expand_runners_settings do |runners|
|
||||
runner.pull
|
||||
runner.token = runners.registration_token
|
||||
runner.address = runners.coordinator_address
|
||||
runner.tags = tags
|
||||
runner.image = image
|
||||
runner.register!
|
||||
end
|
||||
end
|
||||
runner.pull
|
||||
runner.token = project.runners_token
|
||||
runner.address = Runtime::Scenario.gitlab_address
|
||||
runner.tags = tags
|
||||
runner.image = image
|
||||
runner.config = config if config
|
||||
runner.run_untagged = true
|
||||
runner.register!
|
||||
end
|
||||
end
|
||||
|
||||
def api_get_path
|
||||
end
|
||||
|
||||
def api_post_path
|
||||
end
|
||||
|
||||
def api_post_body
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,13 +7,25 @@ module QA
|
|||
class Runner
|
||||
include Service::Shellout
|
||||
|
||||
attr_accessor :token, :address, :tags, :image
|
||||
attr_accessor :token, :address, :tags, :image, :run_untagged
|
||||
attr_writer :config
|
||||
|
||||
def initialize(name)
|
||||
@image = 'gitlab/gitlab-runner:alpine'
|
||||
@name = name || "qa-runner-#{SecureRandom.hex(4)}"
|
||||
@network = Runtime::Scenario.attributes[:network] || 'test'
|
||||
@tags = %w[qa test]
|
||||
@run_untagged = false
|
||||
end
|
||||
|
||||
def config
|
||||
@config ||= <<~END
|
||||
concurrent = 1
|
||||
check_interval = 0
|
||||
|
||||
[session_server]
|
||||
session_timeout = 1800
|
||||
END
|
||||
end
|
||||
|
||||
def network
|
||||
|
@ -32,19 +44,30 @@ module QA
|
|||
shell <<~CMD.tr("\n", ' ')
|
||||
docker run -d --rm --entrypoint=/bin/sh
|
||||
--network #{network} --name #{@name}
|
||||
-p 8093:8093
|
||||
-e CI_SERVER_URL=#{@address}
|
||||
-e REGISTER_NON_INTERACTIVE=true
|
||||
-e REGISTRATION_TOKEN=#{@token}
|
||||
-e RUNNER_EXECUTOR=shell
|
||||
-e RUNNER_TAG_LIST=#{@tags.join(',')}
|
||||
-e RUNNER_NAME=#{@name}
|
||||
#{@image} -c 'gitlab-runner register && gitlab-runner run'
|
||||
#{@image} -c "#{register_command}"
|
||||
CMD
|
||||
end
|
||||
|
||||
def remove!
|
||||
shell "docker rm -f #{@name}"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def register_command
|
||||
<<~CMD
|
||||
printf '#{config.chomp.gsub(/\n/, "\\n").gsub('"', '\"')}' > /etc/gitlab-runner/config.toml &&
|
||||
gitlab-runner register --run-untagged=#{@run_untagged} &&
|
||||
gitlab-runner run
|
||||
CMD
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,11 +15,11 @@ module QA
|
|||
|
||||
Resource::Runner.fabricate! do |runner|
|
||||
runner.name = executor
|
||||
end
|
||||
end.project.visit!
|
||||
|
||||
Page::Project::Menu.perform(&:go_to_ci_cd_settings)
|
||||
Page::Project::Settings::CICD.perform do |settings|
|
||||
sleep 5 # Runner should register within 5 seconds
|
||||
settings.refresh
|
||||
|
||||
settings.expand_runners_settings do |page|
|
||||
expect(page).to have_content(executor)
|
||||
|
|
|
@ -17,7 +17,7 @@ module QA
|
|||
|
||||
@repository_location = @project.repository_ssh_location
|
||||
|
||||
Resource::Runner.fabricate_via_browser_ui! do |resource|
|
||||
Resource::Runner.fabricate_via_api! do |resource|
|
||||
resource.project = @project
|
||||
resource.name = @runner_name
|
||||
resource.tags = %w[qa docker]
|
||||
|
|
Loading…
Reference in a new issue