Merge pull request #1 from javigomez/langupdate2

Updates the tests with the new strings
This commit is contained in:
Brian Teeman 2015-07-29 17:36:03 +01:00
commit 6964d365f0
13 changed files with 216 additions and 68 deletions

View File

@ -1,9 +1,12 @@
language: php
php:
- 5.4
- 5.5
- 5.6
- 7.0
matrix:
allow_failures:
- php: 5.6
- php: 7.0
before_script:
- sudo apt-get update -qq
# Install Apache
@ -28,4 +31,4 @@ before_script:
script:
- mv tests/acceptance.suite.dist.yml tests/acceptance.suite.yml
- php vendor/bin/robo test:acceptance
- vendor/bin/robo run:tests

View File

@ -31,13 +31,14 @@ class RoboFile extends \Robo\Tasks
}
/**
* Executes Selenium System Tests in your machine
* Executes all the Selenium System Tests in a suite on your machine
*
* @param null $seleniumPath Optional path to selenium-standalone-server-x.jar
* @param string $seleniumPath Optional path to selenium-standalone-server-x.jar
* @param string $suite Optional, the name of the tests suite
*
* @return mixed
*/
public function testAcceptance($seleniumPath = null)
public function runTests($seleniumPath = null, $suite = 'acceptance')
{
$this->setExecExtension();
@ -108,7 +109,7 @@ class RoboFile extends \Robo\Tasks
$this->_exec('php' . $this->extension . ' vendor/bin/codecept build');
$this->taskCodecept()
->suite('acceptance')
->suite($suite)
->arg('--steps')
->arg('--debug')
->run()
@ -128,4 +129,118 @@ class RoboFile extends \Robo\Tasks
}
*/
}
}
/**
* Executes a specific Selenium System Tests in your machine
*
* @param string $seleniumPath Optional path to selenium-standalone-server-x.jar
* @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.
*
* @return mixed
*/
public function runTest($seleniumPath = null, $pathToTestFile = null, $suite = 'acceptance')
{
if (!$seleniumPath)
{
if (!file_exists('selenium-server-standalone.jar'))
{
$this->say('Downloading Selenium Server, this may take a while.');
$this->taskExec('wget')
->arg('http://selenium-release.storage.googleapis.com/2.46/selenium-server-standalone-2.46.0.jar')
->arg('-O selenium-server-standalone.jar')
->printed(false)
->run();
}
$seleniumPath = 'selenium-server-standalone.jar';
}
// Make sure we have Composer
if (!file_exists('./composer.phar'))
{
$this->_exec('curl -sS https://getcomposer.org/installer | php');
}
$this->taskComposerUpdate()->run();
// Running Selenium server
$this->_exec("java -jar $seleniumPath > selenium-errors.log 2>selenium.log &");
$this->taskWaitForSeleniumStandaloneServer()
->run()
->stopOnFail();
// Make sure to Run the Build Command to Generate AcceptanceTester
$this->_exec("php vendor/bin/codecept build");
if (!$pathToTestFile)
{
$tests = array();
$this->say('Available tests in the system:');
$filesInSuite = scandir(getcwd() . '/tests/' . $suite);
$i = 1;
foreach ($filesInSuite as $file)
{
// Make sure the file is a Test file
if (strripos($file, 'cept.php') || strripos($file, 'cest.php'))
{
$tests[$i] = $file;
$this->say('[' . $i . '] ' . $file);
$i++;
}
}
$this->say('');
$testNumber = $this->ask('Type the number of the test in the list that you want to run...');
$pathToTestFile = "tests/$suite/" . $tests[$testNumber];
}
$this->taskCodecept()
->test($pathToTestFile)
->arg('--steps')
->arg('--debug')
->run()
->stopOnFail();
// Kill selenium server
// $this->_exec('curl http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer');
$this->say('Printing Selenium Log files');
$this->say('------ selenium-errors.log (start) ---------');
$seleniumErrors = file_get_contents('selenium-errors.log');
if ($seleniumErrors)
{
$this->say(file_get_contents('selenium-errors.log'));
}
else
{
$this->say('no errors were found');
}
$this->say('------ selenium-errors.log (end) -----------');
/*
// Uncomment if you need to debug issues in selenium
$this->say('');
$this->say('------ selenium.log (start) -----------');
$this->say(file_get_contents('selenium.log'));
$this->say('------ selenium.log (end) -----------');
*/
}
/**
* Creates a testing Joomla site for running the tests (use it before run:test)
*/
public function createTestingSite()
{
// Get Joomla Clean Testing sites
if (is_dir('tests/joomla-cms3'))
{
$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');
$this->say('Joomla CMS site created at tests/joomla-cms3');
}
}

