Skip to content

Commit

Permalink
Update RoboFile and composer dependencies for system testing in Jooml…
Browse files Browse the repository at this point in the history
…a 4 (#20032)

* Updated RoboFile and composer dependencies for system testing

* Updated RoboFile and composer dependencies for system testing
  • Loading branch information
yvesh authored and rdeutz committed Mar 30, 2018
1 parent e933e44 commit ad3cdcb
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 157 deletions.
118 changes: 11 additions & 107 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
/**
* This is joomla project's console command file for Robo.li task runner.
*
* Or do: $ composer install, and afterwards you will be able to execute robo like
* $ ./libraries/vendor/bin/robo
* Do a `$ composer install` afterwards you will be able to execute robo like
* `$ ./libraries/vendor/bin/robo` to see a list of commands
*
* @see http://robo.li/
*/
Expand All @@ -31,6 +31,8 @@
*/
class RoboFile extends \Robo\Tasks
{
use JoomlaRobo\Tasks;

/**
* Path to the vendor folder
*
Expand Down Expand Up @@ -235,43 +237,6 @@ protected function copyJoomla($dst, $exclude = array())
closedir($dir);
}

/**
* Downloads Composer
*
* @since 3.7.3
*
* @return void
*/
private function getComposer()
{
// Make sure we have Composer
if (!file_exists($this->vendorPath . 'composer.phar'))
{
$this->_exec('curl -o ' . $this->vendorPath . 'composer.phar --retry 3 --retry-delay 5 -sS https://getcomposer.org/installer | php');
}
}

/**
* Runs Selenium Standalone Server.
*
* @since 3.7.3
*
* @return void
*/
public function runSelenium()
{
if (!$this->isWindows())
{
$this->_exec($this->vendorPath . "bin/selenium-server-standalone " . $this->getWebDriver() . ' >> selenium.log 2>&1 &');
}
else
{
$this->_exec("START java.exe -jar " . $this->getWebDriver() . ' ' . $this->vendorPath . 'joomla-projects\selenium-server-standalone\bin\selenium-server-standalone.jar ');
}

sleep(3);
}

/**
* Executes all the Selenium System Tests in a suite on your machine
*
Expand All @@ -289,7 +254,9 @@ public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop'])

$this->createTestingSite($opts['use-htaccess']);

$this->runSelenium();
$this->taskRunSelenium('libraries/vendor/joomla-projects/selenium-server-standalone', $this->getWebdriver())->run();

sleep(3);

// Make sure to run the build command to generate AcceptanceTester
if ($this->isWindows())
Expand Down Expand Up @@ -335,7 +302,7 @@ public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop'])
*/
public function runTest($pathToTestFile = null, $suite = 'acceptance')
{
$this->runSelenium();
$this->taskRunSelenium('libraries/vendor/joomla-projects/selenium-server-standalone/bin', $this->getWebdriver());

// Make sure to run the build command to generate AcceptanceTester
$path = $this->vendorPath . 'bin/codecept';
Expand Down Expand Up @@ -470,73 +437,10 @@ private function getWindowsPath($path)
*/
public function getWebdriver()
{
$suiteConfig = $this->getSuiteConfig();
$codeceptMainConfig = \Codeception\Configuration::config();
$browser = $suiteConfig['modules']['config']['JoomlaBrowser']['browser'];

if ($browser == 'chrome')
{
$driver['type'] = 'webdriver.chrome.driver';
}
elseif ($browser == 'firefox')
{
$driver['type'] = 'webdriver.gecko.driver';
}
elseif ($browser == 'MicrosoftEdge')
{
$driver['type'] = 'webdriver.edge.driver';

// Check if we are using Windows Insider builds
if ($suiteConfig['modules']['config']['AcceptanceHelper']['MicrosoftEdgeInsiders'])
{
$browser = 'MicrosoftEdgeInsiders';
}
}
elseif ($browser == 'internet explorer')
{
$driver['type'] = 'webdriver.ie.driver';
}

// Check if we have a path for this browser and OS in the codeception settings
if (isset($codeceptMainConfig['webdrivers'][$browser][$this->getOs()]))
{
$driverPath = $codeceptMainConfig['webdrivers'][$browser][$this->getOs()];
}
else
{
$this->yell('No driver for your browser. Check your browser in acceptance.suite.yml and the webDrivers in codeception.yml');

// We can't do anything without a driver, exit
exit(1);
}

$driver['path'] = $driverPath;

return '-D' . implode('=', $driver);
}

/**
* Return the os name
*
* @return string
*
* @since 3.7.3
*/
private function getOs()
{
$os = php_uname('s');

if (strpos(strtolower($os), 'windows') !== false)
{
return 'windows';
}

if (strpos(strtolower($os), 'darwin') !== false)
{
return 'mac';
}
$suiteConfig = $this->getSuiteConfig();
$driver = $suiteConfig['modules']['config']['JoomlaBrowser']['browser'];

return 'linux';
return $driver;
}

/**
Expand Down
34 changes: 0 additions & 34 deletions acceptance.suite.yml

This file was deleted.

1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"friendsofphp/php-cs-fixer": "~1.11",
"squizlabs/php_codesniffer": "~1.5",
"joomla-projects/joomla-browser": "~4.0@dev",
"joomla-projects/robo-joomla": "dev-develop",
"joomla/test-system": "dev-master"
}
}
69 changes: 53 additions & 16 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ad3cdcb

Please sign in to comment.