summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/factory/README.md12
-rw-r--r--qa/qa/factory/repository/push.rb12
-rw-r--r--qa/qa/page/project/job/show.rb25
-rw-r--r--qa/qa/page/project/show.rb10
-rw-r--r--qa/spec/factory/repository/push_spec.rb26
5 files changed, 70 insertions, 15 deletions
diff --git a/qa/qa/factory/README.md b/qa/qa/factory/README.md
index c56c7c43129..10140e39510 100644
--- a/qa/qa/factory/README.md
+++ b/qa/qa/factory/README.md
@@ -254,8 +254,7 @@ module QA
project.name = 'project-to-create-a-shirt'
end
- # Attribute inherited from the Shirt factory if present,
- # or from the Browser UI otherwise (using the block)
+ # Attribute from the Browser UI (using the block)
product :brand do
Page::Shirt::Show.perform do |shirt_show|
shirt_show.fetch_brand_from_page
@@ -347,8 +346,7 @@ module QA
project.name = 'project-to-create-a-shirt'
end
- # Attribute fetched from the API response if present if present,
- # or from the Shirt factory if present,
+ # Attribute fetched from the API response if present,
# or from the Browser UI otherwise (using the block)
product :brand do
Page::Shirt::Show.perform do |shirt_show|
@@ -356,7 +354,7 @@ module QA
end
end
- # Attribute fetched from the API response if present if present,
+ # Attribute fetched from the API response if present,
# or from the Shirt factory if present,
# or a QA::Factory::Product::NoValueError is raised otherwise
product :name
@@ -414,9 +412,9 @@ end
**Notes on attributes precedence:**
- attributes from the API response take precedence over attributes from the
+ Browser UI
+- attributes from the Browser UI take precedence over attributes from the
factory (i.e inherited)
-- attributes from the factory (i.e inherited) take precedence over attributes
- from the Browser UI
- attributes without a value will raise a `QA::Factory::Product::NoValueError` error
## Creating resources in your tests
diff --git a/qa/qa/factory/repository/push.rb b/qa/qa/factory/repository/push.rb
index 6c5088f1da5..703c78daa99 100644
--- a/qa/qa/factory/repository/push.rb
+++ b/qa/qa/factory/repository/push.rb
@@ -30,6 +30,14 @@ module QA
@directory = dir
end
+ def files=(files)
+ if !files.is_a?(Array) || files.empty?
+ raise ArgumentError, "Please provide an array of hashes e.g.: [{name: 'file1', content: 'foo'}]"
+ end
+
+ @files = files
+ end
+
def fabricate!
Git::Repository.perform do |repository|
if ssh_key
@@ -63,6 +71,10 @@ module QA
@directory.each_child do |f|
repository.add_file(f.basename, f.read) if f.file?
end
+ elsif @files
+ @files.each do |f|
+ repository.add_file(f[:name], f[:content])
+ end
else
repository.add_file(file_name, file_content)
end
diff --git a/qa/qa/page/project/job/show.rb b/qa/qa/page/project/job/show.rb
index 5baf6439cfc..d688f15914c 100644
--- a/qa/qa/page/project/job/show.rb
+++ b/qa/qa/page/project/job/show.rb
@@ -4,30 +4,39 @@ module QA::Page
COMPLETED_STATUSES = %w[passed failed canceled blocked skipped manual].freeze # excludes created, pending, running
PASSED_STATUS = 'passed'.freeze
- view 'app/views/shared/builds/_build_output.html.haml' do
- element :build_output, '.js-build-output' # rubocop:disable QA/ElementWithPattern
- element :loading_animation, '.js-build-refresh' # rubocop:disable QA/ElementWithPattern
+ view 'app/assets/javascripts/jobs/components/job_app.vue' do
+ element :loading_animation
+ end
+
+ view 'app/assets/javascripts/jobs/components/job_log.vue' do
+ element :build_trace
end
view 'app/assets/javascripts/vue_shared/components/ci_badge_link.vue' do
- element :status_badge, 'ci-status' # rubocop:disable QA/ElementWithPattern
+ element :status_badge
end
def completed?
- COMPLETED_STATUSES.include? find('.ci-status').text
+ COMPLETED_STATUSES.include?(status_badge)
end
def passed?
- find('.ci-status').text == PASSED_STATUS
+ status_badge == PASSED_STATUS
end
def trace_loading?
- has_css?('.js-build-refresh')
+ has_element?(:loading_animation)
end
# Reminder: You may wish to wait for a particular job status before checking output
def output
- find('.js-build-output').text
+ find_element(:build_trace).text
+ end
+
+ private
+
+ def status_badge
+ find_element(:status_badge).text
end
end
end
diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb
index fcc4bb79c10..d6dddf03ffb 100644
--- a/qa/qa/page/project/show.rb
+++ b/qa/qa/page/project/show.rb
@@ -42,6 +42,10 @@ module QA
element :web_ide_button
end
+ view 'app/views/projects/tree/_tree_content.html.haml' do
+ element :file_tree
+ end
+
def project_name
find('.qa-project-name').text
end
@@ -51,6 +55,12 @@ module QA
click_element :new_file_option
end
+ def go_to_file(filename)
+ within_element(:file_tree) do
+ click_on filename
+ end
+ end
+
def switch_to_branch(branch_name)
find_element(:branches_select).click
diff --git a/qa/spec/factory/repository/push_spec.rb b/qa/spec/factory/repository/push_spec.rb
new file mode 100644
index 00000000000..2eb6c008248
--- /dev/null
+++ b/qa/spec/factory/repository/push_spec.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+describe QA::Factory::Repository::Push do
+ describe '.files=' do
+ let(:files) do
+ [
+ {
+ name: 'file.txt',
+ content: 'foo'
+ }
+ ]
+ end
+
+ it 'raises an error if files is not an array' do
+ expect { subject.files = '' }.to raise_error(ArgumentError)
+ end
+
+ it 'raises an error if files is an empty array' do
+ expect { subject.files = [] }.to raise_error(ArgumentError)
+ end
+
+ it 'does not raise if files is an array' do
+ expect { subject.files = files }.not_to raise_error
+ end
+ end
+end