user8745303
user8745303

Reputation: 39

How to change the screenshot path in Rails 5.1 system test

Using Rails 5.1.2 Creating a system test and using the take_screenshot method.

How do i change the location these screenshots are created at?

Upvotes: 1

Views: 286

Answers (2)

John Bachir
John Bachir

Reputation: 22731

If you want to do this on CI, here's the solution I came up with. In my setup I already had a "test-runner.sh" script, with the rspec invocation at the end. There's probably also some sort of after_script: setting in the yml config also available, but I didn't look into it.

rspec ......

status=$?

# /tmp/test-results is where CircleCI looks for "artifacts" which it makes
# available for download after a test run
[ -d "tmp/screenshots" ] && cp -a tmp/screenshots /tmp/test-results/

exit $status

Upvotes: 0

Simple Lime
Simple Lime

Reputation: 11035

Looks like the image path is hardcoded in, so you won't be able to change it currently. Probably wouldn't be too difficult to change if you wanted to open an issue over there or create a pull request for them.

Upvotes: 1

Related Questions