Public bug reported: 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? ** Affects: mahara Importance: Undecided Status: New ** Tags: behat-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: New 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? To manage notifications about this bug go to: https://bugs.launchpad.net/mahara/+bug/1892820/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~mahara-contributors Post to : mahara-contributors@lists.launchpad.net Unsubscribe : https://launchpad.net/~mahara-contributors More help : https://help.launchpad.net/ListHelp