run_test_suite --image-bumping-mode fails: wrong number of arguments (given 13, expected 6) (ArgumentError)
Both when doing "automatic bump" and "retry image" (the latter after updating the image), return Match.new(image, @screen, *p)
crashes like this:
a: Automatic bump
r: Retry image (pro tip: manually update the image first!)
i: Ignore this image for the remaining of the run
d: Debugging REPL
q: Abort (to the FindFailed exception)
Found match! Accept? (y/n)
# Then the Unsafe Browser runs as the expected user
# And the Unsafe Browser has a red theme
# And the Unsafe Browser shows a warning as its start page
# And the Unsafe Browser has no add-ons installed
And the Unsafe Browser has only Firefox's default bookmarks configured # features/step_definitions/unsafe_browser.rb:11
wrong number of arguments (given 13, expected 6) (ArgumentError)
./features/support/helpers/screen.rb:7:in `initialize'
./features/support/helpers/screen.rb:420:in `new'
./features/support/helpers/screen.rb:420:in `block in interactive_image_bump'
./features/support/helpers/screen.rb:380:in `loop'
./features/support/helpers/screen.rb:380:in `interactive_image_bump'
./features/support/helpers/screen.rb:448:in `rescue in block (2 levels) in <class:ImageBumpingScreen>'
./features/support/helpers/screen.rb:444:in `block (2 levels) in <class:ImageBumpingScreen>'
I see that the p
variable (that comes from OpenCV.matchTemplate
, which itelf gets it from the stdout of opencv_match_template.py
) contains 11 elements: 7 times "0", followed by the 4 elements we're expecting here.
Disabling "show match" fixes it:
--- a/features/support/helpers/screen.rb
+++ b/features/support/helpers/screen.rb
@@ -391,7 +391,7 @@ class ImageBumpingScreen
when 'a'
[0.80, 0.70, 0.60, 0.50, 0.40, 0.30].each do |sensitivity|
warn "Trying with sensitivity #{sensitivity}..."
- p = @screen.match_screen(image, sensitivity, true)
+ p = @screen.match_screen(image, sensitivity, false)
next unless p
warn 'Found match! Accept? (y/n)'
@@ -409,7 +409,7 @@ class ImageBumpingScreen
end
warn 'Failed to automatically bump image'
when 'r'
- p = @screen.match_screen(image, opts[:sensitivity], true)
+ p = @screen.match_screen(image, opts[:sensitivity], false)
if p.nil?
warn 'Failed to find image'
else
… but it's not a good solution because in these situations we do need to inspect the new match before accepting it.
If I run opencv_match_template.py SCREENSHOT EXPECTED_IMAGE 0.9 true
(i.e. with "show match" enabled) manually, I see it prints the 4 integers we're expecting. I did not debug this further.
Edited by intrigeri