Class: Dri::Commands::Fetch::Testcases
- Inherits:
-
Dri::Command
- Object
- Dri::Command
- Dri::Commands::Fetch::Testcases
- Defined in:
- lib/dri/commands/fetch/testcases.rb
Instance Method Summary collapse
-
#execute(_input: $stdin, output: $stdout) ⇒ Object
rubocop:disable Metrics/AbcSize.
-
#initialize(options) ⇒ Testcases
constructor
A new instance of Testcases.
Methods inherited from Dri::Command
#add_color, #api_client, #bold, #command, #config, #cursor, #editor, #emoji, #handover_report_path, #logger, #ops_token, #pastel, #profile, #prompt, #spinner, #timezone, #token, #username, #verify_config_exists
Constructor Details
#initialize(options) ⇒ Testcases
Returns a new instance of Testcases.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/dri/commands/fetch/testcases.rb', line 11 def initialize() @options = @available_pipelines = %w[ main canary master production staging-canary staging-ref staging ] end |
Instance Method Details
#execute(_input: $stdin, output: $stdout) ⇒ Object
rubocop:disable Metrics/AbcSize
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/dri/commands/fetch/testcases.rb', line 24 def execute(_input: $stdin, output: $stdout) # rubocop:disable Metrics/AbcSize verify_config_exists if @options[:filter_pipelines] filtered_pipelines = prompt.multi_select("Select pipelines:", @available_pipelines) end logger.info "Fetching currently failing testcases..." title_label = add_color('Title:', :bright_yellow) url_label = add_color('URL:', :bright_yellow) divider = add_color('---', :cyan) spinner.start pipelines = @options[:filter_pipelines] ? filtered_pipelines : @available_pipelines logger.error "No pipelines selected to continue to fetch testcases." if pipelines.empty? pipelines.each do |pipeline| logger.info "Fetching failing testcases in #{pipeline}\n" response = api_client.fetch_failing_testcases(pipeline, state: 'opened') output.puts "♦♦♦♦♦ #{add_color(pipeline, :black, :on_white)}♦♦♦♦♦\n\n" response.each do |test_case| output.puts "#{title_label} #{test_case.title}\n#{url_label} #{test_case.web_url}" output.puts "#{divider}\n" end end spinner.stop end |