Bugfix: Prevent error when there is no screenshot
What does this MR do and why?
Resolves #35 (closed)
When a test failure occurs and the screenshot fails, this gem produces a runtime error:
https://ops.gitlab.net/gitlab-org/quality/staging-canary/-/jobs/11967922#L1621
/builds/gitlab-org/quality/staging-canary/.gems/gems/gitlab_quality-test_tooling-1.5.3/lib/gitlab_quality/test_tooling/report/update_screenshot_path.rb:70:in `remove_container_absolute_path_prefix': undefined method `gsub' for nil:NilClass (NoMethodError)
from /builds/gitlab-org/quality/staging-canary/.gems/gems/gitlab_quality-test_tooling-1.5.3/lib/gitlab_quality/test_tooling/report/update_screenshot_path.rb:64:in `block (2 levels) in rewrite_each_json_screenshot_path'
from /builds/gitlab-org/quality/staging-canary/.gems/gems/gitlab_quality-test_tooling-1.5.3/lib/gitlab_quality/test_tooling/report/update_screenshot_path.rb:60:in `each'
from /builds/gitlab-org/quality/staging-canary/.gems/gems/gitlab_quality-test_tooling-1.5.3/lib/gitlab_quality/test_tooling/report/update_screenshot_path.rb:60:in `block in rewrite_each_json_screenshot_path'
from <internal:kernel>:90:in `tap'
from /builds/gitlab-org/quality/staging-canary/.gems/gems/gitlab_quality-test_tooling-1.5.3/lib/gitlab_quality/test_tooling/report/update_screenshot_path.rb:57:in `rewrite_each_json_screenshot_path'
from /builds/gitlab-org/quality/staging-canary/.gems/gems/gitlab_quality-test_tooling-1.5.3/lib/gitlab_quality/test_tooling/report/update_screenshot_path.rb:41:in `rewrite_schreenshot_paths_in_json_file'
from /builds/gitlab-org/quality/staging-canary/.gems/gems/gitlab_quality-test_tooling-1.5.3/lib/gitlab_quality/test_tooling/report/update_screenshot_path.rb:20:in `block in invoke!'
from /builds/gitlab-org/quality/staging-canary/.gems/gems/gitlab_quality-test_tooling-1.5.3/lib/gitlab_quality/test_tooling/report/update_screenshot_path.rb:18:in `each'
from /builds/gitlab-org/quality/staging-canary/.gems/gems/gitlab_quality-test_tooling-1.5.3/lib/gitlab_quality/test_tooling/report/update_screenshot_path.rb:18:in `invoke!'
from /builds/gitlab-org/quality/staging-canary/.gems/gems/gitlab_quality-test_tooling-1.5.3/exe/update-screenshot-paths:34:in `<top (required)>'
from /builds/gitlab-org/quality/staging-canary/.gems/bin/update-screenshot-paths:25:in `load'
from /builds/gitlab-org/quality/staging-canary/.gems/bin/update-screenshot-paths:25:in `<main>'
This MR ensures there is an image
element in the json and also fixes some typos.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Closes #35 (closed)