2015-05-30 15:57:47 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package Joomla.Administrator
|
|
|
|
* @subpackage com_weblinks
|
|
|
|
*
|
|
|
|
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
2017-01-12 20:22:50 +00:00
|
|
|
/**
|
|
|
|
* Acceptance cest object class for admin steps
|
|
|
|
*
|
|
|
|
* @package Administrator
|
|
|
|
*
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2015-05-30 15:57:47 +00:00
|
|
|
class AdministratorWeblinksCest
|
|
|
|
{
|
2017-01-12 20:22:50 +00:00
|
|
|
/**
|
|
|
|
* User constructor.
|
|
|
|
*
|
|
|
|
* @since version
|
|
|
|
*/
|
2015-05-30 22:10:41 +00:00
|
|
|
public function __construct()
|
|
|
|
{
|
2015-09-30 17:29:14 +00:00
|
|
|
$this->faker = Faker\Factory::create();
|
|
|
|
$this->title = 'Weblink' . $this->faker->randomNumber();
|
|
|
|
$this->url = $this->faker->url();
|
2015-05-30 22:10:41 +00:00
|
|
|
}
|
|
|
|
|
2017-01-12 20:22:50 +00:00
|
|
|
/**
|
|
|
|
* Method to verify available tabs
|
|
|
|
*
|
|
|
|
* @param string $I The weblink object
|
|
|
|
*
|
|
|
|
* @since version
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2015-10-31 11:44:29 +00:00
|
|
|
public function administratorVerifyAvailableTabs(\Step\Acceptance\weblink $I)
|
|
|
|
{
|
|
|
|
$I->am('Administrator');
|
|
|
|
$I->wantToTest('Weblinks Edit View Tabs');
|
|
|
|
|
|
|
|
$I->doAdministratorLogin();
|
|
|
|
|
|
|
|
$I->amGoingTo('Navigate to Weblinks page in /administrator/ and verify the Tabs');
|
|
|
|
$I->amOnPage('administrator/index.php?option=com_weblinks&view=weblinks');
|
2015-11-01 09:01:45 +00:00
|
|
|
$I->waitForText('Web Links', '30', ['css' => 'h1']);
|
2015-10-31 11:44:29 +00:00
|
|
|
$I->clickToolbarButton('New');
|
|
|
|
$I->waitForText('Web Link: New', '30', ['css' => 'h1']);
|
|
|
|
$I->verifyAvailableTabs(['New Web Link', 'Images', 'Publishing', 'Options', 'Metadata']);
|
|
|
|
}
|
|
|
|
|
2017-01-12 20:22:50 +00:00
|
|
|
/**
|
|
|
|
* Method to create weblink
|
|
|
|
*
|
|
|
|
* @param string $I The weblink object
|
|
|
|
*
|
|
|
|
* @since version
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2015-09-30 17:29:14 +00:00
|
|
|
public function administratorCreateWeblink(\Step\Acceptance\weblink $I)
|
2015-05-30 15:57:47 +00:00
|
|
|
{
|
2015-05-30 16:29:24 +00:00
|
|
|
$I->am('Administrator');
|
2015-05-30 16:30:25 +00:00
|
|
|
$I->wantToTest('Weblink creation in /administrator/');
|
2015-05-30 16:29:24 +00:00
|
|
|
|
|
|
|
$I->doAdministratorLogin();
|
|
|
|
|
2015-09-30 17:29:14 +00:00
|
|
|
// Get the weblink StepObject
|
2015-05-30 16:30:25 +00:00
|
|
|
$I->amGoingTo('Navigate to Weblinks page in /administrator/');
|
|
|
|
$I->amOnPage('administrator/index.php?option=com_weblinks');
|
2015-09-30 17:29:14 +00:00
|
|
|
$I->waitForText('Web Links', '30', ['css' => 'h1']);
|
2015-05-30 16:30:25 +00:00
|
|
|
$I->expectTo('see weblinks page');
|
2015-05-30 16:29:24 +00:00
|
|
|
$I->checkForPhpNoticesOrWarnings();
|
|
|
|
|
2015-05-30 16:30:25 +00:00
|
|
|
$I->amGoingTo('try to save a weblink with a filled title and URL');
|
2015-10-31 11:44:29 +00:00
|
|
|
$I->clickToolbarButton('New');
|
2015-09-30 17:29:14 +00:00
|
|
|
$I->waitForText('Web Link: New', '30', ['css' => 'h1']);
|
2015-05-30 22:10:41 +00:00
|
|
|
$I->fillField(['id' => 'jform_title'], $this->title);
|
2015-09-30 17:29:14 +00:00
|
|
|
$I->fillField(['id' => 'jform_url'], $this->url);
|
2015-10-31 11:44:29 +00:00
|
|
|
$I->clickToolbarButton('Save & Close');
|
2015-09-30 17:29:14 +00:00
|
|
|
$I->waitForText('Web Links', '30', ['css' => 'h1']);
|
2015-05-30 22:10:41 +00:00
|
|
|
$I->expectTo('see a success message and the weblink added after saving the weblink');
|
2015-09-30 17:29:14 +00:00
|
|
|
$I->see('Web link successfully saved', ['id' => 'system-message-container']);
|
|
|
|
$I->see($this->title, ['id' => 'weblinkList']);
|
2015-05-30 22:10:41 +00:00
|
|
|
}
|
|
|
|
|
2015-05-30 22:19:28 +00:00
|
|
|
/**
|
2017-01-12 20:22:50 +00:00
|
|
|
* Method to trash weblink
|
|
|
|
*
|
|
|
|
* @param string $I The weblink object
|
|
|
|
*
|
|
|
|
* @since version
|
|
|
|
*
|
2015-05-30 22:21:18 +00:00
|
|
|
* @depends administratorCreateWeblink
|
2017-01-12 20:22:50 +00:00
|
|
|
*
|
|
|
|
* @return void
|
2015-05-30 22:19:28 +00:00
|
|
|
*/
|
2015-07-29 16:23:47 +00:00
|
|
|
public function administratorTrashWeblink(AcceptanceTester $I)
|
2015-05-30 22:10:41 +00:00
|
|
|
{
|
|
|
|
$I->am('Administrator');
|
2015-06-09 11:50:04 +00:00
|
|
|
$I->wantToTest('Weblink removal in /administrator/');
|
2015-05-30 22:10:41 +00:00
|
|
|
|
|
|
|
$I->doAdministratorLogin();
|
|
|
|
|
|
|
|
$I->amGoingTo('Navigate to Weblinks page in /administrator/');
|
|
|
|
$I->amOnPage('administrator/index.php?option=com_weblinks');
|
2017-01-12 20:22:50 +00:00
|
|
|
$I->waitForText('Web Links', '30', ['css' => 'h1']);
|
2015-05-30 22:10:41 +00:00
|
|
|
$I->expectTo('see weblinks page');
|
|
|
|
|
|
|
|
$I->amGoingTo('Search the just saved weblink');
|
2015-07-29 16:23:47 +00:00
|
|
|
$I->searchForItem($this->title);
|
2017-01-12 20:22:50 +00:00
|
|
|
$I->waitForText('Web Links', '30', ['css' => 'h1']);
|
2015-05-30 22:10:41 +00:00
|
|
|
|
|
|
|
$I->amGoingTo('Delete the just saved weblink');
|
2015-07-29 16:23:47 +00:00
|
|
|
$I->checkAllResults();
|
2015-10-31 11:44:29 +00:00
|
|
|
$I->clickToolbarButton('Trash');
|
2017-01-12 20:22:50 +00:00
|
|
|
$I->waitForText('Web Links', '30', ['css' => 'h1']);
|
2015-05-30 22:10:41 +00:00
|
|
|
$I->expectTo('see a success message and the weblink removed from the list');
|
2017-01-12 20:22:50 +00:00
|
|
|
$I->see('Web link successfully trashed', ['id' => 'system-message-container']);
|
|
|
|
$I->cantSee($this->title, ['id' => 'weblinkList']);
|
2015-05-30 15:57:47 +00:00
|
|
|
}
|
2015-05-30 16:45:18 +00:00
|
|
|
|
2015-07-29 16:23:47 +00:00
|
|
|
/**
|
2017-01-12 20:22:50 +00:00
|
|
|
* Method to delete weblink
|
|
|
|
*
|
|
|
|
* @param string $I The weblink object
|
|
|
|
*
|
|
|
|
* @since version
|
|
|
|
*
|
|
|
|
* @depends administratorCreateWeblink
|
|
|
|
*
|
|
|
|
* @return void
|
2015-07-29 16:23:47 +00:00
|
|
|
*/
|
|
|
|
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');
|
2017-01-12 20:22:50 +00:00
|
|
|
$I->waitForText('Web Links', '30', ['css' => 'h1']);
|
2015-07-29 16:23:47 +00:00
|
|
|
$I->expectTo('see weblinks page');
|
2016-06-28 09:45:18 +00:00
|
|
|
$I->click('Search Tools');
|
|
|
|
$I->wait(2);
|
|
|
|
$I->selectOptionInChosenById('filter_published', 'Trashed');
|
2015-07-29 16:23:47 +00:00
|
|
|
$I->amGoingTo('Search the just saved weblink');
|
|
|
|
$I->searchForItem($this->title);
|
2017-01-12 20:22:50 +00:00
|
|
|
$I->waitForText('Web Links', '30', ['css' => 'h1']);
|
2015-07-29 16:23:47 +00:00
|
|
|
|
|
|
|
$I->amGoingTo('Delete the just saved weblink');
|
|
|
|
$I->checkAllResults();
|
2017-01-12 20:22:50 +00:00
|
|
|
$I->click(['xpath' => '//div[@id="toolbar-delete"]/button']);
|
2016-02-01 12:37:11 +00:00
|
|
|
$I->acceptPopup();
|
2017-01-12 20:22:50 +00:00
|
|
|
$I->waitForText('Web Links', '30', ['css' => 'h1']);
|
2015-07-29 16:23:47 +00:00
|
|
|
$I->expectTo('see a success message and the weblink removed from the list');
|
2017-01-12 20:22:50 +00:00
|
|
|
$I->see('1 web link successfully deleted.', ['id' => 'system-message-container']);
|
|
|
|
$I->cantSee($this->title, ['id' => 'weblinkList']);
|
2015-07-29 16:23:47 +00:00
|
|
|
}
|
|
|
|
|
2017-01-12 20:22:50 +00:00
|
|
|
/**
|
|
|
|
* Method to delete weblink
|
|
|
|
*
|
|
|
|
* @param string $I The weblink object
|
|
|
|
*
|
|
|
|
* @since version
|
|
|
|
*
|
|
|
|
* @depends administratorCreateWeblink
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2015-05-30 16:45:18 +00:00
|
|
|
public function administratorCreateWeblinkWithoutTitleFails(AcceptanceTester $I)
|
|
|
|
{
|
|
|
|
$I->am('Administrator');
|
2015-06-09 11:50:04 +00:00
|
|
|
$I->wantToTest('Weblink creation without title fails in /administrator/');
|
2015-05-30 16:45:18 +00:00
|
|
|
|
|
|
|
$I->doAdministratorLogin();
|
|
|
|
$I->amGoingTo('Navigate to Weblinks page in /administrator/');
|
|
|
|
$I->amOnPage('administrator/index.php?option=com_weblinks');
|
2017-01-12 20:22:50 +00:00
|
|
|
$I->waitForText('Web Links', '30', ['css' => 'h1']);
|
2015-05-30 16:45:18 +00:00
|
|
|
$I->expectTo('see weblinks page');
|
|
|
|
$I->checkForPhpNoticesOrWarnings();
|
|
|
|
|
|
|
|
$I->amGoingTo('try to save a weblink with empty title and it should fail');
|
2017-01-12 20:22:50 +00:00
|
|
|
$I->click(['xpath' => "//div[@id='toolbar-new']//button"]);
|
|
|
|
$I->waitForText('Web Link: New', '30', ['css' => 'h1']);
|
|
|
|
$I->click(['xpath' => "//div[@id='toolbar-apply']//button"]);
|
2015-05-30 16:45:18 +00:00
|
|
|
$I->expectTo('see an error when trying to save a weblink without title and without URL');
|
2017-01-12 20:22:50 +00:00
|
|
|
$I->see('Invalid field: Title', ['id' => 'system-message-container']);
|
|
|
|
$I->see('Invalid field: URL', ['id' => 'system-message-container']);
|
2015-05-30 16:45:18 +00:00
|
|
|
}
|
2017-01-12 20:22:50 +00:00
|
|
|
}
|