Update tests with new strings

This commit is contained in:
javier gomez 2015-07-29 18:23:47 +02:00
parent 0910b638a6
commit 0a984f778b
4 changed files with 69 additions and 43 deletions

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->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->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->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,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']);