30
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-06-03 06:50:49 +00:00

Merge pull request #77 from javigomez/updateTests2

Update the tests to match changes in joomla/joomla-cms#7490
This commit is contained in:
Robert Deutz 2015-07-22 17:46:41 +02:00
commit 15a42f5f35
4 changed files with 35 additions and 28 deletions

View File

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

View File

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

View File

@ -20,7 +20,7 @@ class AdministratorCategoriesCest
$I->amGoingTo('Navigate to Categories page in /administrator/'); $I->amGoingTo('Navigate to Categories page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks'); $I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
$I->waitForText('Category Manager: Weblinks','5',['css' => 'h1']); $I->waitForText('Weblinks: Categories','5',['css' => 'h1']);
$I->expectTo('see categories page'); $I->expectTo('see categories page');
$I->checkForPhpNoticesOrWarnings(); $I->checkForPhpNoticesOrWarnings();
@ -42,7 +42,7 @@ class AdministratorCategoriesCest
$I->amGoingTo('Navigate to Categories page in /administrator/'); $I->amGoingTo('Navigate to Categories page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks'); $I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
$I->waitForText('Category Manager: Weblinks','5',['css' => 'h1']); $I->waitForText('Weblinks: Categories','5',['css' => 'h1']);
$I->expectTo('see categories page'); $I->expectTo('see categories page');
$I->amGoingTo('try to save a category with empty title and it should fail'); $I->amGoingTo('try to save a category with empty title and it should fail');
@ -62,7 +62,7 @@ class AdministratorCategoriesCest
$I->amGoingTo('Navigate to Categories page in /administrator/'); $I->amGoingTo('Navigate to Categories page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks'); $I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
$I->waitForText('Category Manager: Weblinks','5',['css' => 'h1']); $I->waitForText('Weblinks: Categories','5',['css' => 'h1']);
$I->expectTo('see categories page'); $I->expectTo('see categories page');
$I->checkForPhpNoticesOrWarnings(); $I->checkForPhpNoticesOrWarnings();
@ -78,13 +78,13 @@ class AdministratorCategoriesCest
$I->amGoingTo('Search for automated testing'); $I->amGoingTo('Search for automated testing');
$I->fillField(['xpath'=> "//input[@id=\"filter_search\"]"], "automated testing pub" . "\n"); $I->fillField(['xpath'=> "//input[@id=\"filter_search\"]"], "automated testing pub" . "\n");
$I->waitForText('Category Manager: Weblinks','5',['css' => 'h1']); $I->waitForText('Weblinks: Categories','5',['css' => 'h1']);
$I->amGoingTo('Select the first weblink'); $I->amGoingTo('Select the first weblink');
$I->click(['xpath'=> "//input[@id=\"cb0\"]"]); $I->click(['xpath'=> "//input[@id=\"cb0\"]"]);
$I->amGoingTo('try to publish a weblink category'); $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->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','5',['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']); $I->see('1 category successfully published.',['id' => 'system-message-container']);
} }
@ -98,7 +98,7 @@ class AdministratorCategoriesCest
$I->amGoingTo('Navigate to Categories page in /administrator/'); $I->amGoingTo('Navigate to Categories page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks'); $I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
$I->waitForText('Category Manager: Weblinks','5',['css' => 'h1']); $I->waitForText('Weblinks: Categories','5',['css' => 'h1']);
$I->expectTo('see categories page'); $I->expectTo('see categories page');
$I->checkForPhpNoticesOrWarnings(); $I->checkForPhpNoticesOrWarnings();
@ -114,24 +114,24 @@ class AdministratorCategoriesCest
$I->amGoingTo('Search for automated testing'); $I->amGoingTo('Search for automated testing');
$I->fillField(['xpath'=> "//input[@id=\"filter_search\"]"], "automated testing unpub" . "\n"); $I->fillField(['xpath'=> "//input[@id=\"filter_search\"]"], "automated testing unpub" . "\n");
$I->waitForText('Category Manager: Weblinks','5',['css' => 'h1']); $I->waitForText('Weblinks: Categories','5',['css' => 'h1']);
$I->amGoingTo('Select the first weblink'); $I->amGoingTo('Select the first weblink');
$I->click(['xpath'=> "//input[@id=\"cb0\"]"]); $I->click(['xpath'=> "//input[@id=\"cb0\"]"]);
$I->amGoingTo('Try to publish a weblink category'); $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->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','5',['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']); $I->see('1 category successfully published.',['id' => 'system-message-container']);
// Unpublish it again // Unpublish it again
$I->waitForText('Category Manager: Weblinks','5',['css' => 'h1']); $I->waitForText('Weblinks: Categories','5',['css' => 'h1']);
$I->amGoingTo('Select the first weblink'); $I->amGoingTo('Select the first weblink');
$I->click(['xpath'=> "//input[@id=\"cb0\"]"]); $I->click(['xpath'=> "//input[@id=\"cb0\"]"]);
$I->amGoingTo('Try to unpublish a weblink category'); $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->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','5',['css' => 'h1']);
$I->expectTo('See a success message after unpublishing the category'); $I->expectTo('See a success message after unpublishing the category');
$I->see('1 category successfully unpublished',['id' => 'system-message-container']); $I->see('1 category successfully unpublished',['id' => 'system-message-container']);
} }

View File

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