From 04216cf96d7d2a7fa881120162c6dc206d3d48a1 Mon Sep 17 00:00:00 2001 From: Francesco Abeni Date: Thu, 29 Oct 2015 11:12:58 +0100 Subject: [PATCH 01/25] Add local configuration file for RoboFile.php --- .gitignore | 1 + RoboFile.dist.ini | 5 +++++ RoboFile.php | 39 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 RoboFile.dist.ini diff --git a/.gitignore b/.gitignore index 29f0600..c730c7f 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ vendor/* # Robo robo.phar +RoboFile.ini # Test related files tests/acceptance.suite.yml diff --git a/RoboFile.dist.ini b/RoboFile.dist.ini new file mode 100644 index 0000000..e75403c --- /dev/null +++ b/RoboFile.dist.ini @@ -0,0 +1,5 @@ + true, // default is false +); diff --git a/RoboFile.php b/RoboFile.php index 02dfb6a..c5a19e1 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -17,6 +17,8 @@ class RoboFile extends \Robo\Tasks private $extension = ''; + private $configuration = array(); + /** * Set the Execute extension for Windows Operating System * @@ -40,6 +42,8 @@ class RoboFile extends \Robo\Tasks */ public function runTests($seleniumPath = null, $suite = 'acceptance') { + $this->configuration = $this->getConfiguration(); + $this->setExecExtension(); $this->createTestingSite(); @@ -154,12 +158,16 @@ class RoboFile extends \Robo\Tasks // Kill selenium server // $this->_exec('curl http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer'); } - /** * Creates a testing Joomla site for running the tests (use it before run:test) */ public function createTestingSite() { + if (!empty($this->configuration['skipClone'])) { + $this->say('Reusing Joomla CMS site already present at tests/joomla-cms3'); + return; + } + // Get Joomla Clean Testing sites if (is_dir('tests/joomla-cms3')) { @@ -170,6 +178,35 @@ class RoboFile extends \Robo\Tasks $this->say('Joomla CMS site created at tests/joomla-cms3'); } + /** + * Get (optional) configuration from an external file + * + * @return array + */ + public function getConfiguration() + { + $configurationFile = __DIR__ . '/RoboFile.ini'; + if (!file_exists($configurationFile)) { + $this->say("No local configuration file"); + return array(); + } + + try { + require_once $configurationFile; + if (!is_array($configuration)) { + $this->say('Local configuration file is empty or wrong (it must contain a $configuration array'); + return array(); + } + + return $configuration; + } + catch (Exception $ex) + { + $this->say('Exception reading local configuration file: ' . $ex->getMessage()); + return array(); + } + } + /** * Runs Selenium Standalone Server. * From b3d4ecf6a32e0e3d842d5af91079bbe26bb9164e Mon Sep 17 00:00:00 2001 From: Francesco Abeni Date: Thu, 29 Oct 2015 11:14:35 +0100 Subject: [PATCH 02/25] Fix formatting --- RoboFile.php | 1 + 1 file changed, 1 insertion(+) diff --git a/RoboFile.php b/RoboFile.php index c5a19e1..96ea812 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -158,6 +158,7 @@ class RoboFile extends \Robo\Tasks // Kill selenium server // $this->_exec('curl http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer'); } + /** * Creates a testing Joomla site for running the tests (use it before run:test) */ From 35840637b805ca72a56ba30d1d4d05ebf9e6fc40 Mon Sep 17 00:00:00 2001 From: Francesco Abeni Date: Thu, 29 Oct 2015 12:58:49 +0100 Subject: [PATCH 03/25] Change local configuration to real INI format --- RoboFile.dist.ini | 6 +----- RoboFile.php | 26 ++++++++++---------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/RoboFile.dist.ini b/RoboFile.dist.ini index e75403c..2980766 100644 --- a/RoboFile.dist.ini +++ b/RoboFile.dist.ini @@ -1,5 +1 @@ - true, // default is false -); +skipClone = true \ No newline at end of file diff --git a/RoboFile.php b/RoboFile.php index 96ea812..a104e85 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -164,7 +164,7 @@ class RoboFile extends \Robo\Tasks */ public function createTestingSite() { - if (!empty($this->configuration['skipClone'])) { + if (!empty($this->configuration->skipClone)) { $this->say('Reusing Joomla CMS site already present at tests/joomla-cms3'); return; } @@ -182,30 +182,24 @@ class RoboFile extends \Robo\Tasks /** * Get (optional) configuration from an external file * - * @return array + * @return \stdClass|null */ public function getConfiguration() { $configurationFile = __DIR__ . '/RoboFile.ini'; + if (!file_exists($configurationFile)) { $this->say("No local configuration file"); - return array(); + return null; } - try { - require_once $configurationFile; - if (!is_array($configuration)) { - $this->say('Local configuration file is empty or wrong (it must contain a $configuration array'); - return array(); - } + $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 $configuration; - } - catch (Exception $ex) - { - $this->say('Exception reading local configuration file: ' . $ex->getMessage()); - return array(); - } + return json_decode(json_encode($configuration)); } /** From c3da104011779a6282a83876b0d95719ae74d3cd Mon Sep 17 00:00:00 2001 From: Kubik-Rubik Date: Thu, 29 Oct 2015 14:43:21 +0100 Subject: [PATCH 04/25] Updated README.md for Windows --- README.md | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9ab2dab..71d3708 100644 --- a/README.md +++ b/README.md @@ -19,19 +19,41 @@ $ vendor/bin/robo run:tests You need to install: - Git for windows (https://msysgit.github.io/) - GitHub for windows (https://windows.github.com/) -- Curl for windows if necesssary. +- Curl for Windows if necesssary. Note: For commands line is better if you use the 'Git shell' program. -Create a symbolic link from your tests\joomla-cms3 to a subfolder of your web server. For example, I'm creating a link between the tests folder of my weblinks folder and the tests folder of my web server: -mklink /J C:\wamp\www\tests\joomla-cms3 C:\Users\Nicolas\Documents\GitHub\weblinks\tests\joomla-cms3 +First you should create a fork of the official repository and clone the fork into your web server folder. -Go in the folder of weblinks, for example: -cd C:\Users\Nicolas\Documents\GitHub\weblinks +To prepare the system tests (Selenium) to be run in your local machine you are asked to rename the file `tests/acceptance.suite.dist.yml` to `tests/acceptance.suite.yml`. Afterwards, please edit the file according to your system needs. -Then, run the command: -composer install +The next step is only required if you don't place the weblinks folder into your web server folder. Create a symbolic link from your tests\joomla-cms3 to a subfolder of your web server. For example: -That will add all the dependencies for the testing of weblinks -You can then run the command: -vendor\bin\robo.bat test:acceptance +```bash +mklink /J C:\wamp\www\tests\joomla-cms3 C:\Users\Name\Documents\GitHub\weblinks\tests\joomla-cms3 +``` + +Open the console and go in the folder of weblinks, for example: + +```bash +cd C:\wamp\www\weblinks +``` + +Then run the command: + +```bash +$ composer install +``` + +That will add all the dependencies for the testing of weblinks. You can then run the command: + +```bash +$ php.exe vendor/codeception/codeception/codecept build +$ vendor/bin/robo run:tests +``` + +Once all tests are executed, you may also run a specific test: + +```bash +$ vendor/bin/robo run:test // Then select the test you want to run! +``` \ No newline at end of file From 3e268d0626fa5d4300c7c5122fd1e6fc2859c417 Mon Sep 17 00:00:00 2001 From: Francesco Abeni Date: Thu, 29 Oct 2015 14:52:04 +0100 Subject: [PATCH 05/25] Add config param for local cms folder --- RoboFile.dist.ini | 3 ++- RoboFile.php | 33 ++++++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/RoboFile.dist.ini b/RoboFile.dist.ini index 2980766..8d3a728 100644 --- a/RoboFile.dist.ini +++ b/RoboFile.dist.ini @@ -1 +1,2 @@ -skipClone = true \ No newline at end of file +skipClone = true +cmsPath = /path/to/my/local/website/root \ No newline at end of file diff --git a/RoboFile.php b/RoboFile.php index a104e85..216acce 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -19,6 +19,8 @@ class RoboFile extends \Robo\Tasks private $configuration = array(); + private $cmsPath = ''; + /** * Set the Execute extension for Windows Operating System * @@ -44,6 +46,8 @@ class RoboFile extends \Robo\Tasks { $this->configuration = $this->getConfiguration(); + $this->cmsPath = $this->getCmsPath(); + $this->setExecExtension(); $this->createTestingSite(); @@ -165,18 +169,18 @@ class RoboFile extends \Robo\Tasks public function createTestingSite() { if (!empty($this->configuration->skipClone)) { - $this->say('Reusing Joomla CMS site already present at tests/joomla-cms3'); + $this->say('Reusing Joomla CMS site already present at ' . $this->cmsPath); return; } // Get Joomla Clean Testing sites - if (is_dir('tests/joomla-cms3')) + if (is_dir($this->cmsPath)) { - $this->taskDeleteDir('tests/joomla-cms3')->run(); + $this->taskDeleteDir($this->cmsPath)->run(); } - $this->_exec('git' . $this->extension . ' clone -b staging --single-branch --depth 1 https://github.com/joomla/joomla-cms.git tests/joomla-cms3'); - $this->say('Joomla CMS site created at tests/joomla-cms3'); + $this->_exec('git' . $this->extension . ' clone -b staging --single-branch --depth 1 https://github.com/joomla/joomla-cms.git ' . $this->cmsPath); + $this->say('Joomla CMS site created at ' . $this->cmsPath); } /** @@ -202,6 +206,25 @@ class RoboFile extends \Robo\Tasks return json_decode(json_encode($configuration)); } + /** + * Get the correct CMS root path + * + * @return string + */ + private function getCmsPath() + { + if (empty($this->configuration->cmsPath)) { + return 'tests/joomla-cms3'; + } + + 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-cms3'; + } + + return $this->configuration->cmsPath; + } + /** * Runs Selenium Standalone Server. * From ec02c4f2e695d964b8abc5b651b7e15be25a6ee9 Mon Sep 17 00:00:00 2001 From: Yves Hoppe Date: Thu, 29 Oct 2015 15:49:33 +0100 Subject: [PATCH 06/25] Added local caching for the cloned joomla-cms --- RoboFile.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/RoboFile.php b/RoboFile.php index a104e85..9cb5cae 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -164,9 +164,10 @@ class RoboFile extends \Robo\Tasks */ public function createTestingSite() { - if (!empty($this->configuration->skipClone)) { - $this->say('Reusing Joomla CMS site already present at tests/joomla-cms3'); - return; + // Caching cloned installations locally + if (!is_dir('tests/cache') || (time() - filemtime('tests/cache') > 60 * 60 * 24)) + { + $this->_exec('git' . $this->extension . ' clone -b staging --single-branch --depth 1 https://github.com/joomla/joomla-cms.git tests/cache'); } // Get Joomla Clean Testing sites @@ -175,7 +176,9 @@ class RoboFile extends \Robo\Tasks $this->taskDeleteDir('tests/joomla-cms3')->run(); } - $this->_exec('git' . $this->extension . ' clone -b staging --single-branch --depth 1 https://github.com/joomla/joomla-cms.git tests/joomla-cms3'); + // Copy cache to the testing folder + $this->_copyDir('tests/cache', 'tests/joomla-cms3'); + $this->say('Joomla CMS site created at tests/joomla-cms3'); } From 2b369b1cff41565cb3393431c6f8c1d9c947f036 Mon Sep 17 00:00:00 2001 From: Yves Hoppe Date: Thu, 29 Oct 2015 15:57:41 +0100 Subject: [PATCH 07/25] Added local caching for the cloned joomla-cms --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c730c7f..17d28c5 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,4 @@ tests/_output* selenium-server-standalone.jar codecept.phar selenium.log +tests/cache From 08c2f8b641b2ebad62ee51390fe8f8f77c0fc48e Mon Sep 17 00:00:00 2001 From: Francesco Abeni Date: Thu, 29 Oct 2015 16:06:04 +0100 Subject: [PATCH 08/25] Improve dist.ini file and fix CS --- RoboFile.dist.ini | 8 ++++++-- RoboFile.php | 15 ++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/RoboFile.dist.ini b/RoboFile.dist.ini index 8d3a728..615510f 100644 --- a/RoboFile.dist.ini +++ b/RoboFile.dist.ini @@ -1,2 +1,6 @@ -skipClone = true -cmsPath = /path/to/my/local/website/root \ No newline at end of file +; If set to true, the repo will not be cloned from GitHub and the local copy will be reused. +; This setting will be obsolete once we have local Git cache enabled +skipClone = false +; If you want to setup your test website in a different folder, you can do that here. +; You can also set an absolute path, i.e. /path/to/my/cms/folder +cmsPath = tests/joomla-cms3 \ No newline at end of file diff --git a/RoboFile.php b/RoboFile.php index 216acce..48e8daf 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -168,7 +168,8 @@ class RoboFile extends \Robo\Tasks */ public function createTestingSite() { - if (!empty($this->configuration->skipClone)) { + if (!empty($this->configuration->skipClone)) + { $this->say('Reusing Joomla CMS site already present at ' . $this->cmsPath); return; } @@ -192,13 +193,15 @@ class RoboFile extends \Robo\Tasks { $configurationFile = __DIR__ . '/RoboFile.ini'; - if (!file_exists($configurationFile)) { + if (!file_exists($configurationFile)) + { $this->say("No local configuration file"); return null; } $configuration = parse_ini_file($configurationFile); - if ($configuration === false) { + if ($configuration === false) + { $this->say('Local configuration file is empty or wrong (check is it in correct .ini format'); return null; } @@ -213,11 +216,13 @@ class RoboFile extends \Robo\Tasks */ private function getCmsPath() { - if (empty($this->configuration->cmsPath)) { + if (empty($this->configuration->cmsPath)) + { return 'tests/joomla-cms3'; } - if (!file_exists(dirname($this->configuration->cmsPath))) { + 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-cms3'; } From 2135f26ea0177f40105dd61629633c18ba7a47bf Mon Sep 17 00:00:00 2001 From: javier gomez Date: Fri, 30 Oct 2015 10:43:37 +0100 Subject: [PATCH 09/25] Fix Apache running on PHP 5.3 instead of 5.5 --- .travis.yml | 30 +++++++++++++++++++----------- RoboFile.php | 18 +++++++++++++----- tests/travis-ci-apache.conf | 26 ++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 16 deletions(-) create mode 100644 tests/travis-ci-apache.conf diff --git a/.travis.yml b/.travis.yml index 2d67c21..8f3fe44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,16 +9,23 @@ matrix: - php: 7.0 before_script: - sudo apt-get update -qq -# Install Apache -- sudo apt-get install -y --force-yes apache2 libapache2-mod-php5 php5-curl php5-mysql php5-intl php5-gd > /dev/null -- sudo /etc/init.d/apache2 stop -- sudo sed -i -e "s,APACHE_RUN_USER=www-data,APACHE_RUN_USER=$USER,g" /etc/apache2/envvars -- sudo sed -i -e "s,APACHE_RUN_GROUP=www-data,APACHE_RUN_GROUP=$USER,g" /etc/apache2/envvars -- sudo chown -R $USER /var/lock/apache2 -- sudo chown -R $USER:$USER /var/www -- ln -s $TRAVIS_BUILD_DIR/tests/ /var/www/tests -- sudo sed -i -e "s,AllowOverride[ ]None,AllowOverride All,g" /etc/apache2/sites-available/default -- sudo /etc/init.d/apache2 start +- sudo apt-get install -y --force-yes apache2 libapache2-mod-fastcgi php5-curl php5-mysql php5-intl php5-gd > /dev/null +- sudo mkdir $(pwd)/.run +- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf +- sudo sed -e "s,listen = 127.0.0.1:9000,listen = /tmp/php5-fpm.sock,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf +- sudo sed -e "s,;listen.owner = nobody,listen.owner = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf +- sudo sed -e "s,;listen.group = nobody,listen.group = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf +- sudo sed -e "s,;listen.mode = 0660,listen.mode = 0666,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf +- sudo sed -e "s,user = nobody,;user = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf +- sudo sed -e "s,group = nobody,;group = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf +- cat ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf +- sudo a2enmod rewrite actions fastcgi alias +- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini +- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm +- sudo cp -f tests/travis-ci-apache.conf /etc/apache2/sites-available/default +- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default +- git submodule update --init --recursive +- sudo service apache2 restart # Xvfb - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" @@ -27,8 +34,9 @@ before_script: - sudo apt-get install fluxbox -y --force-yes - fluxbox & - sleep 3 # give fluxbox some time to start +# Composer - composer install script: - mv tests/acceptance.suite.dist.yml tests/acceptance.suite.yml -- vendor/bin/robo run:tests +- vendor/bin/robo run:tests true diff --git a/RoboFile.php b/RoboFile.php index 9cb5cae..46c203f 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -35,18 +35,17 @@ class RoboFile extends \Robo\Tasks /** * Executes all the Selenium System Tests in a suite on your machine * - * @param string $seleniumPath Optional path to selenium-standalone-server-x.jar - * @param string $suite Optional, the name of the tests suite + * @param bool $use_htaccess Renames and enable embedded Joomla .htaccess file * * @return mixed */ - public function runTests($seleniumPath = null, $suite = 'acceptance') + public function runTests($use_htaccess = false) { $this->configuration = $this->getConfiguration(); $this->setExecExtension(); - $this->createTestingSite(); + $this->createTestingSite($use_htaccess); $this->getComposer(); @@ -161,8 +160,10 @@ class RoboFile extends \Robo\Tasks /** * 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 */ - public function createTestingSite() + public function createTestingSite($use_htaccess = false) { // Caching cloned installations locally if (!is_dir('tests/cache') || (time() - filemtime('tests/cache') > 60 * 60 * 24)) @@ -180,6 +181,13 @@ class RoboFile extends \Robo\Tasks $this->_copyDir('tests/cache', 'tests/joomla-cms3'); $this->say('Joomla CMS site created at tests/joomla-cms3'); + + // Optionally uses Joomla default htaccess file + if ($use_htaccess == true) + { + $this->_copy('tests/joomla-cms3/htaccess.txt', 'tests/joomla-cms3/.htaccess'); + $this->_exec('sed -e "s,# RewriteBase /,RewriteBase /tests/joomla-cms3/,g" --in-place tests/joomla-cms3/.htaccess'); + } } /** diff --git a/tests/travis-ci-apache.conf b/tests/travis-ci-apache.conf new file mode 100644 index 0000000..e60a71a --- /dev/null +++ b/tests/travis-ci-apache.conf @@ -0,0 +1,26 @@ + + ServerAdmin webmaster@localhost + DocumentRoot %TRAVIS_BUILD_DIR% + + + Options FollowSymLinks + AllowOverride All + + + + Options FollowSymLinks MultiViews ExecCGI + AllowOverride All + Order deny,allow + Allow from all + + + # Wire up Apache to use Travis CI's php-fpm. + + AddHandler php5-fcgi .php + Action php5-fcgi /php5-fcgi + Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi + FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /tmp/php5-fpm.sock -pass-header Authorization + + + ErrorLog ${APACHE_LOG_DIR}/error.log + \ No newline at end of file From d42948bd4895e3a804b2b6f7a650b9bd282a266c Mon Sep 17 00:00:00 2001 From: puneet0191 Date: Thu, 29 Oct 2015 15:17:53 +0530 Subject: [PATCH 10/25] Adding Test for Deleting Category Fixes #103 --- composer.lock | 190 ++++++++---------- tests/_support/Step/Acceptance/category.php | 65 ++++++ .../AdministratorCategoriesCest.php | 95 ++++----- 3 files changed, 183 insertions(+), 167 deletions(-) create mode 100644 tests/_support/Step/Acceptance/category.php diff --git a/composer.lock b/composer.lock index 230610c..f444dc6 100644 --- a/composer.lock +++ b/composer.lock @@ -352,16 +352,16 @@ }, { "name": "guzzlehttp/promises", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "97fe7210def29451ec74923b27e552238defd75a" + "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/97fe7210def29451ec74923b27e552238defd75a", - "reference": "97fe7210def29451ec74923b27e552238defd75a", + "url": "https://api.github.com/repos/guzzle/promises/zipball/b1e1c0d55f8083c71eda2c28c12a228d708294ea", + "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea", "shasum": "" }, "require": { @@ -399,7 +399,7 @@ "keywords": [ "promise" ], - "time": "2015-08-15 19:37:21" + "time": "2015-10-15 22:28:00" }, { "name": "guzzlehttp/psr7", @@ -464,12 +464,12 @@ "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/henrikbjorn/Lurker.git", + "url": "https://github.com/flint/Lurker.git", "reference": "a020d45b3bc37810aeafe27343c51af8a74c9419" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/henrikbjorn/Lurker/zipball/a020d45b3bc37810aeafe27343c51af8a74c9419", + "url": "https://api.github.com/repos/flint/Lurker/zipball/a020d45b3bc37810aeafe27343c51af8a74c9419", "reference": "a020d45b3bc37810aeafe27343c51af8a74c9419", "shasum": "" }, @@ -498,18 +498,16 @@ ], "authors": [ { - "name": "Henrik Bjornskov", - "email": "henrik@bjrnskov.dk", - "homepage": "http://henrik.bjrnskov.dk" + "name": "Yaroslav Kiliba", + "email": "om.dattaya@gmail.com" }, { "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" + "email": "ever.zet@gmail.com" }, { - "name": "Yaroslav Kiliba", - "email": "om.dattaya@gmail.com" + "name": "Henrik Bjrnskov", + "email": "henrik@bjrnskov.dk" } ], "description": "Resource Watcher.", @@ -526,12 +524,12 @@ "source": { "type": "git", "url": "https://github.com/joomla-projects/joomla-browser.git", - "reference": "3cfe403c0866ea8ec74e985cd6f6b9710f4f37fa" + "reference": "0b43acdf38d9322efdfc4ee9730f7bd1cf96b2f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-projects/joomla-browser/zipball/3cfe403c0866ea8ec74e985cd6f6b9710f4f37fa", - "reference": "3cfe403c0866ea8ec74e985cd6f6b9710f4f37fa", + "url": "https://api.github.com/repos/joomla-projects/joomla-browser/zipball/0b43acdf38d9322efdfc4ee9730f7bd1cf96b2f9", + "reference": "0b43acdf38d9322efdfc4ee9730f7bd1cf96b2f9", "shasum": "" }, "require": { @@ -569,7 +567,7 @@ "acceptance testing", "joomla" ], - "time": "2015-10-07 10:06:16" + "time": "2015-10-29 14:44:24" }, { "name": "joomla-projects/robo", @@ -759,16 +757,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.2.3", + "version": "2.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f" + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef1ca6835468857944d5c3b48fa503d5554cff2f", - "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", "shasum": "" }, "require": { @@ -817,7 +815,7 @@ "testing", "xunit" ], - "time": "2015-09-14 06:51:16" + "time": "2015-10-06 15:47:00" }, { "name": "phpunit/php-file-iterator", @@ -999,16 +997,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.8.10", + "version": "4.8.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "463163747474815c5ccd4ae12b5b355ec12158e8" + "reference": "625f8c345606ed0f3a141dfb88f4116f0e22978e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/463163747474815c5ccd4ae12b5b355ec12158e8", - "reference": "463163747474815c5ccd4ae12b5b355ec12158e8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/625f8c345606ed0f3a141dfb88f4116f0e22978e", + "reference": "625f8c345606ed0f3a141dfb88f4116f0e22978e", "shasum": "" }, "require": { @@ -1067,7 +1065,7 @@ "testing", "xunit" ], - "time": "2015-10-01 09:14:30" + "time": "2015-10-23 06:48:33" }, { "name": "phpunit/phpunit-mock-objects", @@ -1408,16 +1406,16 @@ }, { "name": "sebastian/global-state", - "version": "1.0.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", "shasum": "" }, "require": { @@ -1455,7 +1453,7 @@ "keywords": [ "global state" ], - "time": "2014-10-06 09:23:50" + "time": "2015-10-12 03:26:01" }, { "name": "sebastian/recursion-context", @@ -1622,16 +1620,16 @@ }, { "name": "symfony/browser-kit", - "version": "v2.7.5", + "version": "v2.7.6", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "277a2457776d4cc25706fbdd9d1e4ab2dac884e4" + "reference": "07d664a052572ccc28eb2ab7dbbe82155b1ad367" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/277a2457776d4cc25706fbdd9d1e4ab2dac884e4", - "reference": "277a2457776d4cc25706fbdd9d1e4ab2dac884e4", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/07d664a052572ccc28eb2ab7dbbe82155b1ad367", + "reference": "07d664a052572ccc28eb2ab7dbbe82155b1ad367", "shasum": "" }, "require": { @@ -1640,8 +1638,7 @@ }, "require-dev": { "symfony/css-selector": "~2.0,>=2.0.5", - "symfony/phpunit-bridge": "~2.7", - "symfony/process": "~2.0,>=2.0.5" + "symfony/process": "~2.3.34|~2.7,>=2.7.6" }, "suggest": { "symfony/process": "" @@ -1673,29 +1670,26 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2015-09-06 08:36:38" + "time": "2015-10-23 14:47:27" }, { "name": "symfony/config", - "version": "v2.7.5", + "version": "v2.7.6", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "9698fdf0a750d6887d5e7729d5cf099765b20e61" + "reference": "831f88908b51b9ce945f5e6f402931d1ac544423" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/9698fdf0a750d6887d5e7729d5cf099765b20e61", - "reference": "9698fdf0a750d6887d5e7729d5cf099765b20e61", + "url": "https://api.github.com/repos/symfony/config/zipball/831f88908b51b9ce945f5e6f402931d1ac544423", + "reference": "831f88908b51b9ce945f5e6f402931d1ac544423", "shasum": "" }, "require": { "php": ">=5.3.9", "symfony/filesystem": "~2.3" }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, "type": "library", "extra": { "branch-alias": { @@ -1723,20 +1717,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2015-09-21 15:02:29" + "time": "2015-10-11 09:39:48" }, { "name": "symfony/console", - "version": "v2.7.5", + "version": "v2.7.6", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "06cb17c013a82f94a3d840682b49425cd00a2161" + "reference": "5efd632294c8320ea52492db22292ff853a43766" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/06cb17c013a82f94a3d840682b49425cd00a2161", - "reference": "06cb17c013a82f94a3d840682b49425cd00a2161", + "url": "https://api.github.com/repos/symfony/console/zipball/5efd632294c8320ea52492db22292ff853a43766", + "reference": "5efd632294c8320ea52492db22292ff853a43766", "shasum": "" }, "require": { @@ -1745,7 +1739,6 @@ "require-dev": { "psr/log": "~1.0", "symfony/event-dispatcher": "~2.1", - "symfony/phpunit-bridge": "~2.7", "symfony/process": "~2.1" }, "suggest": { @@ -1780,28 +1773,25 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2015-09-25 08:32:23" + "time": "2015-10-20 14:38:46" }, { "name": "symfony/css-selector", - "version": "v2.7.5", + "version": "v2.7.6", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "abe19cc0429a06be0c133056d1f9859854860970" + "reference": "e1b865b26be4a56d22a8dee398375044a80c865b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/abe19cc0429a06be0c133056d1f9859854860970", - "reference": "abe19cc0429a06be0c133056d1f9859854860970", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/e1b865b26be4a56d22a8dee398375044a80c865b", + "reference": "e1b865b26be4a56d22a8dee398375044a80c865b", "shasum": "" }, "require": { "php": ">=5.3.9" }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, "type": "library", "extra": { "branch-alias": { @@ -1833,28 +1823,27 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2015-09-22 13:49:29" + "time": "2015-10-11 09:39:48" }, { "name": "symfony/dom-crawler", - "version": "v2.7.5", + "version": "v2.7.6", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "2e185ca136399f902b948694987e62c80099c052" + "reference": "5fef7d8b80d8f9992df99d8ee283f420484c9612" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/2e185ca136399f902b948694987e62c80099c052", - "reference": "2e185ca136399f902b948694987e62c80099c052", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/5fef7d8b80d8f9992df99d8ee283f420484c9612", + "reference": "5fef7d8b80d8f9992df99d8ee283f420484c9612", "shasum": "" }, "require": { "php": ">=5.3.9" }, "require-dev": { - "symfony/css-selector": "~2.3", - "symfony/phpunit-bridge": "~2.7" + "symfony/css-selector": "~2.3" }, "suggest": { "symfony/css-selector": "" @@ -1886,20 +1875,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2015-09-20 21:13:58" + "time": "2015-10-11 09:39:48" }, { "name": "symfony/event-dispatcher", - "version": "v2.7.5", + "version": "v2.7.6", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9" + "reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ae4dcc2a8d3de98bd794167a3ccda1311597c5d9", - "reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/87a5db5ea887763fa3a31a5471b512ff1596d9b8", + "reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8", "shasum": "" }, "require": { @@ -1910,7 +1899,6 @@ "symfony/config": "~2.0,>=2.0.5", "symfony/dependency-injection": "~2.6", "symfony/expression-language": "~2.6", - "symfony/phpunit-bridge": "~2.7", "symfony/stopwatch": "~2.3" }, "suggest": { @@ -1944,28 +1932,25 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2015-09-22 13:49:29" + "time": "2015-10-11 09:39:48" }, { "name": "symfony/filesystem", - "version": "v2.7.5", + "version": "v2.7.6", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab" + "reference": "56fd6df73be859323ff97418d97edc1d756df6df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/a17f8a17c20e8614c15b8e116e2f4bcde102cfab", - "reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/56fd6df73be859323ff97418d97edc1d756df6df", + "reference": "56fd6df73be859323ff97418d97edc1d756df6df", "shasum": "" }, "require": { "php": ">=5.3.9" }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, "type": "library", "extra": { "branch-alias": { @@ -1993,28 +1978,25 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2015-09-09 17:42:36" + "time": "2015-10-18 20:23:18" }, { "name": "symfony/finder", - "version": "v2.7.5", + "version": "v2.7.6", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "8262ab605973afbb3ef74b945daabf086f58366f" + "reference": "2ffb4e9598db3c48eb6d0ae73b04bbf09280c59d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/8262ab605973afbb3ef74b945daabf086f58366f", - "reference": "8262ab605973afbb3ef74b945daabf086f58366f", + "url": "https://api.github.com/repos/symfony/finder/zipball/2ffb4e9598db3c48eb6d0ae73b04bbf09280c59d", + "reference": "2ffb4e9598db3c48eb6d0ae73b04bbf09280c59d", "shasum": "" }, "require": { "php": ">=5.3.9" }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, "type": "library", "extra": { "branch-alias": { @@ -2042,28 +2024,25 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2015-09-19 19:59:23" + "time": "2015-10-11 09:39:48" }, { "name": "symfony/process", - "version": "v2.7.5", + "version": "v2.7.6", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "b27c8e317922cd3cdd3600850273cf6b82b2e8e9" + "reference": "4a959dd4e19c2c5d7512689413921e0a74386ec7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/b27c8e317922cd3cdd3600850273cf6b82b2e8e9", - "reference": "b27c8e317922cd3cdd3600850273cf6b82b2e8e9", + "url": "https://api.github.com/repos/symfony/process/zipball/4a959dd4e19c2c5d7512689413921e0a74386ec7", + "reference": "4a959dd4e19c2c5d7512689413921e0a74386ec7", "shasum": "" }, "require": { "php": ">=5.3.9" }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, "type": "library", "extra": { "branch-alias": { @@ -2091,28 +2070,25 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2015-09-19 19:59:23" + "time": "2015-10-23 14:47:27" }, { "name": "symfony/yaml", - "version": "v2.7.5", + "version": "v2.7.6", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770" + "reference": "eca9019c88fbe250164affd107bc8057771f3f4d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/31cb2ad0155c95b88ee55fe12bc7ff92232c1770", - "reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770", + "url": "https://api.github.com/repos/symfony/yaml/zipball/eca9019c88fbe250164affd107bc8057771f3f4d", + "reference": "eca9019c88fbe250164affd107bc8057771f3f4d", "shasum": "" }, "require": { "php": ">=5.3.9" }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, "type": "library", "extra": { "branch-alias": { @@ -2140,7 +2116,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-09-14 14:14:09" + "time": "2015-10-11 09:39:48" } ], "aliases": [], diff --git a/tests/_support/Step/Acceptance/category.php b/tests/_support/Step/Acceptance/category.php new file mode 100644 index 0000000..2e7c44d --- /dev/null +++ b/tests/_support/Step/Acceptance/category.php @@ -0,0 +1,65 @@ +am('Administrator'); + $I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks'); + $I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']); + $I->expectTo('see categories page'); + $I->checkForPhpNoticesOrWarnings(); + + $I->amGoingTo('try to save a category with a filled title'); + $I->clickToolbarButton('New'); + $I->waitForText('Weblinks: New Category', '30', ['css' => 'h1']); + $I->fillField(['id' => 'jform_title'], $categoryName); + $I->clickToolbarButton('Save & Close'); + $I->expectTo('see a success message after saving the category'); + $I->see('Category successfully saved', ['id' => 'system-message-container']); + } + + /** + * Function to Delete a Category in Joomla! + * + * @param String $categoryName Name of the category which is to be deleted + * + * @return void + */ + public function trashCategory($categoryName) + { + $I = $this; + $I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks'); + $I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']); + $I->searchForItem($categoryName); + $I->amGoingTo('Select the weblink result'); + $I->checkAllResults(); + $I->clickToolbarButton("Trash"); + $I->see('category successfully trashed.', ['id' => 'system-message-container']); + } +} diff --git a/tests/acceptance/administrator/AdministratorCategoriesCest.php b/tests/acceptance/administrator/AdministratorCategoriesCest.php index 5518e73..6bd8b7f 100644 --- a/tests/acceptance/administrator/AdministratorCategoriesCest.php +++ b/tests/acceptance/administrator/AdministratorCategoriesCest.php @@ -9,26 +9,18 @@ */ class AdministratorCategoriesCest { - public function administratorCreateCategory(AcceptanceTester $I) + public function administratorCreateCategory(\Step\Acceptance\category $I) { $I->am('Administrator'); + $categoryName = 'automated testing' . rand(1, 100); $I->wantToTest('Category creation in /administrator/'); $I->doAdministratorLogin(); - $I->amGoingTo('Navigate to Categories page in /administrator/'); - $I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks'); - $I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']); - $I->expectTo('see categories page'); - $I->checkForPhpNoticesOrWarnings(); - - $I->amGoingTo('try to save a category with a filled title'); - $I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('category.add')\"]"]); - $I->waitForText('Weblinks: New Category', '30', ['css' => 'h1']); - $I->fillField(['id' => 'jform_title'], 'automated testing' . rand(1, 100)); - $I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('category.apply')\"]"]); - $I->expectTo('see a success message after saving the category'); - $I->see('Category successfully saved', ['id' => 'system-message-container']); + $I->amGoingTo('Navigate to Categories page in /administrator/ and create a Category'); + $I->createCategory($categoryName); + $I->amGoingTo('Delete the Category which was created'); + $I->trashCategory($categoryName); } public function administratorCreateCategoryWithoutTitleFails(AcceptanceTester $I) @@ -51,86 +43,69 @@ class AdministratorCategoriesCest $I->see('Invalid field: Title', ['id' => 'system-message-container']); } - public function administratorPublishCategory(AcceptanceTester $I) + public function administratorPublishCategory(\Step\Acceptance\category $I) { $I->am('Administrator'); - $I->wantToTest('Category publishing in /administrator/'); + + $categoryName = 'automated testing pub' . rand(1, 100); + $I->wantToTest('Category creation in /administrator/'); $I->doAdministratorLogin(); - $I->amGoingTo('Navigate to Categories page in /administrator/'); - $I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks'); - $I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']); - $I->expectTo('see categories page'); - $I->checkForPhpNoticesOrWarnings(); + $I->amGoingTo('Navigate to Categories page in /administrator/ and create a new Category'); + $I->createCategory($categoryName); - $I->amGoingTo('try to save a category with a filled title'); - $I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('category.add')\"]"]); - $I->waitForText('Weblinks: New Category', '30', ['css' => 'h1']); - $I->fillField(['id' => 'jform_title'], 'automated testing pub' . rand(1, 100)); - $I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('category.save')\"]"]); - - $I->expectTo('see a success message after saving the category'); - $I->see('Category successfully saved', ['id' => 'system-message-container']); - - $I->amGoingTo('Search for automated testing'); - $I->fillField(['xpath' => "//input[@id=\"filter_search\"]"], "automated testing pub" . "\n"); + $I->searchForItem($categoryName); $I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']); - $I->amGoingTo('Select the first weblink'); - $I->click(['xpath' => "//input[@id=\"cb0\"]"]); + $I->checkAllResults(); $I->amGoingTo('try to publish a weblink category'); - $I->click(['xpath' => "//button[@onclick=\"if (document.adminForm.boxchecked.value==0){alert('Please first make a selection from the list.');}else{ Joomla.submitbutton('categories.publish')}\"]"]); + $I->clickToolbarButton('publish'); $I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']); $I->expectTo('see a success message after publishing the category'); $I->see('1 category successfully published.', ['id' => 'system-message-container']); + + $I->amGoingTo('Delete the Category which was created'); + $I->trashCategory($categoryName); } - public function administratorUnpublishCategory(AcceptanceTester $I) + public function administratorUnpublishCategory(\Step\Acceptance\category $I) { $I->am('Administrator'); - $I->wantToTest('Category unpublishing in /administrator/'); + + $categoryName = 'automated testing unpub' . rand(1, 100); + $I->wantToTest('Category creation in /administrator/'); $I->doAdministratorLogin(); $I->amGoingTo('Navigate to Categories page in /administrator/'); - $I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks'); - $I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']); - $I->expectTo('see categories page'); - $I->checkForPhpNoticesOrWarnings(); + $I->createCategory($categoryName); - $I->amGoingTo('try to save a category with a filled title'); - $I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('category.add')\"]"]); - $I->waitForText('Weblinks: New Category', '30', ['css' => 'h1']); - $I->fillField(['id' => 'jform_title'], 'automated testing unpub' . rand(1, 100)); - $I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('category.save')\"]"]); - - $I->expectTo('see a success message after saving the category'); - $I->see('Category successfully saved', ['id' => 'system-message-container']); - - $I->amGoingTo('Search for automated testing'); - $I->fillField(['xpath' => "//input[@id=\"filter_search\"]"], "automated testing unpub" . "\n"); + $I->searchForItem($categoryName); $I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']); - $I->amGoingTo('Select the first weblink'); - $I->click(['xpath' => "//input[@id=\"cb0\"]"]); + $I->checkAllResults(); - $I->amGoingTo('Try to publish a weblink category'); - $I->click(['xpath' => "//button[@onclick=\"if (document.adminForm.boxchecked.value==0){alert('Please first make a selection from the list.');}else{ Joomla.submitbutton('categories.publish')}\"]"]); + //publish the category + $I->amGoingTo('try to publish a weblink category'); + $I->clickToolbarButton('publish'); $I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']); - $I->expectTo('See a success message after publishing the category'); + $I->expectTo('see a success message after publishing the category'); $I->see('1 category successfully published.', ['id' => 'system-message-container']); // Unpublish it again $I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']); - $I->amGoingTo('Select the first weblink'); - $I->click(['xpath' => "//input[@id=\"cb0\"]"]); + $I->checkAllResults(); $I->amGoingTo('Try to unpublish a weblink category'); - $I->click(['xpath' => "//button[@onclick=\"if (document.adminForm.boxchecked.value==0){alert('Please first make a selection from the list.');}else{ Joomla.submitbutton('categories.unpublish')}\"]"]); + $I->clickToolbarButton('unpublish'); $I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']); $I->expectTo('See a success message after unpublishing the category'); $I->see('1 category successfully unpublished', ['id' => 'system-message-container']); + + //delete the category + $I->amGoingTo('Delete the Category which was created'); + $I->trashCategory($categoryName); } } \ No newline at end of file From 46f42ceb73d887f6feb6cbe861cee90e0a7f42aa Mon Sep 17 00:00:00 2001 From: kshitij sharma Date: Fri, 30 Oct 2015 11:27:28 +0100 Subject: [PATCH 11/25] Kill selenium Server Function to kill the already running selenium server --- RoboFile.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/RoboFile.php b/RoboFile.php index 02dfb6a..7b12979 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -211,4 +211,16 @@ class RoboFile extends \Robo\Tasks $this->_exec('curl --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. + */ + 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"); + } } From a80e3ab53c7a7355444de7df344bde4cb7712a3d Mon Sep 17 00:00:00 2001 From: javier gomez Date: Fri, 30 Oct 2015 11:28:40 +0100 Subject: [PATCH 12/25] Temporary remove tests in PHP 7 --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f3fe44..85292bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,11 +2,9 @@ language: php php: - 5.5 - 5.6 -- 7.0 matrix: allow_failures: - php: 5.6 - - php: 7.0 before_script: - sudo apt-get update -qq - sudo apt-get install -y --force-yes apache2 libapache2-mod-fastcgi php5-curl php5-mysql php5-intl php5-gd > /dev/null From 7a2aca3b9aff20bb7fb16fba4d53e52fef4f9bf0 Mon Sep 17 00:00:00 2001 From: Francesco Abeni Date: Fri, 30 Oct 2015 10:38:10 +0100 Subject: [PATCH 13/25] Extend clone options --- RoboFile.dist.ini | 4 +++- RoboFile.php | 27 +++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/RoboFile.dist.ini b/RoboFile.dist.ini index 615510f..4a467da 100644 --- a/RoboFile.dist.ini +++ b/RoboFile.dist.ini @@ -3,4 +3,6 @@ skipClone = false ; If you want to setup your test website in a different folder, you can do that here. ; You can also set an absolute path, i.e. /path/to/my/cms/folder -cmsPath = tests/joomla-cms3 \ No newline at end of file +cmsPath = tests/joomla-cms3 +; If you want to clone a different branch, you can set it here +branch = staging diff --git a/RoboFile.php b/RoboFile.php index 3be30d4..8794976 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -28,7 +28,7 @@ class RoboFile extends \Robo\Tasks */ private function setExecExtension() { - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') + if ($this->isWindows()) { $this->extension = '.exe'; } @@ -177,7 +177,7 @@ class RoboFile extends \Robo\Tasks // Caching cloned installations locally if (!is_dir('tests/cache') || (time() - filemtime('tests/cache') > 60 * 60 * 24)) { - $this->_exec('git' . $this->extension . ' clone -b staging --single-branch --depth 1 https://github.com/joomla/joomla-cms.git tests/cache'); + $this->_exec($this->buildGitCloneCommand()); } // Get Joomla Clean Testing sites @@ -216,6 +216,29 @@ class RoboFile extends \Robo\Tasks return json_decode(json_encode($configuration)); } + /** + * Build correct git clone command according to local configuration and OS + * + * @return string + */ + private function buildGitCloneCommand() + { + $branch = empty($this->configuration->branch) ? 'staging' : $this->configuration->branch; + $insecure = $this->isWindows() ? ' --insecure' : ''; + + return "git" . $this->extension . " clone -b $branch $insecure --single-branch --depth 1 https://github.com/joomla/joomla-cms.git tests/cache"; + } + + /** + * Check if local OS is Windows + * + * @return bool + */ + private function isWindows() + { + return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; + } + /** * Get the correct CMS root path * From 15887b9bf0504c836cafbf49b91df2c5b19006fe Mon Sep 17 00:00:00 2001 From: puneet0191 Date: Fri, 30 Oct 2015 17:35:54 +0530 Subject: [PATCH 14/25] Adding a function to delete a category --- tests/_support/Step/Acceptance/category.php | 24 +++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/_support/Step/Acceptance/category.php b/tests/_support/Step/Acceptance/category.php index 2e7c44d..5025925 100644 --- a/tests/_support/Step/Acceptance/category.php +++ b/tests/_support/Step/Acceptance/category.php @@ -45,9 +45,9 @@ class category extends \AcceptanceTester } /** - * Function to Delete a Category in Joomla! + * Function to Trash a Category in Joomla! * - * @param String $categoryName Name of the category which is to be deleted + * @param String $categoryName Name of the category which is to be Trashed * * @return void */ @@ -62,4 +62,24 @@ class category extends \AcceptanceTester $I->clickToolbarButton("Trash"); $I->see('category successfully trashed.', ['id' => 'system-message-container']); } + + /** + * Function to Delete a Category in Joomla! + * + * @param String $categoryName Name of the category which is to be deleted + * + * @return void + */ + public function deleteCategory($categoryName) + { + $I = $this; + $I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks'); + $I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']); + $I->setFilter('select status', 'Trashed'); + $I->searchForItem($categoryName); + $I->amGoingTo('Select the weblink result'); + $I->checkAllResults(); + $I->clickToolbarButton("empty trash"); + $I->see('category successfully deleted.', ['id' => 'system-message-container']); + } } From 7acb192136d7828b2c7fd99f5a16ca7e72c28ddb Mon Sep 17 00:00:00 2001 From: puneet0191 Date: Fri, 30 Oct 2015 17:36:28 +0530 Subject: [PATCH 15/25] Adding Delete Category in Test --- tests/acceptance/administrator/AdministratorCategoriesCest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/acceptance/administrator/AdministratorCategoriesCest.php b/tests/acceptance/administrator/AdministratorCategoriesCest.php index 6bd8b7f..9ef2dda 100644 --- a/tests/acceptance/administrator/AdministratorCategoriesCest.php +++ b/tests/acceptance/administrator/AdministratorCategoriesCest.php @@ -21,6 +21,7 @@ class AdministratorCategoriesCest $I->createCategory($categoryName); $I->amGoingTo('Delete the Category which was created'); $I->trashCategory($categoryName); + $I->deleteCategory($categoryName); } public function administratorCreateCategoryWithoutTitleFails(AcceptanceTester $I) @@ -68,6 +69,7 @@ class AdministratorCategoriesCest $I->amGoingTo('Delete the Category which was created'); $I->trashCategory($categoryName); + $I->deleteCategory($categoryName); } public function administratorUnpublishCategory(\Step\Acceptance\category $I) @@ -107,5 +109,6 @@ class AdministratorCategoriesCest //delete the category $I->amGoingTo('Delete the Category which was created'); $I->trashCategory($categoryName); + $I->deleteCategory($categoryName); } } \ No newline at end of file From 02678e65ba41380bae604a41f43e8260b504cc0c Mon Sep 17 00:00:00 2001 From: Kubik-Rubik Date: Fri, 30 Oct 2015 14:04:36 +0100 Subject: [PATCH 16/25] Fix for Windows to make sure to run the build command to generate AcceptanceTester --- RoboFile.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/RoboFile.php b/RoboFile.php index 3be30d4..291bae0 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -58,7 +58,8 @@ class RoboFile extends \Robo\Tasks $this->runSelenium(); - $this->_exec('php' . $this->extension . ' vendor/bin/codecept build'); + // Make sure to Run the Build Command to Generate AcceptanceTester + $this->_exec('php' . $this->extension . ' vendor/codeception/codeception/codecept build'); $this->taskCodecept() ->arg('--steps') @@ -113,7 +114,7 @@ class RoboFile extends \Robo\Tasks $this->runSelenium(); // Make sure to Run the Build Command to Generate AcceptanceTester - $this->_exec("php vendor/bin/codecept build"); + $this->_exec('php' . $this->extension . ' vendor/codeception/codeception/codecept build'); if (!$pathToTestFile) { From 6bacebcaff5e92f0b83de6b6e7673c4c71c17108 Mon Sep 17 00:00:00 2001 From: kshitij sharma Date: Fri, 30 Oct 2015 14:32:55 +0100 Subject: [PATCH 17/25] Update RoboFile.php --- RoboFile.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/RoboFile.php b/RoboFile.php index 7b12979..1bdea27 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -150,9 +150,6 @@ class RoboFile extends \Robo\Tasks ->arg('--debug') ->run() ->stopOnFail(); - - // Kill selenium server - // $this->_exec('curl http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer'); } /** From 577933c5f8b1ddfde6590c4f4b80bcdebd1975d8 Mon Sep 17 00:00:00 2001 From: kshitij sharma Date: Fri, 30 Oct 2015 14:33:23 +0100 Subject: [PATCH 18/25] Update RoboFile.php --- RoboFile.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/RoboFile.php b/RoboFile.php index 1bdea27..883e858 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -75,10 +75,6 @@ class RoboFile extends \Robo\Tasks ->arg('tests/acceptance/frontend/') ->run() ->stopOnFail(); - - // Kill selenium server - // $this->_exec('curl http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer'); - /* // Uncomment this lines if you need to debug selenium errors $seleniumErrors = file_get_contents('selenium.log'); From d41d5c7935bfb3c03db9eeb2bc218838e75b925b Mon Sep 17 00:00:00 2001 From: puneet0191 Date: Fri, 30 Oct 2015 19:10:16 +0530 Subject: [PATCH 19/25] Updating Composer to load latest Joomla! Browser --- composer.lock | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index f444dc6..f7fbb90 100644 --- a/composer.lock +++ b/composer.lock @@ -90,16 +90,16 @@ }, { "name": "codegyre/robo", - "version": "0.5.4", + "version": "0.6.0", "source": { "type": "git", "url": "https://github.com/Codegyre/Robo.git", - "reference": "10aa223f6d1db182dc81d723bf1545dfc6ff380d" + "reference": "d18185f0494c854d36aa5ee0ad931ee23bbef552" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codegyre/Robo/zipball/10aa223f6d1db182dc81d723bf1545dfc6ff380d", - "reference": "10aa223f6d1db182dc81d723bf1545dfc6ff380d", + "url": "https://api.github.com/repos/Codegyre/Robo/zipball/d18185f0494c854d36aa5ee0ad931ee23bbef552", + "reference": "d18185f0494c854d36aa5ee0ad931ee23bbef552", "shasum": "" }, "require": { @@ -113,6 +113,7 @@ "require-dev": { "codeception/aspect-mock": "0.5.*", "codeception/base": "~2.1", + "codeception/codeception": "2.1", "codeception/verify": "0.2.*", "natxet/cssmin": "~3.0", "patchwork/jsqueeze": "~1.0" @@ -137,7 +138,7 @@ } ], "description": "Modern task runner", - "time": "2015-08-31 17:35:30" + "time": "2015-10-30 11:29:52" }, { "name": "doctrine/instantiator", @@ -524,12 +525,12 @@ "source": { "type": "git", "url": "https://github.com/joomla-projects/joomla-browser.git", - "reference": "0b43acdf38d9322efdfc4ee9730f7bd1cf96b2f9" + "reference": "0999fe673c34fbcf252957b6bc96bbf48956d70e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-projects/joomla-browser/zipball/0b43acdf38d9322efdfc4ee9730f7bd1cf96b2f9", - "reference": "0b43acdf38d9322efdfc4ee9730f7bd1cf96b2f9", + "url": "https://api.github.com/repos/joomla-projects/joomla-browser/zipball/0999fe673c34fbcf252957b6bc96bbf48956d70e", + "reference": "0999fe673c34fbcf252957b6bc96bbf48956d70e", "shasum": "" }, "require": { @@ -567,7 +568,7 @@ "acceptance testing", "joomla" ], - "time": "2015-10-29 14:44:24" + "time": "2015-10-30 13:37:14" }, { "name": "joomla-projects/robo", From f5ee9e9cc70c397cd30b8b7bb4694cec0fa28e97 Mon Sep 17 00:00:00 2001 From: puneet0191 Date: Fri, 30 Oct 2015 19:10:25 +0530 Subject: [PATCH 20/25] Updating the comment --- tests/_support/Step/Acceptance/category.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/_support/Step/Acceptance/category.php b/tests/_support/Step/Acceptance/category.php index 5025925..ffc872c 100644 --- a/tests/_support/Step/Acceptance/category.php +++ b/tests/_support/Step/Acceptance/category.php @@ -47,7 +47,7 @@ class category extends \AcceptanceTester /** * Function to Trash a Category in Joomla! * - * @param String $categoryName Name of the category which is to be Trashed + * @param String $categoryName Name of the category which is to be trashed * * @return void */ From 6f115b12216ea35c7a52d2206ea0426a32999180 Mon Sep 17 00:00:00 2001 From: Francesco Abeni Date: Thu, 29 Oct 2015 16:54:04 +0100 Subject: [PATCH 21/25] Update documentation Add documentation about RoboFile.ini local configuration file --- README.md | 16 +++++++++++++++- RoboFile.dist.ini | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9ab2dab..ddbc950 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,21 @@ This repo is meant to hold the decoupled com_weblinks component and related code # Tests To prepare the system tests (Selenium) to be run in your local machine you are asked to rename the file `tests/acceptance.suite.dist.yml` to `tests/acceptance.suite.yml`. Afterwards, please edit the file according to your system needs. +## Optional: extra configuration for RoboFile + +This is not required, and if in doubt you can just skip this section, but there may be some specific use cases when you need (or want) to override the default behaviour of RoboFile.php. To do this, copy `RoboFile.dist.ini` to `RoboFile.ini` and add options in INI format, one per line, e.g. + + skipClone = true + cmsPath = tests/joomla-cms3 + +The currently available options are as follows: + +* `skipClone`: set to `true` to avoid the cms repo being deleted and re-cloned at each test execution. Useful to save time and bandwidth while you're debugging your test environment. But please be aware that if you don't refresh the repo you'll have to manually check the `installation` folder is present and the `configuration.php` is not. +* `cmsPath`: set to the local path (absolute or relative) where you'd like the test website to be installed. Default is `tests/joomla-cms3`. +* `branch`: set to whatever existing branch from the `joomla-cms` project if you want to clone that specific branch. Default is `staging`. + +## Run the tests + To run the tests please execute the following commands (for the moment only working in Linux and MacOS, for more information see: https://docs.joomla.org/Testing_Joomla_Extensions_with_Codeception): ```bash @@ -13,7 +28,6 @@ $ vendor/bin/robo $ vendor/bin/robo run:tests ``` - ##For Windows: You need to install: diff --git a/RoboFile.dist.ini b/RoboFile.dist.ini index 4a467da..b2da1fa 100644 --- a/RoboFile.dist.ini +++ b/RoboFile.dist.ini @@ -1,8 +1,10 @@ ; If set to true, the repo will not be cloned from GitHub and the local copy will be reused. ; This setting will be obsolete once we have local Git cache enabled skipClone = false + ; If you want to setup your test website in a different folder, you can do that here. ; You can also set an absolute path, i.e. /path/to/my/cms/folder cmsPath = tests/joomla-cms3 + ; If you want to clone a different branch, you can set it here branch = staging From 3f6f869f3d6e3404c49086bc015870d6b48285a1 Mon Sep 17 00:00:00 2001 From: Kubik-Rubik Date: Fri, 30 Oct 2015 16:10:20 +0100 Subject: [PATCH 22/25] Build command with the bin folder --- RoboFile.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RoboFile.php b/RoboFile.php index 291bae0..aba1c90 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -58,8 +58,8 @@ class RoboFile extends \Robo\Tasks $this->runSelenium(); - // Make sure to Run the Build Command to Generate AcceptanceTester - $this->_exec('php' . $this->extension . ' vendor/codeception/codeception/codecept build'); + // Make sure to tun the build command to generate AcceptanceTester + $this->_exec($this->isWindows() ? 'vendor/bin/codecept.bat build' : 'php vendor/bin/codecept build'); $this->taskCodecept() ->arg('--steps') @@ -113,8 +113,8 @@ class RoboFile extends \Robo\Tasks { $this->runSelenium(); - // Make sure to Run the Build Command to Generate AcceptanceTester - $this->_exec('php' . $this->extension . ' vendor/codeception/codeception/codecept build'); + // Make sure to tun the build command to generate AcceptanceTester + $this->_exec($this->isWindows() ? 'vendor/bin/codecept.bat build' : 'php vendor/bin/codecept build'); if (!$pathToTestFile) { From 3c46c84ed1878df0285e11e06cff6601696f7160 Mon Sep 17 00:00:00 2001 From: Kubik-Rubik Date: Fri, 30 Oct 2015 16:11:05 +0100 Subject: [PATCH 23/25] Build command with the bin folder --- RoboFile.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RoboFile.php b/RoboFile.php index aba1c90..8c72d54 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -59,7 +59,7 @@ class RoboFile extends \Robo\Tasks $this->runSelenium(); // Make sure to tun the build command to generate AcceptanceTester - $this->_exec($this->isWindows() ? 'vendor/bin/codecept.bat build' : 'php vendor/bin/codecept build'); + $this->_exec($this->isWindows() ? 'vendor\bin\codecept.bat build' : 'php vendor/bin/codecept build'); $this->taskCodecept() ->arg('--steps') @@ -114,7 +114,7 @@ class RoboFile extends \Robo\Tasks $this->runSelenium(); // Make sure to tun the build command to generate AcceptanceTester - $this->_exec($this->isWindows() ? 'vendor/bin/codecept.bat build' : 'php vendor/bin/codecept build'); + $this->_exec($this->isWindows() ? 'vendor\bin\codecept.bat build' : 'php vendor/bin/codecept build'); if (!$pathToTestFile) { From 68c68640213608081a08eb74c06d30f13cb575bd Mon Sep 17 00:00:00 2001 From: Kubik-Rubik Date: Fri, 30 Oct 2015 16:38:49 +0100 Subject: [PATCH 24/25] Typo... thank Javier! :-P --- RoboFile.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RoboFile.php b/RoboFile.php index 8c72d54..affed5b 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -58,7 +58,7 @@ class RoboFile extends \Robo\Tasks $this->runSelenium(); - // Make sure to tun the build command to generate AcceptanceTester + // 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() @@ -113,7 +113,7 @@ class RoboFile extends \Robo\Tasks { $this->runSelenium(); - // Make sure to tun the build command to generate AcceptanceTester + // 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) From fbb4fe63e6c8a23f26e910ef6a672b7258962fbe Mon Sep 17 00:00:00 2001 From: Kubik-Rubik Date: Fri, 30 Oct 2015 17:02:58 +0100 Subject: [PATCH 25/25] Updated wording --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 71d3708..1c8ff7a 100644 --- a/README.md +++ b/README.md @@ -45,14 +45,13 @@ Then run the command: $ composer install ``` -That will add all the dependencies for the testing of weblinks. You can then run the command: +You can then run the following command to start the tests: ```bash -$ php.exe vendor/codeception/codeception/codecept build $ vendor/bin/robo run:tests ``` -Once all tests are executed, you may also run a specific test: +Once all tests were executed, you may also run a specific test: ```bash $ vendor/bin/robo run:test // Then select the test you want to run!