30
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-06-09 09:42:24 +00:00

Merge remote-tracking branch 'joomla-extensions/master'

This commit is contained in:
Yves Hoppe 2015-09-20 20:44:21 +02:00
commit 5ab3695d7f
10 changed files with 88 additions and 57 deletions

View File

@ -10,7 +10,7 @@ To run the tests please execute the following commands (for the moment only work
```bash
$ composer install
$ vendor/bin/robo
$ vendor/bin/robo test:acceptance
$ vendor/bin/robo run:tests
```
@ -18,15 +18,15 @@ $ vendor/bin/robo test:acceptance
You need to install:
- Git for windows (https://msysgit.github.io/)
- GitHub for windows (https://windows.github.com/)
- Curl for windows if necesssary.
- GitHub for windows (https://windows.github.com/)
- Curl for windows if necesssary.
Note: For commands line is better if you use the 'Git shell' program.
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
Go in the folder of weblinks, for example:
Go in the folder of weblinks, for example:
cd C:\Users\Nicolas\Documents\GitHub\weblinks
Then, run the command:

View File

@ -147,7 +147,7 @@ class RoboFile extends \Robo\Tasks
{
$this->say('Downloading Selenium Server, this may take a while.');
$this->taskExec('wget')
->arg('http://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar')
->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();

View File

@ -85,8 +85,10 @@ COM_WEBLINKS_FLOAT_LABEL="Image Float"
COM_WEBLINKS_HITS_DESC="Number of hits for this web link."
COM_WEBLINKS_LEFT="Left"
COM_WEBLINKS_LIST_LAYOUT_DESC="These settings apply for Web Links List Layout Options unless they are changed for a specific menu item."
COM_WEBLINKS_MANAGER_WEBLINK="Web Links Manager: Web Link"
COM_WEBLINKS_MANAGER_WEBLINKS="Web Links Manager: Web Links"
COM_WEBLINKS_MANAGER_WEBLINK="Web Links"
COM_WEBLINKS_MANAGER_WEBLINKS="Web Links"
COM_WEBLINKS_MANAGER_WEBLINK_EDIT="Web Link: Edit"
COM_WEBLINKS_MANAGER_WEBLINK_NEW="Web Link: New"
COM_WEBLINKS_N_ITEMS_ARCHIVED="%d web links successfully archived."
COM_WEBLINKS_N_ITEMS_ARCHIVED_1="%d web link successfully archived."
COM_WEBLINKS_N_ITEMS_CHECKED_IN_0="No web link successfully checked in."

View File

@ -14,6 +14,9 @@ JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select');
// Ignore Image fieldset for the layouts as we render it manually
$this->ignore_fieldsets = array('images');
JFactory::getDocument()->addScriptDeclaration("
Joomla.submitbutton = function(task)
{

View File

@ -58,7 +58,7 @@ class WeblinksViewWeblink extends JViewLegacy
// Since we don't track these assets at the item level, use the category id.
$canDo = JHelperContent::getActions('com_weblinks', 'category', $this->item->catid);
JToolbarHelper::title(JText::_('COM_WEBLINKS_MANAGER_WEBLINK'), 'link weblinks');
JToolbarHelper::title($isNew ? JText::_('COM_WEBLINKS_MANAGER_WEBLINK_NEW') : JText::_('COM_WEBLINKS_MANAGER_WEBLINK_EDIT'), 'link weblinks');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit')||(count($user->getAuthorisedCategories('com_weblinks', 'core.create')))))

View File

@ -62,7 +62,7 @@ JFactory::getDocument()->addScriptDeclaration('
</div>
<div class="btn-group pull-left">
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.getElementById('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>

View File

@ -19,13 +19,13 @@ class InstallWeblinksCest
$I->setErrorReportingToDevelopment();
}
// 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->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('Weblinks: Categories','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('Weblinks: Categories','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('Weblinks: Categories','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('Weblinks: Categories','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('Weblinks: Categories','5',['css' => 'h1']);
$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('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('Weblinks: Categories','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('Weblinks: Categories','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('Weblinks: Categories','5',['css' => 'h1']);
$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('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('Weblinks: Categories','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('Weblinks: Categories','5',['css' => 'h1']);
$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('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->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->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','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,25 +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('Menus: 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('Menus: New 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', 60);
$I->waitForElement('.iframe','30');
$I->comment('I switch to Menu Type iframe');
$I->switchToIFrame("Menu Item Type");
$I->waitForElementVisible(['link' => "Weblinks"],60);
$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->waitForElement(['xpath' => "//input[@value='List All Web Link Categories']"],60);
$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']);