32
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-11-16 09:37:08 +00:00
weblinks/tests/acceptance/administrator/AdministratorSmartSearchCest.php

180 lines
7.4 KiB
PHP
Raw Normal View History

<?php
/**
* @package Joomla.Administrator
* @subpackage com_finder
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
class AdministratorSmartSearchCest
{
public function __construct()
{
$this->faker = Faker\Factory::create();
2016-06-22 12:55:45 +00:00
$this->title = $this->faker->bothify('SmartSearch ?##?');
$this->url = $this->faker->url;
$this->articletext = 'This is a test';
}
2016-06-22 12:55:45 +00:00
/**
* Before the tests proper, switch the WYSIWYG editor off. This is to make it easier to create test content.
*/
public function administratorDisableEditor(\Step\Acceptance\weblink $I, $scenario)
{
$scenario->skip('Temporarilly skipped, see: https://github.com/joomla-extensions/weblinks/issues/239');
$I->am('Administrator');
$I->wantToTest('Disable the editor before the tests proper');
$I->doAdministratorLogin();
2016-06-22 12:55:45 +00:00
$I->amGoingTo('Navigate to the Global Configuration page in /administrator/ and disable the WYSIWYG Editor');
$I->amOnPage('administrator/index.php?option=com_config');
$I->waitForText('Global Configuration', 30, ['class' => 'page-title']);
$I->selectOptionInChosen('Default Editor', 'Editor - None');
$I->clickToolbarButton('Save & Close');
$I->waitForText('Control Panel', 30, ['class'=> 'page-title']);
$I->expectTo('see a success message after saving the configuration');
2019-08-13 19:35:30 +00:00
$I->see('Configuration saved', ['id' => 'system-message-container']);
}
public function administratorEnableContentPlugin(\Step\Acceptance\weblink $I)
{
$I->am('Administrator');
2016-06-22 12:55:45 +00:00
$I->wantToTest('Enabling the Smart Search content plugin. Note that this is not a requirement for Smart Search to index Weblinks');
$I->doAdministratorLogin();
$I->amGoingTo('Navigate to the Smart Search page in /administrator/');
$I->amOnPage('administrator/index.php?option=com_finder');
$I->expectTo('see a message saying that the content plugin should be enabled');
2016-06-22 12:55:45 +00:00
$I->waitForElement(['link' => 'Smart Search Content Plugin']);
$I->click(['link' => 'Smart Search Content Plugin']);
$I->waitForText('Plugins: Content - Smart Search', 30, ['class'=> 'page-title']);
$I->selectOptionInChosen('Status', 'Enabled');
$I->clickToolbarButton('save & close');
2019-08-13 19:35:30 +00:00
$I->waitForText('Plugin saved.', 30, ['id' => 'system-message-container']);
$I->see('Plugin saved.', ['id' => 'system-message-container']);
}
2016-06-22 12:55:45 +00:00
/**
* Before the tests proper, the Weblinks Smart Search plugin must be enabled.
*/
public function administratorEnableSmartsearchWeblinksPlugin(\Step\Acceptance\weblink $I, $scenario)
2016-06-22 12:55:45 +00:00
{
$scenario->skip('Temporarilly skipped, see: https://github.com/joomla-extensions/weblinks/issues/239');
2016-06-22 12:55:45 +00:00
$I->am('Administrator');
$I->wantToTest('Enabling the Smart Search Weblinks plugin');
$I->doAdministratorLogin();
$I->amOnPage('administrator/index.php?option=com_plugins');
$I->searchForItem('Smart Search - Web Links');
$I->click(['link' => 'Smart Search - Web Links']);
$I->waitForText('Plugins: Smart Search - Web Links', 30, ['class'=> 'page-title']);
$I->selectOptionInChosen('Status', 'Enabled');
$I->clickToolbarButton('save & close');
2019-08-13 19:35:30 +00:00
$I->waitForText('Plugin saved.', 30, ['id' => 'system-message-container']);
$I->see('Plugin saved.', ['id' => 'system-message-container']);
2016-06-22 12:55:45 +00:00
}
/**
* Purge the index.
*/
public function administratorPurgeIndex(\Step\Acceptance\weblink $I, $scenario)
{
$scenario->skip('Temporarilly skipped, see: https://github.com/joomla-extensions/weblinks/issues/239');
$I->am('Administrator');
$I->wantToTest('Purging the index');
$I->doAdministratorLogin();
$I->amGoingTo('Navigate to the Smart Search page in /administrator/ and purge the index');
$I->amOnPage('administrator/index.php?option=com_finder');
$I->waitForText('Smart Search', 30, ['class'=> 'page-title']);
2016-06-22 12:55:45 +00:00
$I->click('Clear Index');
$I->acceptPopup();
2019-08-13 19:35:30 +00:00
$I->waitForText('All items have been deleted', 30, ['class' => 'alert-message']);
$I->see('All items have been deleted', ['class' => 'alert-message']);
2016-06-22 12:55:45 +00:00
}
public function administratorCreateWeblink(\Step\Acceptance\weblink $I, $scenario)
2016-06-22 12:55:45 +00:00
{
$scenario->skip('Temporarilly skipped, see: https://github.com/joomla-extensions/weblinks/issues/239');
2016-06-22 12:55:45 +00:00
$I->doAdministratorLogin();
$I->createWeblink($this->title, $this->url);
}
2016-06-22 12:55:45 +00:00
/**
* Index the current content.
*/
public function administratorRunTheIndexer(\Step\Acceptance\weblink $I, $scenario)
{
$scenario->skip('Temporarilly skipped, see: https://github.com/joomla-extensions/weblinks/issues/239');
$I->am('Administrator');
$I->wantToTest('Smart Search Indexer');
$I->doAdministratorLogin();
$I->amGoingTo('Navigate to Smart Search page in /administrator/ and index the content');
$I->amOnPage('administrator/index.php?option=com_finder');
$I->waitForText('Smart Search: Indexed Content', 30, ['class'=> 'page-title']);
2016-06-22 12:55:45 +00:00
$I->click(['xpath' => "//div[@id='toolbar']//button[contains(text()[normalize-space()], 'Index')]"]);
$I->comment('I wait while smart search indexes the links');
$I->wait(2);
$I->waitForText($this->title, 30, '#j-main-container');
}
2016-06-22 12:55:45 +00:00
/**
* After the tests, the Smart Search content plugin must be disabled, ready for the next test.
*/
public function administratorDisableContentPlugin(\Step\Acceptance\weblink $I, $scenario)
{
$scenario->skip('Temporarilly skipped, see: https://github.com/joomla-extensions/weblinks/issues/239');
$I->am('Administrator');
2016-06-22 12:55:45 +00:00
$I->wantToTest('Disabling the Smart Search content plugin, ready for the next test run');
$I->doAdministratorLogin();
2016-06-22 12:55:45 +00:00
$I->amGoingTo('Navigate to Plugins page in /administrator/ and disable the Smart Search Content plugin');
$I->amOnPage('administrator/index.php?option=com_plugins&view=plugins');
$I->searchForItem('Content - Smart Search');
$I->waitForText('Plugins', 30, ['class'=> 'page-title']);
$I->waitForElement(['link' => 'Content - Smart Search']);
$I->checkOption(['id' => 'cb0']);
$I->clickToolbarButton('Unpublish'); // Note: The button is called "Disable", but we need to call it "Unpublish" here.
2019-08-13 19:35:30 +00:00
$I->waitForText('Plugin disabled', 30, ['class' => 'alert-message']);
}
2016-06-22 12:55:45 +00:00
/**
* After the tests, the Smart Search content plugin must be disabled, ready for the next test.
*/
public function administratorDisableSmartsearchWeblinksPlugin(\Step\Acceptance\weblink $I, $scenario)
{
$scenario->skip('Temporarilly skipped, see: https://github.com/joomla-extensions/weblinks/issues/239');
$I->am('Administrator');
$I->wantToTest('Disabling the Smart Search content plugin, ready for the next test run');
$I->doAdministratorLogin();
$I->amGoingTo('Navigate to Plugins page in /administrator/ and disable the Smart Search Content plugin');
$I->amOnPage('administrator/index.php?option=com_plugins&view=plugins');
2016-06-22 12:55:45 +00:00
$I->searchForItem('Smart Search - Web Links');
$I->waitForText('Plugins', 30, ['class'=> 'page-title']);
2016-06-22 12:55:45 +00:00
$I->waitForElement(['link' => 'Smart Search - Web Links']);
$I->checkOption(['id' => 'cb0']);
$I->clickToolbarButton('Unpublish'); // Note: The button is called "Disable", but we need to call it "Unpublish" here.
2019-08-13 19:35:30 +00:00
$I->waitForText('Plugin disabled', 30, ['class' => 'alert-message']);
}
public function cleanUp(\Step\Acceptance\weblink $I, $scenario)
2016-06-22 12:55:45 +00:00
{
$scenario->skip('Temporarilly skipped, see: https://github.com/joomla-extensions/weblinks/issues/239');
2016-06-22 12:55:45 +00:00
$I->doAdministratorLogin();
$I->administratorDeleteWeblink($this->title);
}
}