From 4cc5644b9d7e8cc7b5735bf4ffdc5a647bf16891 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Fri, 14 Jul 2023 13:41:45 +0100 Subject: [PATCH] test: :white_check_mark: update should run on step --- test/browser/features/steps/browser-steps.rb | 27 ++++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/test/browser/features/steps/browser-steps.rb b/test/browser/features/steps/browser-steps.rb index fafd74918..4b9226a2e 100644 --- a/test/browser/features/steps/browser-steps.rb +++ b/test/browser/features/steps/browser-steps.rb @@ -197,27 +197,32 @@ Then(/^on ((?:[A-Za-z]+ versions (?:>=?|<=?|==) [0-9.]+(?:, )?)+):$/) do |browser_specs, steps_to_run| spec_matcher = /^([A-Za-z]+) versions (>=?|<=?|==) ([0-9.]+)$/ + run_steps = false browser_specs.split(", ").each do |browser_spec| browser_spec.scan(spec_matcher) do |name, operator, version| should_run_steps = $browser.name.casecmp?(name) && $browser.version.send(operator, version.to_i) # make sure this step is debuggable! - $logger.debug("#{$browser.name} == #{name} && v#{$browser.version} #{operator} #{version}? #{should_run_steps}") - + $logger.debug("#{$browser.name} == #{name} && v#{$browser.version} #{operator} #{version}? #{should_run_steps}") + if should_run_steps - steps_to_run.each_line(chomp: true) do |step_to_run| - step(step_to_run) - end - else - indent = " " * 4 - # e.g. "a step\nanother step\n" -> " 1) a step\n 2) another step" - steps_indented = steps_to_run.each_line.map.with_index(1) { |step, i| "#{indent}#{i}) #{step.chomp}" }.join("\n") - - $logger.info("Skipping steps on #{$browser.name} v#{$browser.version}:\n#{steps_indented}") + run_steps = true end end end + + if run_steps + steps_to_run.each_line(chomp: true) do |step_to_run| + step(step_to_run) + end + else + indent = " " * 4 + # e.g. "a step\nanother step\n" -> " 1) a step\n 2) another step" + steps_indented = steps_to_run.each_line.map.with_index(1) { |step, i| "#{indent}#{i}) #{step.chomp}" }.join("\n") + + $logger.info("Skipping steps on #{$browser.name} v#{$browser.version}:\n#{steps_indented}") + end end module Maze