Travis: Fix in-browser tests setup

pull/7135/head
Aleksander Machniak 4 years ago
parent 53a111f8c3
commit 87304c29d1

@ -14,6 +14,7 @@ $config['smtp_port'] = 25;
// Settings required by the tests
$config['devel_mode'] = true;
$config['skin'] = 'elastic';
$config['support_url'] = 'http://support.url';

@ -6,18 +6,11 @@ DIR=$(dirname $0)
GMV=1.5.11
# Roundcube tests and instance configuration
sudo cp $DIR/config-test.inc.php $DIR/../config/config-test.inc.php
echo $?
cat $DIR/../config/config-test.inc.php
cp $DIR/config-test.inc.php $DIR/../config/config-test.inc.php
# In-Browser tests dependencies installation
# and GreenMail server setup and start
if [ $? = 0 ]
then
sudo apt-get -y install default-jre-headless
sudo wget http://central.maven.org/maven2/com/icegreen/greenmail-standalone/$GMV/greenmail-standalone-$GMV.jar
sudo java -Dgreenmail.setup.all -Dgreenmail.users=test:test -jar greenmail-standalone-$GMV.jar &
fi
echo $?
sudo apt-get -y install default-jre-headless \
wget http://central.maven.org/maven2/com/icegreen/greenmail-standalone/$GMV/greenmail-standalone-$GMV.jar \
&& (sudo java -Dgreenmail.setup.all -Dgreenmail.users=test:test -jar greenmail-standalone-$GMV.jar &) \
&& sleep 5

@ -70,6 +70,11 @@ abstract class DuskTestCase extends TestCase
Browser::$storeScreenshotsAt = __DIR__ . '/screenshots';
Browser::$storeConsoleLogAt = __DIR__ . '/console';
// This folder must exist in case Browser will try to write logs to it
if (!is_dir(Browser::$storeConsoleLogAt)) {
mkdir(Browser::$storeConsoleLogAt, 0777, true);
}
// Purge screenshots from the last test run
$pattern = sprintf('failure-%s_%s-*',
str_replace("\\", '_', get_class($this)),
@ -77,7 +82,23 @@ abstract class DuskTestCase extends TestCase
);
try {
$files = Finder::create()->files()->in(__DIR__ . '/screenshots')->name($pattern);
$files = Finder::create()->files()->in(Browser::$storeScreenshotsAt)->name($pattern);
foreach ($files as $file) {
@unlink($file->getRealPath());
}
}
catch (\Symfony\Component\Finder\Exception\DirectoryNotFoundException $e) {
// ignore missing screenshots directory
}
// Purge console logs from the last test run
$pattern = sprintf('%s_%s-*',
str_replace("\\", '_', get_class($this)),
$this->getName(false)
);
try {
$files = Finder::create()->files()->in(Browser::$storeConsoleLogAt)->name($pattern);
foreach ($files as $file) {
@unlink($file->getRealPath());
}

Loading…
Cancel
Save