mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #60300
[Bug 1892820] Re: Behat: Add "take a screenshot" step
** Changed in: mahara
Assignee: (unassigned) => Rebecca Blundell (rjb-dev)
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1892820
Title:
Behat: Add "take a screenshot" step
Status in Mahara:
Confirmed
Bug description:
It might help our regression testing if we could add screenshot steps
in tests, so that a tester could run the test suite and afterwards
check a folder of screenshots to make sure that the pages look like
they are supposed to.
We can add a step to call the Mink saveScreenshot() function. This
works:
/**
* Save a screenshot for regression testing purposes
*
* @Then I take a screenshot as :filename
*/
public function take_screenshot($filename) {
if (!$this->running_javascript()) {
return false;
}
$path = get_config('dataroot') . 'behat';
$this->saveScreenshot($filename, $path);
}
A limitation of the above is that only the part of the page that is visible is captured. In Chrome dev-tools there is the following option: https://www.howtogeek.com/423558/how-to-take-full-page-screenshots-in-google-chrome-without-using-an-extension/
So now I wonder whether we could write a step to utilise that functionality rather than calling saveScreenshot as above.
Things to consider:
Will these steps be slow?
Do we need to tag tests that use them in a different way, and only run when regression testing is required? Or some other idea?
A couple of other things to consider:
This extension: https://github.com/elvetemedve/behat-screenshot. The discussion suggests it does provide full page capture, but it seems people are having trouble with it: https://github.com/elvetemedve/behat-screenshot/issues/26
There is also this one, which says it bypasses selenium and uses
chrome directly with a reduction of overhead: https://gitlab.com/DMore
/behat-chrome-extension (this is probably heading out of scope for the
screenshot problem, but is an interesting idea, particularly as it
apparently reduces test time by at least 2/3rds.
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1892820/+subscriptions
References