View File

@ -1,5 +1,5 @@
# The release version for the extension package.
version=3.4.1-rc2
version=3.4.1
# The name of the package.
package=weblinks

View File

@ -5,11 +5,11 @@
<description>Joomla! CMS Weblinks Package</description>
<element>pkg_weblinks</element>
<type>package</type>
<version>3.4.0</version>
<!--<client>site</client>-->
<infourl title="Weblinks Extension Package">https://github.com/joomla-extensions/weblinks</infourl>
<version>3.4.1</version>
<client>site</client>
<infourl title="Weblinks Extension Package">https://github.com/joomla-extensions/weblinks/releases/tag/3.4.1</infourl>
<downloads>
<downloadurl type="full" format="zip">https://github.com/joomla-extensions/weblinks/releases/download/3.4.0/pkg_weblinks_3.4.0.zip</downloadurl>
<downloadurl type="full" format="zip">https://github.com/joomla-extensions/weblinks/releases/download/3.4.1/pkg_weblinks_3.4.1.zip</downloadurl>
</downloads>
<targetplatform name="joomla" version="3.4" />
</update>

View File

@ -7,7 +7,7 @@
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.4.1-rc2</version>
<version>3.4.1</version>
<description>COM_WEBLINKS_XML_DESCRIPTION</description>
<scriptfile>script.php</scriptfile>

View File

@ -7,7 +7,7 @@
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.4.1-rc2</version>
<version>3.4.1</version>
<description>MOD_WEBLINKS_XML_DESCRIPTION</description>
<files>
<folder>language</folder>

View File

@ -10,7 +10,7 @@
<author>Joomla! Project</author>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.4.1-rc2</version>
<version>3.4.1</version>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<description>PKG_WEBLINKS_XML_DESCRIPTION</description>
<files>

View File

@ -7,7 +7,7 @@
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.4.1-rc2</version>
<version>3.4.1</version>
<description>PLG_FINDER_WEBLINKS_XML_DESCRIPTION</description>
<files>
<filename plugin="weblinks">weblinks.php</filename>

View File

@ -7,7 +7,7 @@
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.4.1-rc2</version>
<version>3.4.1</version>
<description>PLG_SEARCH_WEBLINKS_XML_DESCRIPTION</description>
<files>
<filename plugin="weblinks">weblinks.php</filename>

View File

@ -11,18 +11,21 @@ use \AcceptanceTester;
class InstallWeblinksCest
{
// tests
public function installWeblinks(AcceptanceTester $I)
{
$I->am('Administrator');
$I->installJoomla();
$I->doAdministratorLogin();
$I->setErrorReportingToDevelopment();
public function installJoomla(AcceptanceTester $I)
{
$I->am('Administrator');
$I->installJoomla();
$I->doAdministratorLogin();
$I->setErrorReportingToDevelopment();
}
$I->comment('get Weblinks repository folder from acceptance.suite.yml (see _support/AcceptanceHelper.php)');
$path = $I->getConfiguration('repo_folder');
$I->installExtensionFromDirectory($path . 'src/com_weblinks/');
$I->doAdministratorLogout();
}
// tests
public function installWeblinks(AcceptanceTester $I)
{
$I->doAdministratorLogin();
$I->comment('get Weblinks repository folder from acceptance.suite.yml (see _support/AcceptanceHelper.php)');
$path = $I->getConfiguration('repo_folder');
$I->installExtensionFromFolder($path . 'src/com_weblinks/');
$I->doAdministratorLogout();
}
}

