2015-09-30 17:29:14 +00:00
|
|
|
<?php
|
|
|
|
namespace Step\Acceptance;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class Weblink
|
|
|
|
*
|
|
|
|
* Step Object to interact with a weblink
|
|
|
|
*
|
|
|
|
* @todo: this class should grow until being able to execute generic operations over a Weblink: change status, add to category...
|
|
|
|
*
|
|
|
|
* @package Step\Acceptance
|
2017-04-21 17:25:47 +00:00
|
|
|
* @link http://codeception.com/docs/06-ReusingTestCode#StepObjects
|
2015-09-30 17:29:14 +00:00
|
|
|
*/
|
2019-08-13 19:35:30 +00:00
|
|
|
class Weblink extends \AcceptanceTester
|
2015-09-30 17:29:14 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Creates a weblink
|
|
|
|
*
|
2019-08-13 02:18:48 +00:00
|
|
|
* @param string $title The title for the weblink
|
|
|
|
* @param string $url The url for the weblink
|
|
|
|
* @param string $countClicks If not null, we set the "Count Clicks" weblink property to the given value.
|
2015-09-30 17:29:14 +00:00
|
|
|
*
|
2019-08-13 02:18:48 +00:00
|
|
|
* @throws \Exception
|
2015-09-30 17:29:14 +00:00
|
|
|
*/
|
2015-10-30 16:54:02 +00:00
|
|
|
public function createWeblink($title, $url, $countClicks = null)
|
2015-09-30 17:29:14 +00:00
|
|
|
{
|
|
|
|
$I = $this;
|
|
|
|
|
|
|
|
$I->comment('I navigate to Weblinks page in /administrator/');
|
|
|
|
$I->amOnPage('administrator/index.php?option=com_weblinks');
|
|
|
|
$I->waitForText('Web Links', '30', ['css' => 'h1']);
|
|
|
|
$I->comment('I see weblinks page');
|
|
|
|
|
|
|
|
$I->comment('I try to save a weblink with a filled title and URL');
|
|
|
|
$I->click('New');
|
|
|
|
$I->waitForText('Web Link: New', '30', ['css' => 'h1']);
|
|
|
|
$I->fillField(['id' => 'jform_title'], $title);
|
|
|
|
$I->fillField(['id' => 'jform_url'], $url);
|
2015-10-30 16:54:02 +00:00
|
|
|
|
|
|
|
if ($countClicks !== null) {
|
|
|
|
$I->click(['link' => 'Options']);
|
|
|
|
$I->selectOptionInChosen("Count Clicks", $countClicks);
|
|
|
|
}
|
|
|
|
|
|
|
|
$I->clickToolbarButton('Save & Close');
|
2015-09-30 17:29:14 +00:00
|
|
|
$I->waitForText('Web link successfully saved', '30', ['id' => 'system-message-container']);
|
|
|
|
}
|
2016-06-22 12:55:45 +00:00
|
|
|
|
|
|
|
public function administratorDeleteWeblink($title)
|
|
|
|
{
|
|
|
|
$I = $this;
|
|
|
|
|
|
|
|
$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->amGoingTo('Search for the weblink');
|
|
|
|
$I->searchForItem($title);
|
|
|
|
$I->waitForText('Web Links','30',['css' => 'h1']);
|
|
|
|
|
|
|
|
$I->amGoingTo('Trash the weblink');
|
|
|
|
$I->checkAllResults();
|
|
|
|
$I->clickToolbarButton('Trash');
|
|
|
|
$I->waitForText('Web Links','30',['css' => 'h1']);
|
2016-06-22 13:02:33 +00:00
|
|
|
$I->waitForText('1 web link successfully trashed', 30, ['id' => 'system-message-container']);
|
2016-06-22 12:55:45 +00:00
|
|
|
|
|
|
|
$I->amGoingTo('Delete the weblink');
|
|
|
|
$I->selectOptionInChosen('- Select Status -', 'Trashed');
|
|
|
|
$I->amGoingTo('Search the just saved weblink');
|
|
|
|
$I->searchForItem($title);
|
|
|
|
$I->waitForText('Web Links','30',['css' => 'h1']);
|
|
|
|
$I->checkAllResults();
|
|
|
|
$I->click(['xpath'=> '//div[@id="toolbar-delete"]/button']);
|
|
|
|
$I->acceptPopup();
|
|
|
|
$I->waitForText('Web Links','30',['css' => 'h1']);
|
|
|
|
$I->waitForText('1 web link successfully deleted.', 30, ['id' => 'system-message-container']);
|
|
|
|
}
|
2019-08-13 02:18:48 +00:00
|
|
|
}
|