diff options
-rw-r--r-- | qa/qa/page/merge_request/show.rb | 18 | ||||
-rw-r--r-- | qa/qa/specs/features/performance/merge_request/add_comment_to_mr_spec.rb | 13 | ||||
-rw-r--r-- | qa/spec/specs/runner_spec.rb | 9 |
3 files changed, 32 insertions, 8 deletions
diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index 7b8fb275a72..70d8b6df430 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -157,6 +157,15 @@ module QA click_element :diffs_tab end + def add_comment_to_diff(text) + wait(interval: 5) do + has_text?("No newline at end of file") + end + all_elements(:new_diff_line).first.hover + click_element :diff_comment + fill_element :reply_input, text + end + def comment click_element :reply_comment_button end @@ -169,18 +178,13 @@ module QA end def reply_to_discussion(reply_text) - wait(interval: 5) do - has_element? :discussion_reply - end all_elements(:discussion_reply).first.click fill_element :reply_input, reply_text end def expand_diff - wait(interval: 5) do - has_element? :click_to_expand - end - all_elements(:click_to_expand).first.click + sleep 3 + all_elements(:click_to_expand).last.click wait(interval: 5) do has_text?("No newline at end of file") end diff --git a/qa/qa/specs/features/performance/merge_request/add_comment_to_mr_spec.rb b/qa/qa/specs/features/performance/merge_request/add_comment_to_mr_spec.rb index 53de658b442..c88dabceab1 100644 --- a/qa/qa/specs/features/performance/merge_request/add_comment_to_mr_spec.rb +++ b/qa/qa/specs/features/performance/merge_request/add_comment_to_mr_spec.rb @@ -1,4 +1,10 @@ # frozen_string_literal: true + +# The pre-requisite for this spec is to run the rake task : rake generate_perf_testdata +# See `/qa/qa/tools/generate_perf_testdata.rb file` for the script that generates testdata. +# This generates a 'urls.yml' file, which is used as an input in this spec. +# Alternatively, the values can be fetched from the environment variables: URLS_FILE_PATH, HOST_URL, LARGE_ISSUE_URL, LARGE_MR_URL + require 'yaml' require 'uri' require 'benchmark' @@ -26,7 +32,7 @@ module QA it 'user adds comment to a large mr' do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } + Page::Main::Login.perform(&:sign_in_using_credentials) samples_arr = [] apdex_score = 0 @@ -42,10 +48,15 @@ module QA show_page.comment end end + QA::Runtime::Logger.info "Samples Array: #{samples_arr}" + QA::Runtime::Logger.info "Response Threshold: #{response_threshold}" apdex_score = show_page.apdex(samples_arr, response_threshold) page_load_time = show_page.page_load_time end + QA::Runtime::Logger.info "Page Load Time: #{page_load_time}" + QA::Runtime::Logger.info "Apdex Score: #{apdex_score}" + expect(page_load_time < page_load_threshold).to be true expect((apdex_score >= 0.5) && (apdex_score <= 1.0)).to be true end diff --git a/qa/spec/specs/runner_spec.rb b/qa/spec/specs/runner_spec.rb index 8f99e050d02..df953799ce3 100644 --- a/qa/spec/specs/runner_spec.rb +++ b/qa/spec/specs/runner_spec.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true describe QA::Specs::Runner do + include Helpers::StubENV + context '#perform' do before do allow(QA::Runtime::Browser).to receive(:configure!) @@ -12,6 +14,13 @@ describe QA::Specs::Runner do subject.perform end + it 'includes the performance tag when ENV["PERFORMANCE"] is set' do + stub_env('PERFORMANCE', 'true') + expect_rspec_runner_arguments(['--tag', '~orchestrated', *described_class::DEFAULT_TEST_PATH_ARGS]) + + subject.perform + end + context 'when tty is set' do subject { described_class.new.tap { |runner| runner.tty = true } } |