Better options when it comes to making screenshots in behat

Bug #1902318 reported by Robert Lyon
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Wishlist
Unassigned

Bug Description

Currently there is some code for creating a screenshot on step failure but it's not very useful as it saves the screenshot to dataroot with the name of the scenario as a subdir and feature as the name of the image file but when a step fails the error output mentions the feature file and step line so it's hard to quickly work out what screenshot is for what failure.

Changes I want to implement:

1) Get the step fail screenshot to be better named, eg have the name of the feature file path be the subdir, eg for social/delete_page_collection_group.feature it makes social__delete_page_collection_group and for the screenshot it makes have the text of the failed step and line number, eg IloginasUserBwithpasswordKupuh1pa_line48.png

2) Create a step in BehatGeneral so that we can force a screenshot as it's own step so we can get multiple screenshots during a feature so that we can see what is happening before a failure. Because the step will be named specifically for making a screenshot we will need to allow the passing in of a variable to save the screenshot as, eg And show me a screenshot named "One", And show me a screenshot named "Two" etc.

3) For Ubuntu allow the system to open up the screenshot in image viewer without stopping behat running so that whether it's a failure screenshot or specified screenshot step we get to view the images without needing to hunt for them in the dataroot

Tags: newfeature
Revision history for this message
Robert Lyon (robertl-9) wrote :

For point 1 and 2 we have patch https://reviews.mahara.org/#/c/11414/
For point 3 we havehttps://reviews.mahara.org/#/c/11415/

Changed in mahara:
status: New → In Progress
importance: Undecided → Wishlist
milestone: none → 21.04.0
Revision history for this message
Robert Lyon (robertl-9) wrote :
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/11414
Committed: https://git.mahara.org/mahara/mahara/commit/ddbe0e6053b7dd05ca6876d811d85bceb7a14034
Submitter: Lisa Seeto (<email address hidden>)
Branch: master

commit ddbe0e6053b7dd05ca6876d811d85bceb7a14034
Author: Robert Lyon <email address hidden>
Date: Fri Oct 30 14:22:11 2020 +1300

Bug 1902318: Behat screenshot changes

The after step fail screenshot is now named based on
feature file / step text + line number to make it easier to find

Added a new feature step called
And show me a screenshot named "X"

which will save a screenshot to the dataroot
behat/html_output/screenshot/custom/ directory

This is useful to see snapshots at any point (not just fail), eg

And show me a screenshot named "1"
And I click on "XYZ"
And show me a screenshot named "2"
And I press "ABC"
And show me a screenshot named "3"

Change-Id: I3446dd57a2c79d14c0e52239ce188a22d8ff09c7
Signed-off-by: Robert Lyon <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/11415
Committed: https://git.mahara.org/mahara/mahara/commit/4fa31c5eccc1b733ec94724aa0f216a30fefafc7
Submitter: Lisa Seeto (<email address hidden>)
Branch: master

commit 4fa31c5eccc1b733ec94724aa0f216a30fefafc7
Author: Robert Lyon <email address hidden>
Date: Fri Oct 30 16:50:21 2020 +1300

Bug 1902318: Allow to have screenshots open on Ubuntu image viewer

If you set

$cfg->behat_view_screenshots = true;

in your config.php file

Change-Id: I8121ffb7b585c5126bc9f10b69e89c04330aa2fe
Signed-off-by: Robert Lyon <email address hidden>

Lisa Seeto (lisaseeto)
Changed in mahara:
status: In Progress → Fix Committed
tags: added: newfeature
Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.