Commit 09d3270c authored by Lisa Seeto's avatar Lisa Seeto Committed by Gerrit Code Review
Browse files

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

parents 90380c77 4fa31c5e
......@@ -2429,6 +2429,11 @@ JS;
if (!file_exists($CFG->behat_dataroot . '/behat/html_results/screenshots/custom/')) {
mkdir($CFG->behat_dataroot . '/behat/html_results/screenshots/custom/', $CFG->directorypermissions, true);
}
file_put_contents($file_and_path, $image_data);
$out = file_put_contents($file_and_path, $image_data);
if (!empty($CFG->behat_view_screenshots) && $out !== false && $eog = exec('apt-cache policy eog | grep Installed')) { // Ubuntu
if (!preg_match('/Installed\: \(none\)/', $eog)) {
exec('eog ' . $file_and_path . " > /dev/null 2>/dev/null &");
}
}
}
}
......@@ -311,7 +311,14 @@ class BehatHooks extends BehatBase {
}
// For Selenium2 Driver you can use:
file_put_contents($CFG->behat_dataroot . '/behat/html_results/screenshots/' . $featureFolder . '/' . $fileName, $this->getSession()->getDriver()->getScreenshot());
$screenshotfile = $CFG->behat_dataroot . '/behat/html_results/screenshots/' . $featureFolder . '/' . $fileName;
$out = file_put_contents($screenshotfile, $this->getSession()->getDriver()->getScreenshot());
if (!empty($CFG->behat_view_screenshots) && $out !== false && $eog = exec('apt-cache policy eog | grep Installed')) { // Ubuntu
if (!preg_match('/Installed\: \(none\)/', $eog)) {
exec('eog ' . $screenshotfile . " > /dev/null 2>/dev/null &");
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment