2015-09-30 17:29:14 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
class FrontendWeblinksCest
|
|
|
|
{
|
|
|
|
private $title;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->faker = Faker\Factory::create();
|
|
|
|
$this->title = 'Weblink' . $this->faker->randomNumber();
|
|
|
|
$this->url = $this->faker->url();
|
|
|
|
$this->menuItem = 'Menu Item' . $this->faker->randomNumber();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a weblink in the backend and confirm it exists and is visible in the Frontend
|
|
|
|
*
|
|
|
|
* @param \Step\Acceptance\Weblink $I
|
|
|
|
*/
|
2015-10-30 16:54:02 +00:00
|
|
|
|
2016-08-24 17:17:27 +00:00
|
|
|
public function createWeblinkAndConfirmFrontend(\Step\Acceptance\weblink $I, $scenario)
|
2015-09-30 17:29:14 +00:00
|
|
|
{
|
2016-08-24 17:17:27 +00:00
|
|
|
$scenario->skip('Temporarily skipped for drone, see: https://github.com/joomla-extensions/weblinks/issues/261');
|
|
|
|
|
2015-09-30 17:29:14 +00:00
|
|
|
$I->am('Administrator');
|
2016-06-25 20:10:22 +00:00
|
|
|
$I->wantToTest('Listing a category of Web Links in frontend');
|
2015-09-30 17:29:14 +00:00
|
|
|
|
|
|
|
$I->doAdministratorLogin();
|
|
|
|
|
2015-11-01 09:56:43 +00:00
|
|
|
$I->createWeblink($this->title, $this->url, "No");
|
2015-09-30 17:29:14 +00:00
|
|
|
|
|
|
|
// Menu link
|
2016-06-25 20:10:22 +00:00
|
|
|
$I->createMenuItem($this->menuItem, 'Web Links', 'List All Web Link Categories', 'Main Menu');
|
2015-09-30 17:29:14 +00:00
|
|
|
|
|
|
|
// Go to the frontend
|
|
|
|
$I->comment('I want to check if the menu entry exists in the frontend');
|
|
|
|
$I->amOnPage('index.php?option=com_weblinks');
|
2016-06-25 20:10:22 +00:00
|
|
|
$I->expectTo('see web link categories');
|
2015-09-30 17:29:14 +00:00
|
|
|
$I->waitForText('Uncategorised','30', ['css' => 'h3']);
|
|
|
|
$I->checkForPhpNoticesOrWarnings();
|
2016-06-25 20:10:22 +00:00
|
|
|
$I->comment('I open the uncategorised Web link Category');
|
2015-09-30 17:29:14 +00:00
|
|
|
$I->click(['link' => 'Uncategorised']);
|
|
|
|
|
|
|
|
$I->waitForText('Uncategorised','30', ['css' => 'h2']);
|
2016-06-25 20:10:22 +00:00
|
|
|
$I->expectTo('see the web link we created');
|
2015-09-30 17:29:14 +00:00
|
|
|
$I->seeElement(['link' => $this->title]);
|
|
|
|
$I->seeElement(['xpath' => "//a[@href='$this->url']"]);
|
|
|
|
}
|
2015-10-30 16:54:02 +00:00
|
|
|
|
2016-08-24 17:17:27 +00:00
|
|
|
public function hitsAreNotIncrementedIfCountClicksIsOff(\Step\Acceptance\weblink $I, $scenario)
|
2015-10-30 16:54:02 +00:00
|
|
|
{
|
2016-08-24 17:17:27 +00:00
|
|
|
$scenario->skip('Temporarily skipped for drone, see: https://github.com/joomla-extensions/weblinks/issues/261');
|
|
|
|
|
2015-10-30 16:54:02 +00:00
|
|
|
$title = 'Weblink' . $this->faker->randomNumber();
|
2015-10-31 11:10:07 +00:00
|
|
|
$url = $I->getConfiguration('counter_test_url');
|
2015-10-30 16:54:02 +00:00
|
|
|
|
|
|
|
$I->am('Administrator');
|
|
|
|
$I->wantToTest('Hits are not incremented if Count Clicks is off');
|
|
|
|
|
|
|
|
$I->doAdministratorLogin();
|
|
|
|
|
|
|
|
$I->createWeblink($title, $url, "No");
|
|
|
|
|
|
|
|
// Go to the frontend
|
|
|
|
$I->amOnPage('index.php?option=com_weblinks');
|
2016-06-25 20:10:22 +00:00
|
|
|
$I->expectTo('see web link categories');
|
2015-10-30 16:54:02 +00:00
|
|
|
$I->waitForText('Uncategorised','30', ['css' => 'h3']);
|
|
|
|
$I->checkForPhpNoticesOrWarnings();
|
2016-06-25 20:10:22 +00:00
|
|
|
$I->comment('I open the uncategorised Web Link Category');
|
2016-02-09 10:10:55 +00:00
|
|
|
$I->waitForElement(['link' => 'Uncategorised'], 60);
|
2015-10-30 16:54:02 +00:00
|
|
|
$I->click(['link' => 'Uncategorised']);
|
|
|
|
|
|
|
|
// Check that hits is 0
|
|
|
|
$I->waitForText('Uncategorised','30', ['css' => 'h2']);
|
2016-06-25 20:10:22 +00:00
|
|
|
$I->expectTo('see the web link we created');
|
2015-10-30 16:54:02 +00:00
|
|
|
$I->seeElement(['link' => $title]);
|
|
|
|
$I->expectTo('see that hits is 0');
|
|
|
|
$I->see('Hits: 0', ['class' => 'list-hits']);
|
|
|
|
|
|
|
|
// Click on the link, go back, and check that hits is still 0
|
|
|
|
$I->click(['link' => $title]);
|
2016-02-09 10:10:55 +00:00
|
|
|
|
|
|
|
$I->amOnPage('index.php?option=com_weblinks');
|
|
|
|
$I->waitForElement(['link' => 'Uncategorised'], 60);
|
|
|
|
$I->click(['link' => 'Uncategorised']);
|
2016-06-25 20:10:22 +00:00
|
|
|
$I->comment('I search the web link: ' . $title);
|
2016-02-09 10:10:55 +00:00
|
|
|
$I->waitForElement(['id' => 'filter-search'], 60);
|
|
|
|
$I->fillField(['id' => 'filter-search'], $title);
|
|
|
|
$I->pressKey(['id' => 'filter-search'], \Facebook\WebDriver\WebDriverKeys::ENTER);
|
|
|
|
$I->wait(1);
|
|
|
|
$I->waitForText('Uncategorised','30', ['css' => 'h2']);
|
|
|
|
|
2015-10-30 16:54:02 +00:00
|
|
|
$I->expectTo('see that hits is still 0');
|
|
|
|
$I->see('Hits: 0', ['class' => 'list-hits']);
|
|
|
|
}
|
|
|
|
|
2016-08-24 17:17:27 +00:00
|
|
|
public function hitsAreIncrementedIfCountClicksIsOn(\Step\Acceptance\weblink $I, $scenario)
|
2015-10-30 16:54:02 +00:00
|
|
|
{
|
2016-08-24 17:17:27 +00:00
|
|
|
$scenario->skip('Temporarily skipped for drone, see: https://github.com/joomla-extensions/weblinks/issues/261');
|
|
|
|
|
2015-10-30 16:54:02 +00:00
|
|
|
$title = 'Weblink' . $this->faker->randomNumber();
|
2015-10-31 11:10:07 +00:00
|
|
|
$url = $I->getConfiguration('counter_test_url');
|
2015-10-30 16:54:02 +00:00
|
|
|
|
|
|
|
$I->am('Administrator');
|
|
|
|
$I->wantToTest('Hits are incremented if Count Clicks is on');
|
|
|
|
|
|
|
|
$I->doAdministratorLogin();
|
|
|
|
|
|
|
|
$I->createWeblink($title, $url, "Yes");
|
|
|
|
|
|
|
|
// Go to the frontend
|
|
|
|
$I->amOnPage('index.php?option=com_weblinks');
|
2016-06-25 20:10:22 +00:00
|
|
|
$I->expectTo('see web link categories');
|
2015-10-30 16:54:02 +00:00
|
|
|
$I->waitForText('Uncategorised','30', ['css' => 'h3']);
|
|
|
|
$I->checkForPhpNoticesOrWarnings();
|
2016-06-25 20:10:22 +00:00
|
|
|
$I->comment('I open the uncategorised Web Link Category');
|
2015-10-30 16:54:02 +00:00
|
|
|
$I->click(['link' => 'Uncategorised']);
|
|
|
|
|
|
|
|
// Check that hits is 0
|
|
|
|
$I->waitForText('Uncategorised','30', ['css' => 'h2']);
|
2016-06-25 20:10:22 +00:00
|
|
|
$I->expectTo('see the web link we created');
|
2015-10-30 16:54:02 +00:00
|
|
|
$I->seeElement(['link' => $title]);
|
|
|
|
$I->expectTo('see that hits is 0');
|
|
|
|
$I->see('Hits: 0', ['class' => 'list-hits']);
|
|
|
|
|
|
|
|
// Click on the link, go back, and check that hits is 1
|
|
|
|
$I->click(['link' => $title]);
|
2016-02-08 19:12:39 +00:00
|
|
|
$I->amOnPage('index.php?option=com_weblinks');
|
2016-06-25 20:10:22 +00:00
|
|
|
$I->comment('I open the uncategorised Web Link Category');
|
2016-02-09 10:10:55 +00:00
|
|
|
$I->waitForElement(['link' => 'Uncategorised'], 60);
|
2016-02-08 19:12:39 +00:00
|
|
|
$I->click(['link' => 'Uncategorised']);
|
2016-06-25 20:10:22 +00:00
|
|
|
$I->comment('I search the web link: ' . $title);
|
2016-02-09 10:10:55 +00:00
|
|
|
$I->waitForElement(['id' => 'filter-search'], 60);
|
|
|
|
$I->fillField(['id' => 'filter-search'], $title);
|
|
|
|
$I->pressKey(['id' => 'filter-search'], \Facebook\WebDriver\WebDriverKeys::ENTER);
|
|
|
|
$I->wait(1);
|
|
|
|
$I->waitForText('Uncategorised','30', ['css' => 'h2']);
|
2015-10-30 16:54:02 +00:00
|
|
|
$I->expectTo('see that hits is 1');
|
|
|
|
$I->see('Hits: 1', ['class' => 'list-hits']);
|
|
|
|
}
|
2015-09-30 17:29:14 +00:00
|
|
|
}
|