View File

@ -20,13 +20,13 @@ class AdministratorCategoriesCest
$I->amGoingTo('Navigate to Categories page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
$I->waitForText('Category Manager: Weblinks','5',['css' => 'h1']);
$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('Category Manager: Add A New Weblinks Category','5',['css' => 'h1']);
$I->waitForText('Category Manager: Add A New Weblinks 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');
@ -42,12 +42,12 @@ class AdministratorCategoriesCest
$I->amGoingTo('Navigate to Categories page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
$I->waitForText('Category Manager: Weblinks','5',['css' => 'h1']);
$I->waitForText('Weblinks: Categories','30',['css' => 'h1']);
$I->expectTo('see categories page');
$I->amGoingTo('try to save a category with empty title and it should fail');
$I->click(['xpath'=> "//button[@onclick=\"Joomla.submitbutton('category.add')\"]"]);
$I->waitForText('Category Manager: Add A New Weblinks Category','5',['css' => 'h1']);
$I->waitForText('Category Manager: Add A New Weblinks Category','30',['css' => 'h1']);
$I->click(['xpath'=> "//button[@onclick=\"Joomla.submitbutton('category.apply')\"]"]);
$I->expectTo('see an error when trying to save a category without title');
$I->see('Invalid field: Title',['id' => 'system-message-container']);
@ -62,13 +62,13 @@ class AdministratorCategoriesCest
$I->amGoingTo('Navigate to Categories page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
$I->waitForText('Category Manager: Weblinks','5',['css' => 'h1']);
$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('Category Manager: Add A New Weblinks Category','5',['css' => 'h1']);
$I->waitForText('Category Manager: Add A New Weblinks Category','30',['css' => 'h1']);
$I->fillField(['id' => 'jform_title'],'automated testing pub' . rand(1,100));
$I->click(['xpath'=> "//button[@onclick=\"Joomla.submitbutton('category.save')\"]"]);
@ -78,13 +78,13 @@ class AdministratorCategoriesCest
$I->amGoingTo('Search for automated testing');
$I->fillField(['xpath'=> "//input[@id=\"filter_search\"]"], "automated testing pub" . "\n");
$I->waitForText('Category Manager: Weblinks','5',['css' => 'h1']);
$I->waitForText('Weblinks: Categories','30',['css' => 'h1']);
$I->amGoingTo('Select the first weblink');
$I->click(['xpath'=> "//input[@id=\"cb0\"]"]);
$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->waitForText('Category Manager: Weblinks','5',['css' => 'h1']);
$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']);
}
@ -98,13 +98,13 @@ class AdministratorCategoriesCest
$I->amGoingTo('Navigate to Categories page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
$I->waitForText('Category Manager: Weblinks','5',['css' => 'h1']);
$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('Category Manager: Add A New Weblinks Category','5',['css' => 'h1']);
$I->waitForText('Category Manager: Add A New Weblinks Category','30',['css' => 'h1']);
$I->fillField(['id' => 'jform_title'],'automated testing unpub' . rand(1,100));
$I->click(['xpath'=> "//button[@onclick=\"Joomla.submitbutton('category.save')\"]"]);
@ -114,24 +114,24 @@ class AdministratorCategoriesCest
$I->amGoingTo('Search for automated testing');
$I->fillField(['xpath'=> "//input[@id=\"filter_search\"]"], "automated testing unpub" . "\n");
$I->waitForText('Category Manager: Weblinks','5',['css' => 'h1']);
$I->waitForText('Weblinks: Categories','30',['css' => 'h1']);
$I->amGoingTo('Select the first weblink');
$I->click(['xpath'=> "//input[@id=\"cb0\"]"]);
$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->waitForText('Category Manager: Weblinks','5',['css' => 'h1']);
$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']);
// Unpublish it again
$I->waitForText('Category Manager: Weblinks','5',['css' => 'h1']);
$I->waitForText('Weblinks: Categories','30',['css' => 'h1']);
$I->amGoingTo('Select the first weblink');
$I->click(['xpath'=> "//input[@id=\"cb0\"]"]);
$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->waitForText('Category Manager: Weblinks','5',['css' => 'h1']);
$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']);
}

View File

@ -28,17 +28,17 @@ class AdministratorWeblinksCest
$I->amGoingTo('Navigate to Weblinks page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_weblinks');
$I->waitForText('Web Links Manager: Web Links','5',['css' => 'h1']);
$I->waitForText('Web Links','30',['css' => 'h1']);
$I->expectTo('see weblinks page');
$I->checkForPhpNoticesOrWarnings();
$I->amGoingTo('try to save a weblink with a filled title and URL');
$I->click(['xpath'=> "//button[@onclick=\"Joomla.submitbutton('weblink.add')\"]"]);
$I->waitForText('Web Links Manager: Web Link','5',['css' => 'h1']);
$I->waitForText('Web Link: New','30',['css' => 'h1']);
$I->fillField(['id' => 'jform_title'], $this->title);
$I->fillField(['id' => 'jform_url'],'http://example.com/automated_testing' . $this->title);
$I->click(['xpath'=> "//button[@onclick=\"Joomla.submitbutton('weblink.save')\"]"]);
$I->waitForText('Web Links Manager: Web Link','5',['css' => 'h1']);
$I->waitForText('Web Links','30',['css' => 'h1']);
$I->expectTo('see a success message and the weblink added after saving the weblink');
$I->see('Web link successfully saved',['id' => 'system-message-container']);
$I->see($this->title,['id' => 'weblinkList']);
@ -49,7 +49,7 @@ class AdministratorWeblinksCest
*
* @param AcceptanceTester $I
*/
public function administratorCreateWeblinkTrash(AcceptanceTester $I)
public function administratorTrashWeblink(AcceptanceTester $I)
{
$I->am('Administrator');
$I->wantToTest('Weblink removal in /administrator/');
@ -58,26 +58,52 @@ class AdministratorWeblinksCest
$I->amGoingTo('Navigate to Weblinks page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_weblinks');
$I->waitForText('Web Links Manager: Web Links','5',['css' => 'h1']);
$I->waitForText('Web Links','30',['css' => 'h1']);
$I->expectTo('see weblinks page');
$I->checkForPhpNoticesOrWarnings();
$I->amGoingTo('Search the just saved weblink');
$I->fillField(['id' => 'filter_search'],$this->title);
$I->pressKey(['id' => 'filter_search'],WebDriverKeys::ENTER);
$I->waitForText('Web Links Manager: Web Links','5',['css' => 'h1']);
$I->expectTo('see weblinks page');
$I->checkForPhpNoticesOrWarnings();
$I->searchForItem($this->title);
$I->waitForText('Web Links','30',['css' => 'h1']);
$I->amGoingTo('Delete the just saved weblink');
$I->click(['id' => 'cb0']);
$I->checkAllResults();
$I->click(['xpath'=> "//button[@onclick=\"if (document.adminForm.boxchecked.value==0){alert('Please first make a selection from the list');}else{ Joomla.submitbutton('weblinks.trash')}\"]"]);
$I->waitForText('Web Links Manager: Web Link','5',['css' => 'h1']);
$I->waitForText('Web Links','30',['css' => 'h1']);
$I->expectTo('see a success message and the weblink removed from the list');
$I->see('Web link successfully trashed',['id' => 'system-message-container']);
$I->cantSee($this->title,['id' => 'weblinkList']);
}
/**
* @depends administratorCreateWeblink
*
* @param AcceptanceTester $I
*/
public function administratorDeleteWeblink(AcceptanceTester $I)
{
$I->am('Administrator');
$I->wantToTest('Weblink removal in /administrator/');
$I->doAdministratorLogin();
$I->amGoingTo('Navigate to Weblinks page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_weblinks');
$I->waitForText('Web Links','30',['css' => 'h1']);
$I->expectTo('see weblinks page');
$I->selectOptionInChosen('- Select Status -', 'Trashed');
$I->amGoingTo('Search the just saved weblink');
$I->searchForItem($this->title);
$I->waitForText('Web Links','30',['css' => 'h1']);
$I->amGoingTo('Delete the just saved weblink');
$I->checkAllResults();
$I->click(['xpath'=> '//div[@id="toolbar-delete"]/button']);
$I->waitForText('Web Links','30',['css' => 'h1']);
$I->expectTo('see a success message and the weblink removed from the list');
$I->see('1 web link successfully deleted.',['id' => 'system-message-container']);
$I->cantSee($this->title,['id' => 'weblinkList']);
}
public function administratorCreateWeblinkWithoutTitleFails(AcceptanceTester $I)
{
$I->am('Administrator');
@ -87,13 +113,13 @@ class AdministratorWeblinksCest
$I->amGoingTo('Navigate to Weblinks page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_weblinks');
$I->waitForText('Web Links Manager: Web Links','5',['css' => 'h1']);
$I->waitForText('Web Links','30',['css' => 'h1']);
$I->expectTo('see weblinks page');
$I->checkForPhpNoticesOrWarnings();
$I->amGoingTo('try to save a weblink with empty title and it should fail');
$I->click(['xpath'=> "//button[@onclick=\"Joomla.submitbutton('weblink.add')\"]"]);
$I->waitForText('Web Links Manager: Web Link','5',['css' => 'h1']);
$I->waitForText('Web Link: New','30',['css' => 'h1']);
$I->click(['xpath'=> "//button[@onclick=\"Joomla.submitbutton('weblink.apply')\"]"]);
$I->expectTo('see an error when trying to save a weblink without title and without URL');
$I->see('Invalid field: Title',['id' => 'system-message-container']);

View File

@ -31,24 +31,25 @@ class MenuCest
$I->doAdministratorLogin();
$I->amGoingTo('Navigate to Menu Manager page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_menus&view=items&menutype=mainmenu');
$I->waitForText('Menu Manager: Menu Items', '5', ['css' => 'h1']);
$I->waitForText('Menus: Items','30', ['css' => 'h1']);
$I->expectTo('see menu menager items');
$I->checkForPhpNoticesOrWarnings();
$I->amGoingTo('try to save a category with a filled title');
$I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('item.add')\"]"]);
$I->waitForText('Menu Manager: New Menu Item', '5', ['css' => 'h1']);
$I->waitForText('Menus: New Item','30', ['css' => 'h1']);
$I->fillField(['id' => 'jform_title'], 'automated testing' . rand(1, 100));
$I->click(['xpath' => "//a[@href=\"#menuTypeModal\"]"]);
$I->waitForElement('.iframe', 15);
// TODO: create a pull request in joomla-cms and add a name to the iframe there
// attach a nanme so that we can switch to the iframe later
$I->executeJS('jQuery(".iframe").attr("name", "blah")');
$I->switchToIFrame("blah");
$I->waitForElement('.iframe','30');
$I->comment('I switch to Menu Type iframe');
$I->switchToIFrame("Menu Item Type");
$I->waitForElementVisible(['link' => "Weblinks"],'30');
$I->click(['link' => "Weblinks"]);
$I->wait(1);
$I->waitForElementVisible(['xpath' => "//a[contains(@title, 'Show all the web link categories within a category')]"], 60);
$I->click(['xpath' => "//a[contains(@title, 'Show all the web link categories within a category')]"]);
$I->wait(1);
$I->switchToIFrame();
$I->waitForText('Menu Manager: New Menu Item', '5', ['css' => 'h1']);
$I->waitForElement(['xpath' => "//input[@value='List All Web Link Categories']"],'30');
$I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('item.apply')\"]"]);
$I->expectTo('see a success message after saving the category');
$I->see('Menu item successfully saved', ['id' => 'system-message-container']);