mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-11-15 17:17:08 +00:00
Update new tests support (WIP)
This commit is contained in:
parent
84a98f9718
commit
26a3f69317
781
RoboFile.php
781
RoboFile.php
@ -1,18 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* This is project's console commands configuration for Robo task runner.
|
||||
*
|
||||
* Download robo.phar from http://robo.li/robo.phar and type in the root of the repo: $ php robo.phar
|
||||
* Or do: $ composer update, and afterwards you will be able to execute robo like $ php vendor/bin/robo
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage RoboFile
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
|
||||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
require_once 'vendor/autoload.php';
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @see http://robo.li/
|
||||
*/
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
if (!defined('JPATH_BASE'))
|
||||
{
|
||||
@ -20,54 +23,64 @@ if (!defined('JPATH_BASE'))
|
||||
}
|
||||
|
||||
/**
|
||||
* Modern php task runner for Joomla! Browser Automated Tests execution
|
||||
* System Test (Codeception) test execution for Joomla!
|
||||
*
|
||||
* @package RoboFile
|
||||
*
|
||||
* @since 1.0
|
||||
* @since 3.7.3
|
||||
*/
|
||||
class RoboFile extends \Robo\Tasks
|
||||
{
|
||||
// Load tasks from composer, see composer.json
|
||||
use \joomla_projects\robo\loadTasks;
|
||||
use \Joomla\Jorobo\Tasks\loadTasks;
|
||||
|
||||
/**
|
||||
* File extension for executables
|
||||
*
|
||||
* @var string
|
||||
* @since 3.7.3
|
||||
*/
|
||||
private $executableExtension = '';
|
||||
|
||||
/**
|
||||
* Path to the codeception tests folder
|
||||
*
|
||||
* @var string
|
||||
* @since 3.7.3
|
||||
*/
|
||||
private $testsPath = 'tests/';
|
||||
|
||||
/**
|
||||
* Local configuration parameters
|
||||
*
|
||||
* @var array
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
private $configuration = array();
|
||||
|
||||
/**
|
||||
* Path to the local CMS root
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $cmsPath = '';
|
||||
|
||||
/**
|
||||
* @var array | null
|
||||
* @since version
|
||||
* @since 3.7.3
|
||||
*/
|
||||
private $suiteConfig;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Path to the local CMS test folder
|
||||
*
|
||||
* @var string
|
||||
* @since 3.7.3
|
||||
*/
|
||||
protected $cmsPath = null;
|
||||
|
||||
/**
|
||||
* RoboFile constructor.
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->configuration = $this->getConfiguration();
|
||||
|
||||
$this->cmsPath = $this->getCmsPath();
|
||||
|
||||
$this->configuration = $this->getConfiguration();
|
||||
$this->cmsPath = $this->getTestingPath();
|
||||
$this->executableExtension = $this->getExecutableExtension();
|
||||
|
||||
// Set default timezone (so no warnings are generated if it is not set)
|
||||
@ -77,234 +90,82 @@ class RoboFile extends \Robo\Tasks
|
||||
/**
|
||||
* Get the executable extension according to Operating System
|
||||
*
|
||||
* @return void
|
||||
* @return
|
||||
*/
|
||||
private function getExecutableExtension()
|
||||
{
|
||||
if ($this->isWindows())
|
||||
{
|
||||
// Check wehter git.exe or git as command should be used,
|
||||
// As on window both is possible
|
||||
if (!$this->_exec('git.exe --version')->getMessage())
|
||||
{
|
||||
return '';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '.exe';
|
||||
}
|
||||
return '.exe';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes all the Selenium System Tests in a suite on your machine
|
||||
* Get (optional) configuration from an external file
|
||||
*
|
||||
* @param array $opts Array of configuration options:
|
||||
* - 'use-htaccess': renames and enable embedded Joomla .htaccess file
|
||||
* - 'env': set a specific environment to get configuration from
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return mixed
|
||||
* @return \stdClass|null
|
||||
*/
|
||||
public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop'])
|
||||
public function getConfiguration()
|
||||
{
|
||||
$this->createTestingSite($opts['use-htaccess']);
|
||||
$configurationFile = __DIR__ . '/RoboFile.ini';
|
||||
|
||||
$this->getComposer();
|
||||
if (!file_exists($configurationFile))
|
||||
{
|
||||
$this->say('No local configuration file');
|
||||
|
||||
$this->taskComposerInstall()->run();
|
||||
|
||||
$this->runSelenium();
|
||||
|
||||
// Make sure to run the build command to generate AcceptanceTester
|
||||
$this->_exec($this->isWindows() ? 'vendor\bin\codecept.bat build' : 'php vendor/bin/codecept build');
|
||||
|
||||
$this->taskCodecept()
|
||||
->arg('--steps')
|
||||
->arg('--debug')
|
||||
->arg('--fail-fast')
|
||||
->env($opts['env'])
|
||||
->arg('tests/acceptance/install/')
|
||||
->run()
|
||||
->stopOnFail();
|
||||
|
||||
$this->taskCodecept()
|
||||
->arg('--steps')
|
||||
->arg('--debug')
|
||||
->arg('--fail-fast')
|
||||
->env($opts['env'])
|
||||
->arg('tests/acceptance/administrator/')
|
||||
->run()
|
||||
->stopOnFail();
|
||||
|
||||
$this->taskCodecept()
|
||||
->arg('--steps')
|
||||
->arg('--debug')
|
||||
->arg('--fail-fast')
|
||||
->env($opts['env'])
|
||||
->arg('tests/acceptance/frontend/')
|
||||
->run()
|
||||
->stopOnFail();
|
||||
|
||||
/*
|
||||
Uncomment this lines if you need to debug selenium errors
|
||||
$seleniumErrors = file_get_contents('selenium.log');
|
||||
if ($seleniumErrors) {
|
||||
$this->say('Printing Selenium Log files');
|
||||
$this->say('------ selenium.log (start) ---------');
|
||||
$this->say($seleniumErrors);
|
||||
$this->say('------ selenium.log (end) -----------');
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
|
||||
$configuration = parse_ini_file($configurationFile);
|
||||
|
||||
if ($configuration === false)
|
||||
{
|
||||
$this->say('Local configuration file is empty or wrong (check is it in correct .ini format');
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return json_decode(json_encode($configuration));
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a specific Selenium System Tests in your machine
|
||||
* Get the correct CMS root path
|
||||
*
|
||||
* @param string $pathToTestFile Optional name of the test to be run
|
||||
* @param string $suite Optional name of the suite containing the tests, Acceptance by default.
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
public function runTest($pathToTestFile = null, $suite = 'acceptance')
|
||||
private function getTestingPath()
|
||||
{
|
||||
$this->runSelenium();
|
||||
|
||||
// Make sure to run the build command to generate AcceptanceTester
|
||||
$this->_exec($this->isWindows() ? 'vendor\bin\codecept.bat build' : 'php vendor/bin/codecept build');
|
||||
|
||||
if (!$pathToTestFile)
|
||||
if (empty($this->configuration->cmsPath))
|
||||
{
|
||||
$this->say('Available tests in the system:');
|
||||
|
||||
$iterator = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator(
|
||||
'tests/' . $suite,
|
||||
RecursiveDirectoryIterator::SKIP_DOTS
|
||||
),
|
||||
RecursiveIteratorIterator::SELF_FIRST
|
||||
);
|
||||
|
||||
$tests = array();
|
||||
|
||||
$iterator->rewind();
|
||||
$i = 1;
|
||||
|
||||
while ($iterator->valid())
|
||||
{
|
||||
if (strripos($iterator->getSubPathName(), 'cept.php')
|
||||
|| strripos($iterator->getSubPathName(), 'cest.php'))
|
||||
{
|
||||
$this->say('[' . $i . '] ' . $iterator->getSubPathName());
|
||||
$tests[$i] = $iterator->getSubPathName();
|
||||
$i++;
|
||||
}
|
||||
|
||||
$iterator->next();
|
||||
}
|
||||
|
||||
$this->say('');
|
||||
$testNumber = $this->ask('Type the number of the test in the list that you want to run...');
|
||||
$test = $tests[$testNumber];
|
||||
return $this->testsPath . 'joomla';
|
||||
}
|
||||
|
||||
$pathToTestFile = 'tests/' . $suite . '/' . $test;
|
||||
|
||||
// Loading the class to display the methods in the class
|
||||
require 'tests/' . $suite . '/' . $test;
|
||||
|
||||
// Logic to fetch the class name from the file name
|
||||
$fileName = explode("/", $test);
|
||||
$className = explode(".", $fileName[1]);
|
||||
|
||||
// If the selected file is cest only than we will give the option to execute individual methods, we don't need this in cept file
|
||||
$i = 1;
|
||||
|
||||
if (strripos($className[0], 'cest'))
|
||||
if (!file_exists(dirname($this->configuration->cmsPath)))
|
||||
{
|
||||
$class_methods = get_class_methods($className[0]);
|
||||
$this->say('[' . $i . '] ' . 'All');
|
||||
$methods[$i] = 'All';
|
||||
$i++;
|
||||
$this->say('CMS path written in local configuration does not exists or is not readable');
|
||||
|
||||
foreach ($class_methods as $method_name)
|
||||
{
|
||||
$reflect = new ReflectionMethod($className[0], $method_name);
|
||||
|
||||
if (!$reflect->isConstructor())
|
||||
{
|
||||
if ($reflect->isPublic())
|
||||
{
|
||||
$this->say('[' . $i . '] ' . $method_name);
|
||||
$methods[$i] = $method_name;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->say('');
|
||||
$methodNumber = $this->ask('Please choose the method in the test that you would want to run...');
|
||||
$method = $methods[$methodNumber];
|
||||
return $this->testsPath . 'joomla';
|
||||
}
|
||||
|
||||
if (isset($method) && $method != 'All')
|
||||
{
|
||||
$pathToTestFile = $pathToTestFile . ':' . $method;
|
||||
}
|
||||
|
||||
$this->taskCodecept()
|
||||
->test($pathToTestFile)
|
||||
->arg('--steps')
|
||||
->arg('--debug')
|
||||
->run()
|
||||
->stopOnFail();
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the specified checker tool. Valid options are phpmd, phpcs, phpcpd
|
||||
*
|
||||
* @param string $tool The tool
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function runChecker($tool = null)
|
||||
{
|
||||
if ($tool === null)
|
||||
{
|
||||
$this->say('You have to specify a tool name as argument. Valid tools are phpmd, phpcs, phpcpd.');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!in_array($tool, array('phpmd', 'phpcs', 'phpcpd')))
|
||||
{
|
||||
$this->say('The tool you required is not known. Valid tools are phpmd, phpcs, phpcpd.');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
switch ($tool)
|
||||
{
|
||||
case 'phpmd':
|
||||
return $this->runPhpmd();
|
||||
|
||||
case 'phpcs':
|
||||
return $this->runPhpcs();
|
||||
|
||||
case 'phpcpd':
|
||||
return $this->runPhpcpd();
|
||||
}
|
||||
return $this->configuration->cmsPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a testing Joomla site for running the tests (use it before run:test)
|
||||
*
|
||||
* @param bool $use_htaccess (1/0) Rename and enable embedded Joomla .htaccess file
|
||||
* @param bool $useHtaccess (1/0) Rename and enable embedded Joomla .htaccess file
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function createTestingSite($use_htaccess = false)
|
||||
public function createTestingSite($useHtaccess = false)
|
||||
{
|
||||
if (!empty($this->configuration->skipClone))
|
||||
{
|
||||
@ -314,11 +175,11 @@ class RoboFile extends \Robo\Tasks
|
||||
}
|
||||
|
||||
// Caching cloned installations locally
|
||||
if (!is_dir('tests/cache') || (time() - filemtime('tests/cache') > 60 * 60 * 24))
|
||||
if (!is_dir($this->testsPath . 'cache') || (time() - filemtime($this->testsPath . 'cache') > 60 * 60 * 24))
|
||||
{
|
||||
if (file_exists('tests/cache'))
|
||||
if (file_exists($this->testsPath . 'cache'))
|
||||
{
|
||||
$this->taskDeleteDir('tests/cache')->run();
|
||||
$this->taskDeleteDir($this->testsPath . 'cache')->run();
|
||||
}
|
||||
|
||||
$this->_exec($this->buildGitCloneCommand());
|
||||
@ -339,108 +200,101 @@ class RoboFile extends \Robo\Tasks
|
||||
}
|
||||
}
|
||||
|
||||
$this->_copyDir('tests/cache', $this->cmsPath);
|
||||
$exclude = ['tests', 'tests-phpunit', '.run', '.github', '.git', '.drone', 'docs', 'src'];
|
||||
|
||||
$this->copyJoomla($this->cmsPath, $exclude);
|
||||
|
||||
// Optionally change owner to fix permissions issues
|
||||
if (!empty($this->configuration->localUser) && !$this->isWindows())
|
||||
if (!empty($this->configuration->localUser))
|
||||
{
|
||||
$this->_exec('chown -R ' . $this->configuration->localUser . ' ' . $this->cmsPath);
|
||||
}
|
||||
|
||||
// Copy current package
|
||||
if (!file_exists('dist/pkg-weblinks-current.zip'))
|
||||
{
|
||||
$this->build(true);
|
||||
}
|
||||
|
||||
$this->_copy('dist/pkg-weblinks-current.zip', $this->cmsPath . "/pkg-weblinks-current.zip");
|
||||
|
||||
$this->say('Joomla CMS site created at ' . $this->cmsPath);
|
||||
|
||||
// Optionally uses Joomla default htaccess file. Used by TravisCI
|
||||
if ($use_htaccess == true)
|
||||
if ($useHtaccess == true)
|
||||
{
|
||||
$this->_copy('./tests/joomla/htaccess.txt', './tests/joomla/.htaccess');
|
||||
$this->_exec('sed -e "s,# RewriteBase /,RewriteBase /tests/joomla/,g" -in-place tests/joomla/.htaccess');
|
||||
$this->say('Renaming htaccess.txt to .htaccess');
|
||||
$this->_copy('./htaccess.txt', $this->cmsPath . '/.htaccess');
|
||||
$this->_exec('sed -e "s,# RewriteBase /,RewriteBase /tests/joomla-cms,g" -in-place tests/joomla/.htaccess');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get (optional) configuration from an external file
|
||||
* Copy the Joomla installation excluding folders
|
||||
*
|
||||
* @return \stdClass|null
|
||||
* @param string $dst Target folder
|
||||
* @param array $exclude Exclude list of folders
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getConfiguration()
|
||||
protected function copyJoomla($dst, $exclude = array())
|
||||
{
|
||||
$configurationFile = __DIR__ . '/RoboFile.ini';
|
||||
$dir = @opendir( "." . '/' . $this->testsPath . 'cache');
|
||||
|
||||
if (!file_exists($configurationFile))
|
||||
if (false === $dir)
|
||||
{
|
||||
$this->say("No local configuration file");
|
||||
|
||||
return null;
|
||||
throw new Exception($this, "Cannot open source directory");
|
||||
}
|
||||
|
||||
$configuration = parse_ini_file($configurationFile);
|
||||
|
||||
if ($configuration === false)
|
||||
if (!is_dir($dst))
|
||||
{
|
||||
$this->say('Local configuration file is empty or wrong (check is it in correct .ini format');
|
||||
|
||||
return null;
|
||||
mkdir($dst, 0755, true);
|
||||
}
|
||||
|
||||
return json_decode(json_encode($configuration));
|
||||
while (false !== ($file = readdir($dir)))
|
||||
{
|
||||
if (in_array($file, $exclude))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (($file !== '.') && ($file !== '..'))
|
||||
{
|
||||
$srcFile = "." . '/' . $this->testsPath . 'cache/' . $file;
|
||||
$destFile = $dst . '/' . $file;
|
||||
|
||||
if (is_dir($srcFile))
|
||||
{
|
||||
$this->_copyDir($srcFile, $destFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
copy($srcFile, $destFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closedir($dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build correct git clone command according to local configuration and OS
|
||||
* Downloads Composer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function buildGitCloneCommand()
|
||||
{
|
||||
$branch = empty($this->configuration->branch) ? 'staging' : $this->configuration->branch;
|
||||
|
||||
return "git" . $this->executableExtension . " clone -b $branch --single-branch --depth 1 https://github.com/joomla/joomla-cms.git tests/cache";
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if local OS is Windows
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return bool
|
||||
* @return void
|
||||
*/
|
||||
private function isWindows()
|
||||
private function getComposer()
|
||||
{
|
||||
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the correct CMS root path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getCmsPath()
|
||||
{
|
||||
if (empty($this->configuration->cmsPath))
|
||||
// Make sure we have Composer
|
||||
if (!file_exists('composer.phar'))
|
||||
{
|
||||
return 'tests/joomla';
|
||||
$this->_exec('curl -o ' . 'composer.phar --retry 3 --retry-delay 5 -sS https://getcomposer.org/installer | php');
|
||||
}
|
||||
|
||||
if (!file_exists(dirname($this->configuration->cmsPath)))
|
||||
{
|
||||
$this->say("Cms path written in local configuration does not exists or is not readable");
|
||||
|
||||
return 'tests/joomla';
|
||||
}
|
||||
|
||||
return $this->configuration->cmsPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs Selenium Standalone Server.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function runSelenium()
|
||||
{
|
||||
@ -450,137 +304,219 @@ class RoboFile extends \Robo\Tasks
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_exec('START java.exe -jar' . $this->getWebDriver() .
|
||||
' vendor\joomla-projects\selenium-server-standalone\bin\selenium-server-standalone.jar ');
|
||||
$this->_exec("START java.exe -jar " . $this->getWebDriver() . ' vendor\joomla-projects\selenium-server-standalone\bin\selenium-server-standalone.jar ');
|
||||
}
|
||||
|
||||
sleep(3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes all the Selenium System Tests in a suite on your machine
|
||||
*
|
||||
* @param array $opts Array of configuration options:
|
||||
* - 'use-htaccess': renames and enable embedded Joomla .htaccess file
|
||||
* - 'env': set a specific environment to get configuration from
|
||||
*
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop'])
|
||||
{
|
||||
$this->say("Running tests");
|
||||
|
||||
$this->createTestingSite($opts['use-htaccess']);
|
||||
|
||||
$this->getComposer();
|
||||
|
||||
if ($this->isWindows())
|
||||
{
|
||||
sleep(3);
|
||||
$this->taskComposerInstall('composer')->run();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->taskWaitForSeleniumStandaloneServer()
|
||||
->run()
|
||||
->stopOnFail();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads Composer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function getComposer()
|
||||
{
|
||||
// Make sure we have Composer
|
||||
if (!file_exists('./composer.phar'))
|
||||
{
|
||||
$insecure = '';
|
||||
|
||||
if (!empty($this->configuration->insecure))
|
||||
{
|
||||
$insecure = '--insecure';
|
||||
}
|
||||
|
||||
$this->_exec('curl ' . $insecure . ' --retry 3 --retry-delay 5 -sS https://getcomposer.org/installer | php');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Kills the selenium server running
|
||||
*
|
||||
* @param string $host Web host of the remote server.
|
||||
* @param string $port Server port.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function killSelenium($host = 'localhost', $port = '4444')
|
||||
{
|
||||
$this->say('Trying to kill the selenium server.');
|
||||
$this->_exec("curl http://$host:$port/selenium-server/driver/?cmd=shutDownSeleniumServer");
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the phpmd tool
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function runPhpmd()
|
||||
{
|
||||
return $this->_exec('phpmd' . $this->extension . ' ' . __DIR__ . '/src xml cleancode,codesize,controversial,design,naming,unusedcode');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the phpcs tool
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function runPhpcs()
|
||||
{
|
||||
$this->_exec('phpcs' . $this->extension . ' ' . __DIR__ . '/src');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the phpcpd tool
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function runPhpcpd()
|
||||
{
|
||||
$this->_exec('phpcpd' . $this->extension . ' ' . __DIR__ . '/src');
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the joomla extension package
|
||||
*
|
||||
* @param array $params Additional params
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function build($params = ['dev' => false])
|
||||
{
|
||||
if (!file_exists('jorobo.ini'))
|
||||
{
|
||||
$this->_copy('jorobo.dist.ini', 'jorobo.ini');
|
||||
$this->taskComposerInstall('composer.phar')->run();
|
||||
}
|
||||
|
||||
$this->taskBuild($params)->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes all unit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function runUnit()
|
||||
{
|
||||
$this->createTestingSite();
|
||||
$this->getComposer();
|
||||
$this->taskComposerInstall()->run();
|
||||
$this->runSelenium();
|
||||
|
||||
// Make sure to run the build command to generate AcceptanceTester
|
||||
$this->_exec($this->isWindows() ? 'vendor\bin\codecept.bat build' : 'php vendor/bin/codecept build');
|
||||
if ($this->isWindows())
|
||||
{
|
||||
$this->_exec('php ' . $this->getWindowsPath('vendor/bin/codecept') . ' build');
|
||||
$pathToCodeception = $this->getWindowsPath('vendor/bin/codecept');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_exec('php ' . 'vendor/bin/codecept build');
|
||||
|
||||
$this->taskCodecept()
|
||||
->suite('unit')
|
||||
$pathToCodeception = 'vendor/bin/codecept';
|
||||
}
|
||||
|
||||
$this->taskCodecept($pathToCodeception)
|
||||
->arg('--steps')
|
||||
->arg('--debug')
|
||||
->arg('--fail-fast')
|
||||
->env($opts['env'])
|
||||
->arg($this->testsPath . 'acceptance/install/')
|
||||
->run()
|
||||
->stopOnFail();
|
||||
|
||||
$this->taskCodecept($pathToCodeception)
|
||||
->arg('--steps')
|
||||
->arg('--debug')
|
||||
->arg('--fail-fast')
|
||||
->env($opts['env'])
|
||||
->arg($this->testsPath . 'acceptance/administrator/')
|
||||
->run()
|
||||
->stopOnFail();
|
||||
|
||||
$this->taskCodecept($pathToCodeception)
|
||||
->arg('--steps')
|
||||
->arg('--debug')
|
||||
->arg('--fail-fast')
|
||||
->env($opts['env'])
|
||||
->arg($this->testsPath . 'acceptance/frontend/')
|
||||
->run()
|
||||
->stopOnFail();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update copyright headers for this project. (Set the text up in the jorobo.ini)
|
||||
* Executes a specific Selenium System Tests in your machine
|
||||
*
|
||||
* @param string $pathToTestFile Optional name of the test to be run
|
||||
* @param string $suite Optional name of the suite containing the tests, Acceptance by default.
|
||||
*
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function headers()
|
||||
public function runTest($pathToTestFile = null, $suite = 'acceptance')
|
||||
{
|
||||
if (!file_exists('jorobo.ini'))
|
||||
$this->runSelenium();
|
||||
|
||||
// Make sure to run the build command to generate AcceptanceTester
|
||||
$path = 'vendor/bin/codecept';
|
||||
$this->_exec('php ' . $this->isWindows() ? $this->getWindowsPath($path) : $path . ' build');
|
||||
|
||||
if (!$pathToTestFile)
|
||||
{
|
||||
$this->_copy('jorobo.dist.ini', 'jorobo.ini');
|
||||
$this->say('Available tests in the system:');
|
||||
|
||||
$iterator = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator(
|
||||
$this->testsPath . $suite,
|
||||
RecursiveDirectoryIterator::SKIP_DOTS
|
||||
),
|
||||
RecursiveIteratorIterator::SELF_FIRST
|
||||
);
|
||||
|
||||
$tests = array();
|
||||
$i = 1;
|
||||
|
||||
$iterator->rewind();
|
||||
|
||||
while ($iterator->valid())
|
||||
{
|
||||
if (strripos($iterator->getSubPathName(), 'cept.php')
|
||||
|| strripos($iterator->getSubPathName(), 'cest.php')
|
||||
|| strripos($iterator->getSubPathName(), '.feature')
|
||||
)
|
||||
{
|
||||
$this->say('[' . $i . '] ' . $iterator->getSubPathName());
|
||||
|
||||
$tests[$i] = $iterator->getSubPathName();
|
||||
$i++;
|
||||
}
|
||||
|
||||
$iterator->next();
|
||||
}
|
||||
|
||||
$this->say('');
|
||||
$testNumber = $this->ask('Type the number of the test in the list that you want to run...');
|
||||
$test = $tests[$testNumber];
|
||||
}
|
||||
|
||||
(new \Joomla\Jorobo\Tasks\CopyrightHeader)->run();
|
||||
$pathToTestFile = $this->testsPath . $suite . '/' . $test;
|
||||
|
||||
// Loading the class to display the methods in the class
|
||||
|
||||
// Logic to fetch the class name from the file name
|
||||
$fileName = explode("/", $test);
|
||||
|
||||
// If the selected file is cest only then we will give the option to execute individual methods, we don't need this in cept or feature files
|
||||
$i = 1;
|
||||
|
||||
if (isset($fileName[1]) && strripos($fileName[1], 'cest'))
|
||||
{
|
||||
require $this->testsPath . $suite . '/' . $test;
|
||||
|
||||
$className = explode(".", $fileName[1]);
|
||||
$class_methods = get_class_methods($className[0]);
|
||||
|
||||
$this->say('[' . $i . '] ' . 'All');
|
||||
|
||||
$methods[$i] = 'All';
|
||||
$i++;
|
||||
|
||||
foreach ($class_methods as $method_name)
|
||||
{
|
||||
$reflect = new ReflectionMethod($className[0], $method_name);
|
||||
|
||||
if (!$reflect->isConstructor() && $reflect->isPublic())
|
||||
{
|
||||
$this->say('[' . $i . '] ' . $method_name);
|
||||
|
||||
$methods[$i] = $method_name;
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$this->say('');
|
||||
$methodNumber = $this->ask('Please choose the method in the test that you would want to run...');
|
||||
$method = $methods[$methodNumber];
|
||||
}
|
||||
|
||||
if (isset($method) && $method != 'All')
|
||||
{
|
||||
$pathToTestFile = $pathToTestFile . ':' . $method;
|
||||
}
|
||||
|
||||
$testPathCodecept = 'vendor/bin/codecept';
|
||||
|
||||
$this->taskCodecept($this->isWindows() ? $this->getWindowsPath($testPathCodecept) : $testPathCodecept)
|
||||
->test($pathToTestFile)
|
||||
->arg('--steps')
|
||||
->arg('--debug')
|
||||
->run()
|
||||
->stopOnFail();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if local OS is Windows
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
private function isWindows()
|
||||
{
|
||||
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the correct path for Windows (needed by CMD)
|
||||
*
|
||||
* @param string $path Linux path
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
private function getWindowsPath($path)
|
||||
{
|
||||
return str_replace('/', DIRECTORY_SEPARATOR, $path);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -588,7 +524,7 @@ class RoboFile extends \Robo\Tasks
|
||||
*
|
||||
* @return string the webdriver string to use with selenium
|
||||
*
|
||||
* @since version
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public function getWebdriver()
|
||||
{
|
||||
@ -626,9 +562,7 @@ class RoboFile extends \Robo\Tasks
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->yell(
|
||||
print_r($codeceptMainConfig) .
|
||||
'No driver for your browser. Check your browser in acceptance.suite.yml and the webDrivers in codeception.yml');
|
||||
$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);
|
||||
@ -639,12 +573,38 @@ class RoboFile extends \Robo\Tasks
|
||||
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';
|
||||
}
|
||||
|
||||
return 'linux';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the suite configuration
|
||||
*
|
||||
* @param string $suite The suite
|
||||
* @param string $suite Name of the test suite
|
||||
*
|
||||
* @return array
|
||||
* @return array
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
private function getSuiteConfig($suite = 'acceptance')
|
||||
{
|
||||
@ -657,40 +617,15 @@ class RoboFile extends \Robo\Tasks
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the os name
|
||||
* Build correct git clone command according to local configuration and OS
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since version
|
||||
*/
|
||||
private function getOs()
|
||||
private function buildGitCloneCommand()
|
||||
{
|
||||
$os = php_uname('s');
|
||||
$branch = empty($this->configuration->branch) ? 'staging' : $this->configuration->branch;
|
||||
|
||||
if (strpos(strtolower($os), 'windows') !== false)
|
||||
{
|
||||
$os = 'windows';
|
||||
}
|
||||
// Who have thought that Mac is actually Darwin???
|
||||
elseif (strpos(strtolower($os), 'darwin') !== false)
|
||||
{
|
||||
$os = 'mac';
|
||||
}
|
||||
else
|
||||
{
|
||||
$os = 'linux';
|
||||
}
|
||||
|
||||
return $os;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Version __DEPLOY_VERSION__ in Weblinks. (Set the version up in the jorobo.ini)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function bump()
|
||||
{
|
||||
(new \Joomla\Jorobo\Tasks\BumpVersion())->run();
|
||||
return "git clone -b $branch --single-branch --depth 1 https://github.com/joomla/joomla-cms.git " . $this->testsPath . "cache";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,11 +3,22 @@ paths:
|
||||
tests: tests
|
||||
log: tests/_output
|
||||
data: tests/_data
|
||||
helpers: tests/_support
|
||||
support: tests/_support
|
||||
envs: tests/_envs
|
||||
settings:
|
||||
bootstrap: _bootstrap.php
|
||||
colors: true
|
||||
memory_limit: 1024M
|
||||
extensions:
|
||||
enabled:
|
||||
- Codeception\Extension\RunFailed
|
||||
modules:
|
||||
config:
|
||||
Db:
|
||||
dsn: ''
|
||||
user: ''
|
||||
password: ''
|
||||
dump: tests/_data/dump.sql
|
||||
webdrivers:
|
||||
firefox:
|
||||
windows: vendor\joomla-projects\selenium-server-standalone\bin\webdrivers\gecko\geckodriver64.exe
|
||||
|
@ -11,13 +11,12 @@
|
||||
"php": ">=5.3.10"
|
||||
},
|
||||
"require-dev": {
|
||||
"codeception/codeception": "^2.2",
|
||||
"joomla-projects/joomla-browser": "v3.6.5.1",
|
||||
"codeception/codeception": "~2.3",
|
||||
"joomla-projects/joomla-browser": "~v3",
|
||||
"joomla-projects/selenium-server-standalone": "~v3",
|
||||
"consolidation/robo": "^1.0.0",
|
||||
"joomla-projects/robo": "~0",
|
||||
"joomla-projects/selenium-server-standalone": "v3.1.0",
|
||||
"joomla-projects/joomla-testing-robo": "^1.0.0",
|
||||
"fzaninotto/faker": "^1.6",
|
||||
"joomla-projects/jorobo": "~0.6",
|
||||
"Behat/Gherkin": "^4.4.1"
|
||||
"joomla-projects/jorobo": "~0.6"
|
||||
}
|
||||
}
|
||||
|
764
composer.lock
generated
764
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,2 +1,3 @@
|
||||
<?php
|
||||
|
||||
// This is global bootstrap for autoloading
|
||||
|
49
tests/_support/Helper/Acceptance.php
Normal file
49
tests/_support/Helper/Acceptance.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Test
|
||||
* @subpackage Helper
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
namespace Helper;
|
||||
|
||||
use Codeception\Configuration;
|
||||
use Codeception\Module;
|
||||
|
||||
/**
|
||||
* Helper class for Acceptance.
|
||||
* Here you can define custom actions
|
||||
* All public methods declared in helper class will be available in $I
|
||||
*
|
||||
* @package Codeception\Module
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
class Acceptance extends Module
|
||||
{
|
||||
/**
|
||||
* Array of the configuration settings
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
protected static $acceptanceSuiteConfiguration = [];
|
||||
|
||||
/**
|
||||
* Function to get Configuration from the acceptance.suite.yml to be used by a test
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public function getSuiteConfiguration()
|
||||
{
|
||||
if (empty(self::$acceptanceSuiteConfiguration))
|
||||
{
|
||||
self::$acceptanceSuiteConfiguration = Configuration::suiteSettings('acceptance', Configuration::config());
|
||||
}
|
||||
|
||||
return self::$acceptanceSuiteConfiguration;
|
||||
}
|
||||
}
|
23
tests/_support/Helper/Functional.php
Normal file
23
tests/_support/Helper/Functional.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Test
|
||||
* @subpackage Helper
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Helper;
|
||||
|
||||
/**
|
||||
* Helper class for Functional.
|
||||
* Here you can define custom actions
|
||||
* All public methods declared in helper class will be available in $I
|
||||
*
|
||||
* @package Codeception\Module
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
class Functional extends \Codeception\Module
|
||||
{
|
||||
}
|
162
tests/_support/Helper/JoomlaDb.php
Normal file
162
tests/_support/Helper/JoomlaDb.php
Normal file
@ -0,0 +1,162 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Test
|
||||
* @subpackage Helper
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
namespace Helper;
|
||||
|
||||
use Codeception\Module\Db;
|
||||
|
||||
/**
|
||||
* JoomlaDb Helper class for Acceptance.
|
||||
*
|
||||
* @package Codeception\Module
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
class JoomlaDb extends Db
|
||||
{
|
||||
/**
|
||||
* The table prefix
|
||||
*
|
||||
* @var string
|
||||
* @since 3.7.3
|
||||
*/
|
||||
protected $prefix;
|
||||
|
||||
/**
|
||||
* Codeception Hook: called after configuration is loaded
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public function _initialize()
|
||||
{
|
||||
$this->prefix = (isset($this->config['prefix'])) ? $this->config['prefix'] : '';
|
||||
|
||||
return parent::_initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts an SQL record into a database. This record will be
|
||||
* erased after the test.
|
||||
*
|
||||
* @param string $table Table
|
||||
* @param array $data Data
|
||||
*
|
||||
* @return integer The last insert id
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public function haveInDatabase($table, array $data)
|
||||
{
|
||||
$table = $this->addPrefix($table);
|
||||
|
||||
return parent::haveInDatabase($table, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find an entry in the database
|
||||
*
|
||||
* @param string $table Table
|
||||
* @param array $criteria Criteria
|
||||
*
|
||||
* @return mixed|false
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public function findInDatabase($table, $criteria = [])
|
||||
{
|
||||
$table = $this->addPrefix($table);
|
||||
|
||||
return parent::seeInDatabase($table, $criteria);
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't see in database
|
||||
*
|
||||
* @param string $table Table
|
||||
* @param array $criteria Criteria
|
||||
*
|
||||
* @return mixed|false
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public function dontSeeInDatabase($table, $criteria = [])
|
||||
{
|
||||
$table = $this->addPrefix($table);
|
||||
|
||||
return parent::dontSeeInDatabase($table, $criteria);
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab an entry from the database
|
||||
*
|
||||
* @param string $table Table
|
||||
* @param string $column Column
|
||||
* @param array $criteria Criteria
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public function grabFromDatabase($table, $column, $criteria = null)
|
||||
{
|
||||
$table = $this->addPrefix($table);
|
||||
|
||||
return parent::grabFromDatabase($table, $column, $criteria);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given number of records were found in the database.
|
||||
*
|
||||
* @param int $expectedNumber Expected number
|
||||
* @param string $table Table name
|
||||
* @param array $criteria Search criteria [Optional]
|
||||
*
|
||||
* @return mixed|bool
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public function seeNumRecords($expectedNumber, $table, array $criteria = [])
|
||||
{
|
||||
$table = $this->addPrefix($table);
|
||||
|
||||
return parent::seeNumRecords($expectedNumber, $table, $criteria);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of rows in a database
|
||||
*
|
||||
* @param string $table Table name
|
||||
* @param array $criteria Search criteria [Optional]
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public function grabNumRecords($table, array $criteria = [])
|
||||
{
|
||||
$table = $this->addPrefix($table);
|
||||
|
||||
return parent::grabNumRecords($table, $criteria);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the table prefix
|
||||
*
|
||||
* @param $table string Table without prefix
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
protected function addPrefix($table)
|
||||
{
|
||||
return $this->prefix . $table;
|
||||
}
|
||||
}
|
23
tests/_support/Helper/Unit.php
Normal file
23
tests/_support/Helper/Unit.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Test
|
||||
* @subpackage Helper
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Helper;
|
||||
|
||||
/**
|
||||
* Helper class for Unit.
|
||||
* Here you can define custom actions
|
||||
* All public methods declared in helper class will be available in $I
|
||||
*
|
||||
* @package Codeception\Module
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
class Unit extends \Codeception\Module
|
||||
{
|
||||
}
|
409
tests/_support/Page/Acceptance/Administrator/AdminPage.php
Normal file
409
tests/_support/Page/Acceptance/Administrator/AdminPage.php
Normal file
@ -0,0 +1,409 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Test
|
||||
* @subpackage AcceptanceTester.Page
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Page\Acceptance\Administrator;
|
||||
|
||||
/**
|
||||
* Acceptance Page object class to define administrator page objects.
|
||||
*
|
||||
* @package Page\Acceptance\Administrator
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
class AdminPage extends \AcceptanceTester
|
||||
{
|
||||
/**
|
||||
* The element id which contains system messages.
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $systemMessageContainer = ['id' => 'system-message-container'];
|
||||
|
||||
/**
|
||||
* The element id which contains page title in administrator header.
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $pageTitle = ['class' => 'page-title'];
|
||||
|
||||
/**
|
||||
* Locator for page title
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $title = ['id' => 'jform_title'];
|
||||
|
||||
/**
|
||||
* Locator for search input field
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $filterSearch = ['id' => 'filter_search'];
|
||||
|
||||
/**
|
||||
* Locator for status filter under search tool
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $filterPublished = 'filter_published';
|
||||
|
||||
/**
|
||||
* Locator for search button icon
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $iconSearch = ['class' => 'icon-search'];
|
||||
|
||||
/**
|
||||
* Locator for the Tabs in Edit View
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $tabsLocator = ['xpath' => "//ul[@id='myTabTabs']/li/a"];
|
||||
|
||||
/**
|
||||
* Locator for the Check All checkbox
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $checkAll = ['xpath' => "//thead//input[@name='checkall-toggle' or @name='toggle']"];
|
||||
|
||||
/**
|
||||
* Method to search using given keyword
|
||||
*
|
||||
* @param string $keyword The keyword to search
|
||||
*
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function search($keyword)
|
||||
{
|
||||
$I = $this;
|
||||
|
||||
$I->amGoingTo('search for "' . $keyword . '"');
|
||||
$I->fillField(static::$filterSearch, $keyword);
|
||||
$I->click(static::$iconSearch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to search user with username
|
||||
*
|
||||
* @param string $keyword The username of user
|
||||
*
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return void Checkbox for given username will be checked.
|
||||
*/
|
||||
public function haveItemUsingSearch($keyword)
|
||||
{
|
||||
$I = $this;
|
||||
|
||||
$I->amOnPage(static::$url);
|
||||
$I->search($keyword);
|
||||
$I->checkAllResults();
|
||||
$I->wait(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method is used to see system message after waiting for page title.
|
||||
*
|
||||
* @param string $title The webpage title
|
||||
* @param string $message The unpublish successful message
|
||||
*
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function seeSystemMessage($title, $message)
|
||||
{
|
||||
$I = $this;
|
||||
|
||||
$I->waitForPageTitle($title);
|
||||
$I->see($message, self::$systemMessageContainer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method is to Wait for page title until default timeout.
|
||||
*
|
||||
* @param string $title Page Title text
|
||||
*
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function waitForPageTitle($title)
|
||||
{
|
||||
$I = $this;
|
||||
$I->waitForText($title, TIMEOUT, self::$pageTitle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to select Toolbar buttons in Joomla! Admin Toolbar Panel
|
||||
*
|
||||
* @param string $button The full name of the button
|
||||
*
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function clickToolbarButton($button)
|
||||
{
|
||||
$I = $this;
|
||||
$input = strtolower($button);
|
||||
|
||||
$suiteConfiguration = $I->getSuiteConfiguration();
|
||||
$screenWidth = explode("x", $suiteConfiguration['modules']['config']['JoomlaBrowser']['window_size']);
|
||||
|
||||
if ($screenWidth[0] <= 480)
|
||||
{
|
||||
$I->click('Toolbar');
|
||||
}
|
||||
|
||||
switch ($input)
|
||||
{
|
||||
case "new":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-new']//button"]);
|
||||
break;
|
||||
case "edit":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-edit']//button"]);
|
||||
break;
|
||||
case "publish":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-publish']//button"]);
|
||||
break;
|
||||
case "unpublish":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-unpublish']//button"]);
|
||||
break;
|
||||
case "archive":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-archive']//button"]);
|
||||
break;
|
||||
case "check-in":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-checkin']//button"]);
|
||||
break;
|
||||
case "batch":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-batch']//button"]);
|
||||
break;
|
||||
case "rebuild":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-refresh']//button"]);
|
||||
break;
|
||||
case "trash":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-trash']//button"]);
|
||||
break;
|
||||
case "save":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-apply']//button"]);
|
||||
break;
|
||||
case "save & close":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-save']//button"]);
|
||||
break;
|
||||
case "save & new":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-save-new']//button"]);
|
||||
break;
|
||||
case "cancel":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-cancel']//button"]);
|
||||
break;
|
||||
case "options":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-options']//button"]);
|
||||
break;
|
||||
case "empty trash":
|
||||
case "delete":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-delete']//button"]);
|
||||
break;
|
||||
case "unblock":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-unblock']//button"]);
|
||||
break;
|
||||
case "featured":
|
||||
$I->click(['xpath' => "//div[@id='toolbar-featured']//button"]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to select all the item in the Search results in Administrator List
|
||||
*
|
||||
* Note: We recommend use of checkAllResults function only after searchForItem to be sure you are selecting only the desired result set
|
||||
*
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkAllResults()
|
||||
{
|
||||
$I = $this;
|
||||
|
||||
$I->comment("Selecting Checkall button");
|
||||
$I->click(self::$checkAll);
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects an option in a Chosen Selector based on its id
|
||||
*
|
||||
* @param string $selectId The id of the <select> element
|
||||
* @param string $option The text in the <option> to be selected in the chosen selector
|
||||
*
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function selectOptionInChosenById($selectId, $option)
|
||||
{
|
||||
$chosenSelectID = $selectId . '_chzn';
|
||||
|
||||
$I = $this;
|
||||
$I->comment("I open the $chosenSelectID chosen selector");
|
||||
$I->click(['xpath' => "//div[@id='$chosenSelectID']/a/div/b"]);
|
||||
$I->comment("I select $option");
|
||||
$I->click(['xpath' => "//div[@id='$chosenSelectID']//li[text()='$option']"]);
|
||||
|
||||
// Gives time to chosen to close
|
||||
$I->wait(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to Logout from Administrator Panel in Joomla!
|
||||
*
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function doAdministratorLogout()
|
||||
{
|
||||
$I = $this;
|
||||
$I->click(
|
||||
['xpath' => "//ul[@class='nav nav-user pull-right']//li//a[@class='dropdown-toggle']"]
|
||||
);
|
||||
|
||||
$I->comment("I click on Top Right corner toggle to Logout from Admin");
|
||||
$I->waitForElement(
|
||||
['xpath' => "//li[@class='dropdown open']/ul[@class='dropdown-menu']//a[text() = 'Logout']"],
|
||||
TIMEOUT
|
||||
);
|
||||
|
||||
$I->click(
|
||||
['xpath' => "//li[@class='dropdown open']/ul[@class='dropdown-menu']//a[text() = 'Logout']"]
|
||||
);
|
||||
|
||||
$I->waitForElement(['id' => 'mod-login-username'], TIMEOUT);
|
||||
$I->waitForText(
|
||||
'Log in',
|
||||
TIMEOUT,
|
||||
['xpath' => "//fieldset[@class='loginform']//button"]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to Verify the Tabs on a Joomla! screen
|
||||
*
|
||||
* @param array $expectedTabs Expected Tabs on the Page
|
||||
* @param array $tabsLocator Locator for the Tabs in Edit View
|
||||
*
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function verifyAvailableTabs($expectedTabs, $tabsLocator = null)
|
||||
{
|
||||
$I = $this;
|
||||
|
||||
$actualArrayOfTabs = $I->grabMultiple(self::$tabsLocator);
|
||||
|
||||
$I->comment(
|
||||
"Fetch the current list of Tabs in the edit view which is: " . implode(", ", $actualArrayOfTabs)
|
||||
);
|
||||
|
||||
$I->assertEquals(
|
||||
$expectedTabs,
|
||||
$actualArrayOfTabs, "Tab Labels do not match on edit view of" . $I->grabFromCurrentUrl()
|
||||
);
|
||||
|
||||
$I->comment('Verify the Tabs');
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to see that item is saved
|
||||
*
|
||||
* @param string $item The item Name
|
||||
*
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function seeItemIsCreated($item)
|
||||
{
|
||||
$I = $this;
|
||||
|
||||
$I->amOnPage(static::$url);
|
||||
$I->search($item);
|
||||
$I->see($item, static::$seeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assure the item is trashed.
|
||||
*
|
||||
* @param string $item The item name
|
||||
* @param string $pageTitle The page title
|
||||
*
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function seeItemInTrash($item, $pageTitle)
|
||||
{
|
||||
$I = $this;
|
||||
|
||||
$I->click('Search Tools');
|
||||
$I->wait(2);
|
||||
$I->selectOptionInChosenById(static::$filterPublished, 'Trashed');
|
||||
$I->waitForPageTitle($pageTitle);
|
||||
$I->see($item, static::$seeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assure the search tools are displayed
|
||||
*
|
||||
* @since 3.7.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function displaySearchTools()
|
||||
{
|
||||
$I = $this;
|
||||
|
||||
try
|
||||
{
|
||||
$I->seeElement(['class' => 'js-stools-btn-filter']);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$I->comment("Search tools button does not exist on this page, skipping");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$I->dontSeeElement(['class' => 'js-stools-container-filters']);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$I->comment("Search tools already visible on the page, skipping");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$I->click('Search Tools');
|
||||
}
|
||||
}
|
196
tests/_support/Page/Acceptance/Administrator/UserManagerPage.php
Normal file
196
tests/_support/Page/Acceptance/Administrator/UserManagerPage.php
Normal file
@ -0,0 +1,196 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Test
|
||||
* @subpackage AcceptanceTester.Page
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Page\Acceptance\Administrator;
|
||||
|
||||
/**
|
||||
* Acceptance Page object class to define user manager page objects.
|
||||
*
|
||||
* @package Page\Acceptance\Administrator
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
class UserManagerPage extends AdminPage
|
||||
{
|
||||
/**
|
||||
* Url to user manager listing page.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $url = "administrator/index.php?option=com_users&view=users";
|
||||
|
||||
/**
|
||||
* Page title of the user manager listing page.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $pageTitleText = "Users";
|
||||
|
||||
/**
|
||||
* New User Button
|
||||
*
|
||||
* @var string
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $newButton = ['class' => 'button-new'];
|
||||
|
||||
/**
|
||||
* Edit Button
|
||||
*
|
||||
* @var string
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $editButton = ['class' => 'button-edit'];
|
||||
|
||||
/**
|
||||
* Locator for the id
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $userCheckbox = ['id' => 'cb1'];
|
||||
|
||||
/**
|
||||
* Save Button
|
||||
*
|
||||
* @var string
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $saveButton = ['class' => 'button-save'];
|
||||
|
||||
/**
|
||||
* Locator for user's name input field
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $nameField = ['id' => 'jform_name'];
|
||||
|
||||
/**
|
||||
* Locator for the success message
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $successMessage = 'User saved.';
|
||||
|
||||
/**
|
||||
* Account details
|
||||
*
|
||||
* @var string
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $accountDetailsTab = ['xpath' => "//a[@href='#details']"];
|
||||
|
||||
/**
|
||||
* Locator for user's username input field
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $usernameField = ['id' => 'jform_username'];
|
||||
|
||||
/**
|
||||
* Locator for user's password input field
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $passwordField = ['id' => 'jform_password'];
|
||||
|
||||
/**
|
||||
* Locator for user's password input field for frontend
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $password1Field = ['id' => 'jform_password1'];
|
||||
|
||||
/**
|
||||
* Locator for user's repeat password input field
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $password2Field = ['id' => 'jform_password2'];
|
||||
|
||||
/**
|
||||
* Locator for user's email input field
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $emailField = ['id' => 'jform_email'];
|
||||
|
||||
/**
|
||||
* Locator for user's email input field for frontend
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $email1Field = ['id' => 'jform_email1'];
|
||||
|
||||
/**
|
||||
* Locator for user's repeat email input field
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $email2Field = ['id' => 'jform_email2'];
|
||||
|
||||
/**
|
||||
* Locator for user's username field
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $seeUserName = ['xpath' => "//table[@id='userList']//tr[1]/td[3]"];
|
||||
|
||||
/**
|
||||
* Locator for user's name field
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $seeName = ['xpath' => "//table[@id='userList']//tr[1]/td[2]"];
|
||||
|
||||
/**
|
||||
* Locator for user's last login date field in backend listing.
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $lastLoginDate = ['xpath' => "//table[@id='userList']//tr[1]/td[8]"];
|
||||
|
||||
/**
|
||||
* Locator for user is blocked
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $seeBlocked = ['xpath' => "//table[@id='userList']//*//td[4]//span[@class='icon-unpublish']"];
|
||||
|
||||
/**
|
||||
* Locator for user is unblocked
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $seeUnblocked = ['xpath' => "//table[@id='userList']//*//td[4]//span[@class='icon-publish']"];
|
||||
|
||||
/**
|
||||
* Locator for user is deleted and not found
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $noItems = ['class' => 'alert-no-items'];
|
||||
}
|
44
tests/_support/Page/Acceptance/Site/FrontPage.php
Normal file
44
tests/_support/Page/Acceptance/Site/FrontPage.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Test
|
||||
* @subpackage AcceptanceTester.Page
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Page\Acceptance\Site;
|
||||
|
||||
/**
|
||||
* Acceptance Page object class to define Frontend page objects.
|
||||
*
|
||||
* @package Page\Acceptance\Site
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
class FrontPage extends \AcceptanceTester
|
||||
{
|
||||
/**
|
||||
* Link to the frontend
|
||||
*
|
||||
* @var string
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $url = '/';
|
||||
|
||||
/**
|
||||
* Locator for alert message in frontend.
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $alertMessage = ['class' => 'alert-message'];
|
||||
|
||||
/**
|
||||
* Locator for login greeting for the user.
|
||||
*
|
||||
* @var array
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $loginGreeting = ['class' => 'login-greeting'];
|
||||
}
|
50
tests/_support/Shared/UserCredentials.php
Normal file
50
tests/_support/Shared/UserCredentials.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Tests
|
||||
* @subpackage Acceptance.tests
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Shared;
|
||||
|
||||
/**
|
||||
* Credentials for the user accounts
|
||||
*
|
||||
* @since 3.7.3
|
||||
*/
|
||||
class UserCredentials
|
||||
{
|
||||
/**
|
||||
* Name of the user
|
||||
*
|
||||
* @var string
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $name = 'Test User';
|
||||
|
||||
/**
|
||||
* Username
|
||||
*
|
||||
* @var string
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $username = 'testuser';
|
||||
|
||||
/**
|
||||
* Password
|
||||
*
|
||||
* @var string
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $password = 'secure42';
|
||||
|
||||
/**
|
||||
* Email of the user
|
||||
*
|
||||
* @var string
|
||||
* @since 3.7.3
|
||||
*/
|
||||
public static $email = 'noreply@joomla.org';
|
||||
}
|
@ -1,28 +1,20 @@
|
||||
# This is the Codeception Test Suite Configuration
|
||||
|
||||
# To use it rename this file to acceptance.suite.yml (it will be ignored by git)
|
||||
|
||||
# To run the test modify the following parameters according to your localhost details:
|
||||
# - url
|
||||
# - folder
|
||||
# - db_user and db_pass
|
||||
|
||||
# suite for acceptance tests.
|
||||
# perform tests in browser using the WebDriver or PhpBrowser.
|
||||
# Codeception Test Suite Configuration
|
||||
#
|
||||
# Suite for acceptance tests.
|
||||
# Perform tests in browser using the WebDriver or PhpBrowser.
|
||||
# If you need both WebDriver and PHPBrowser tests - create a separate suite.
|
||||
|
||||
class_name: AcceptanceTester
|
||||
modules:
|
||||
enabled:
|
||||
- Asserts
|
||||
- JoomlaBrowser
|
||||
- AcceptanceHelper
|
||||
- Helper\Acceptance
|
||||
config:
|
||||
JoomlaBrowser:
|
||||
url: 'http://localhost/tests/joomla' # the url that points to the joomla installation at /tests/system/joomla-cms
|
||||
browser: 'firefox'
|
||||
window_size: 1024x768
|
||||
capabilities:
|
||||
unexpectedAlertBehaviour: 'accept'
|
||||
window_size: 1280x1024
|
||||
username: 'admin' # UserName for the Administrator
|
||||
password: 'admin' # Password for the Administrator
|
||||
database host: 'localhost' # place where the Application is Hosted #server Address
|
||||
@ -35,20 +27,8 @@ modules:
|
||||
sample data: 'Default English (GB) Sample Data' # Default Sample Data
|
||||
admin email: 'admin@mydomain.com' # email Id of the Admin
|
||||
language: 'English (United Kingdom)' # Language in which you want the Application to be Installed
|
||||
AcceptanceHelper:
|
||||
repo_folder: '/home/travis/build/joomla-extensions/weblinks/' # Path to the Extension repository. To be used by tests to install via Install from folder
|
||||
counter_test_url: 'http://localhost/tests/joomla' # the url for the weblink item used to test hits counter
|
||||
Helper\Acceptance:
|
||||
url: 'http://localhost/tests/joomla' # the url that points to the joomla installation at /tests/system/joomla-cms - we need it twice here
|
||||
MicrosoftEdgeInsiders: false # set this to true, if you are on Windows Insiders
|
||||
|
||||
error_level: "E_ALL & ~E_STRICT & ~E_DEPRECATED"
|
||||
env:
|
||||
desktop: ~
|
||||
tablet:
|
||||
modules:
|
||||
config:
|
||||
JoomlaBrowser:
|
||||
window_size: 768x1024
|
||||
phone:
|
||||
modules:
|
||||
config:
|
||||
JoomlaBrowser:
|
||||
window_size: 480x640
|
21
tests/acceptance/install/InstallJoomlaCest.php
Normal file
21
tests/acceptance/install/InstallJoomlaCest.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_weblinks
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
class InstallJoomlaCest
|
||||
{
|
||||
public function installJoomla(\AcceptanceTester $I)
|
||||
{
|
||||
$I->am('Administrator');
|
||||
$I->installJoomlaRemovingInstallationFolder();
|
||||
$I->doAdministratorLogin();
|
||||
$I->disableStatistics();
|
||||
$I->setErrorReportingToDevelopment();
|
||||
}
|
||||
}
|
@ -8,16 +8,11 @@
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
||||
class InstallWeblinksCest
|
||||
{
|
||||
public function installJoomla(\AcceptanceTester $I)
|
||||
{
|
||||
$I->am('Administrator');
|
||||
$I->installJoomlaRemovingInstallationFolder();
|
||||
$I->doAdministratorLogin();
|
||||
$I->disableStatistics();
|
||||
$I->setErrorReportingToDevelopment();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -29,9 +24,9 @@ class InstallWeblinksCest
|
||||
$I->comment('get Weblinks repository folder from acceptance.suite.yml (see _support/AcceptanceHelper.php)');
|
||||
|
||||
// URL where the package file to install is located (mostly the same as joomla-cms)
|
||||
$url = $I->getConfiguration('url');
|
||||
$url = $I->getSuiteConfiguration('url');
|
||||
$I->installExtensionFromUrl($url . "/pkg-weblinks-current.zip");
|
||||
$I->doAdministratorLogout();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
# Codeception Test Suite Configuration
|
||||
|
||||
# suite for functional (integration) tests.
|
||||
# emulate web requests and make application process them.
|
||||
# Include one of framework modules (Symfony2, Yii2, Laravel4) to use it.
|
||||
#
|
||||
# Suite for functional (integration) tests
|
||||
# Emulate web requests and make application process them
|
||||
# Include one of the framework modules (Symfony2, Yii2, Laravel5) to use it
|
||||
|
||||
class_name: FunctionalTester
|
||||
modules:
|
||||
enabled: [Filesystem, FunctionalHelper]
|
||||
enabled:
|
||||
# add framework module here
|
||||
- \Helper\Functional
|
||||
|
@ -1,2 +1,3 @@
|
||||
<?php
|
||||
|
||||
// Here you can initialize variables that will be available to your tests
|
||||
|
@ -1,6 +1,9 @@
|
||||
# Codeception Test Suite Configuration
|
||||
#
|
||||
# Suite for unit (internal) tests.
|
||||
|
||||
# suite for unit (internal) tests.
|
||||
class_name: UnitTester
|
||||
modules:
|
||||
enabled: [Asserts, UnitHelper]
|
||||
enabled:
|
||||
- Asserts
|
||||
- \Helper\Unit
|
Loading…
Reference in New Issue
Block a user