Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error while embedding images & no pretty_face report when put as default profile #29

Open
shekss opened this issue May 13, 2014 · 0 comments

Comments

@shekss
Copy link

shekss commented May 13, 2014

hi ,

i have the below code in my env.rb to generate screenshots for failed and passed scenarios.

def take_screenshot(scenario)
if scenario.failed?
scenario_name = scenario.name.gsub /[^\w-]/, ' '
time = Time.now.strftime("%Y-%m-%d %H%M")
Dir.mkdir("failed_png") unless File.directory?("failed_png")
filename = time + ' - ' + scenario_name + '.png'
screenshot_path = './failed_png/' + filename
save_screenshot(screenshot_path)
embed ('../../failed_png/' + filename), 'image/png'
else
scenario_name = scenario.name.gsub /[^\w-]/, ' '
time = Time.now.strftime("%Y-%m-%d %H%M")
Dir.mkdir("success_png") unless File.directory?("success_png")
filename = time + ' - ' + scenario_name + '.png'
screenshot_path = './success_png/' + filename
save_screenshot(screenshot_path)
embed ('../../success_png/' + filename), 'image/png'
end
end
After do |scenario|
take_screenshot(scenario)
end

the above code creates images in my success_png folder . here below the snap shot of my folder structure .

image

when i do this , i get the pretty face report of my scenario, image is displayed correctly but i get the failure scenario due to the error in the command line like below:

image

and when i inspect the image in pretty face report html, i can see the path is valid and i can see the image when i click , but why this error? here is the src in the pretty_face html report

src="images/../../success_png/2014-05-13 0949 - Valid Login.png"

due to this my scenarios are failing. can u let me know what i shall do to get rid of the this error . i am using pretty_face version 0.10.1 with actionpack 4.0.4.

another issue , i am facing is , no matter what if i put the pretty_face arguments like this in default yml file in cucumber, it doesnt run the report. i have to always put a seperate profile in the yml for generating pretty_face report. i am doing something wrong ?

default: --format pretty --tag ~@wip --format PrettyFace::Formatter::Html --out results/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant