diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c48cf4ecc7385..2434a62ddbf49 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,5 +3,3 @@ Pull Request for Issue # . #### Summary of Changes #### Testing Instructions - -#### Documentation Changes Required diff --git a/.gitignore b/.gitignore index c9a1e90f1167f..fa5ff5c4f07a6 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,16 @@ # Test Related Files # /phpunit.xml +/tests/system/webdriver/tests/logs/ +/tests/system/servers/configdef.php +codecept.phar +tests/codeception/_output/* +tests/codeception/vendor/* +tests/codeception/testingsite* +tests/codeception/tests/acceptance.suite.yml +tests/codeception/tests/acceptance/*Tester.php +tests/codeception/tests/functional/*Tester.php +tests/codeception/tests/unit/*Tester.php # phpDocumentor Logs # phpdoc-* diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 668a44f8cfd0c..f4720ebc0ccc6 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -39,6 +39,7 @@ public function update($installer) $this->updateAssets(); $this->clearStatsCache(); $this->convertTablesToUtf8mb4(true); + $this->convertTablesToNewNullDate(); $this->cleanJoomlaCache(); // VERY IMPORTANT! THIS METHOD SHOULD BE CALLED LAST, SINCE IT COULD @@ -1683,6 +1684,106 @@ public function flushSessions() return true; } + + /** + * Converts the site's database tables to the new null Date of mySQL 5.7. Can also be used as reverter + * + * @param string $newNull the old null date string + * + * @param string $oldNull the new null date string + * + * @return void + * + * @since 12.2 + */ + public function convertTablesToNewNullDate($newNull=null,$oldNull=null) + { + $db = JFactory::getDbo(); + + // Possible to Convert Back + if ($db->serverUsesNewNullTime()) + { + if (is_null($newNull)) + { + $newNull='1000-01-01 00:00:00'; + } + + if (is_null($oldNull)) + { + $oldNull='0000-00-00 00:00:00'; + } + } + else + { + if (is_null($oldNull)) + { + $oldNull='1000-01-01 00:00:00'; + } + + if (is_null($newNull)) + { + $newNull='0000-00-00 00:00:00'; + } + } + + // This is only required for MySQL databases + $serverType = $db->getServerType(); + + if ($serverType != 'mysql') + { + return; + } + + // Check conversion status in database + $db->setQuery('SELECT ' . $db->quoteName('converted') + . ' FROM ' . $db->quoteName('#__nullDate_conversion') + ); + + $convertedDB = '0000-00-00 00:00:00'; + + try + { + $convertedDB = $db->loadResult(); + } + catch (Exception $e) + { + // Render the error message from the Exception object + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); + return; + } + + if($convertedDB == $newNull) + { + // Already updated - nothing to do + return; + } + + $fileName = JPATH_ROOT . "/administrator/components/com_admin/sql/others/mysql/nullDate-conversion.sql"; + + if (is_file($fileName)) + { + $fileContents = @file_get_contents($fileName); + $queries = $db->splitSql($fileContents); + + if (!empty($queries)) + { + foreach ($queries as $query) + { + $query = str_replace(array('$O$','$T$'), array("'" . $oldNull . "'","'" . $newNull . "'"), $query); + + try + { + $db->setQuery($query)->execute(); + } + catch (Exception $e) + { + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); + } + } + } + } + } + /** * Converts the site's database tables to support UTF-8 Multibyte. * diff --git a/administrator/components/com_admin/sql/others/mysql/nullDate-conversion.sql b/administrator/components/com_admin/sql/others/mysql/nullDate-conversion.sql new file mode 100644 index 0000000000000..4cef7e4e0d87e --- /dev/null +++ b/administrator/components/com_admin/sql/others/mysql/nullDate-conversion.sql @@ -0,0 +1,176 @@ +ALTER TABLE `#__nullDate_conversion` CHANGE `converted` `converted` datetime NOT NULL DEFAULT $T$; +UPDATE `#__nullDate_conversion` SET `converted` = $T$; + +ALTER TABLE `#__banners` CHANGE `checked_out_time` `checked_out_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__banners` SET `checked_out_time` = $T$ WHERE `checked_out_time` = $O$; + +ALTER TABLE `#__banners` CHANGE `publish_up` `publish_up` datetime NOT NULL DEFAULT $T$; +UPDATE `#__banners` SET `publish_up` = $T$ WHERE `publish_up` = $O$; + +ALTER TABLE `#__banners` CHANGE `publish_down` `publish_down` datetime NOT NULL DEFAULT $T$; +UPDATE `#__banners` SET `publish_down` = $T$ WHERE `publish_down` = $O$; + +ALTER TABLE `#__banners` CHANGE `reset` `reset` datetime NOT NULL DEFAULT $T$; +UPDATE `#__banners` SET `reset` = $T$ WHERE `reset` = $O$; + +ALTER TABLE `#__banners` CHANGE `created` `created` datetime NOT NULL DEFAULT $T$; +UPDATE `#__banners` SET `created` = $T$ WHERE `created` = $O$; + +ALTER TABLE `#__banners` CHANGE `modified` `modified` datetime NOT NULL DEFAULT $T$; +UPDATE `#__banners` SET `modified` = $T$ WHERE `modified` = $O$; + +ALTER TABLE `#__banner_clients` CHANGE `checked_out_time` `checked_out_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__banner_clients` SET `checked_out_time` = $T$ WHERE `checked_out_time` = $O$; + +ALTER TABLE `#__categories` CHANGE `checked_out_time` `checked_out_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__categories` SET `checked_out_time` = $T$ WHERE `checked_out_time` = $O$; + +ALTER TABLE `#__categories` CHANGE `created_time` `created_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__categories` SET `created_time` = $T$ WHERE `created_time` = $O$; + +ALTER TABLE `#__categories` CHANGE `modified_time` `modified_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__categories` SET `modified_time` = $T$ WHERE `modified_time` = $O$; + +ALTER TABLE `#__contact_details` CHANGE `checked_out_time` `checked_out_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__contact_details` SET `checked_out_time` = $T$ WHERE `checked_out_time` = $O$; + +ALTER TABLE `#__contact_details` CHANGE `created` `created` datetime NOT NULL DEFAULT $T$; +UPDATE `#__contact_details` SET `created` = $T$ WHERE `created` = $O$; + +ALTER TABLE `#__contact_details` CHANGE `modified` `modified` datetime NOT NULL DEFAULT $T$; +UPDATE `#__contact_details` SET `modified` = $T$ WHERE `modified` = $O$; + +ALTER TABLE `#__contact_details` CHANGE `publish_up` `publish_up` datetime NOT NULL DEFAULT $T$; +UPDATE `#__contact_details` SET `publish_up` = $T$ WHERE `publish_up` = $O$; + +ALTER TABLE `#__contact_details` CHANGE `publish_down` `publish_down` datetime NOT NULL DEFAULT $T$; +UPDATE `#__contact_details` SET `publish_down` = $T$ WHERE `publish_down` = $O$; + +ALTER TABLE `#__content` CHANGE `created` `created` datetime NOT NULL DEFAULT $T$; +UPDATE `#__content` SET `created` = $T$ WHERE `created` = $O$; + +ALTER TABLE `#__content` CHANGE `modified` `modified` datetime NOT NULL DEFAULT $T$; +UPDATE `#__content` SET `modified` = $T$ WHERE `modified` = $O$; + +ALTER TABLE `#__content` CHANGE `checked_out_time` `checked_out_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__content` SET `checked_out_time` = $T$ WHERE `checked_out_time` = $O$; + +ALTER TABLE `#__content` CHANGE `publish_up` `publish_up` datetime NOT NULL DEFAULT $T$; +UPDATE `#__content` SET `publish_up` = $T$ WHERE `publish_up` = $O$; + +ALTER TABLE `#__content` CHANGE `publish_down` `publish_down` datetime NOT NULL DEFAULT $T$; +UPDATE `#__content` SET `publish_down` = $T$ WHERE `publish_down` = $O$; + +ALTER TABLE `#__menu` CHANGE `checked_out_time` `checked_out_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__menu` SET `checked_out_time` = $T$ WHERE `checked_out_time` = $O$; + +ALTER TABLE `#__extensions` CHANGE `checked_out_time` `checked_out_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__extensions` SET `checked_out_time` = $T$ WHERE `checked_out_time` = $O$; + +ALTER TABLE `#__finder_filters` CHANGE `created` `created` datetime NOT NULL DEFAULT $T$; +UPDATE `#__finder_filters` SET `created` = $T$ WHERE `created` = $O$; + +ALTER TABLE `#__finder_filters` CHANGE `modified` `modified` datetime NOT NULL DEFAULT $T$; +UPDATE `#__finder_filters` SET `modified` = $T$ WHERE `modified` = $O$; + +ALTER TABLE `#__finder_filters` CHANGE `checked_out_time` `checked_out_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__finder_filters` SET `checked_out_time` = $T$ WHERE `checked_out_time` = $O$; + +ALTER TABLE `#__finder_links` CHANGE `indexdate` `indexdate` datetime NOT NULL DEFAULT $T$; +UPDATE `#__finder_links` SET `indexdate` = $T$ WHERE `indexdate` = $O$; + +ALTER TABLE `#__finder_links` CHANGE `publish_start_date` `publish_start_date` datetime NOT NULL DEFAULT $T$; +UPDATE `#__finder_links` SET `publish_start_date` = $T$ WHERE `publish_start_date` = $O$; + +ALTER TABLE `#__finder_links` CHANGE `publish_end_date` `publish_end_date` datetime NOT NULL DEFAULT $T$; +UPDATE `#__finder_links` SET `publish_end_date` = $T$ WHERE `publish_end_date` = $O$; + +ALTER TABLE `#__finder_links` CHANGE `start_date` `start_date` datetime NOT NULL DEFAULT $T$; +UPDATE `#__finder_links` SET `start_date` = $T$ WHERE `start_date` = $O$; + +ALTER TABLE `#__finder_links` CHANGE `end_date` `end_date` datetime NOT NULL DEFAULT $T$; +UPDATE `#__finder_links` SET `end_date` = $T$ WHERE `end_date` = $O$; + +ALTER TABLE `#__messages` CHANGE `date_time` `date_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__messages` SET `date_time` = $T$ WHERE `date_time` = $O$; + +ALTER TABLE `#__modules` CHANGE `checked_out_time` `checked_out_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__modules` SET `checked_out_time` = $T$ WHERE `checked_out_time` = $O$; + +ALTER TABLE `#__modules` CHANGE `publish_up` `publish_up` datetime NOT NULL DEFAULT $T$; +UPDATE `#__modules` SET `publish_up` = $T$ WHERE `publish_up` = $O$; + +ALTER TABLE `#__modules` CHANGE `publish_down` `publish_down` datetime NOT NULL DEFAULT $T$; +UPDATE `#__modules` SET `publish_down` = $T$ WHERE `publish_down` = $O$; + +ALTER TABLE `#__newsfeeds` CHANGE `checked_out_time` `checked_out_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__newsfeeds` SET `checked_out_time` = $T$ WHERE `checked_out_time` = $O$; + +ALTER TABLE `#__newsfeeds` CHANGE `created` `created` datetime NOT NULL DEFAULT $T$; +UPDATE `#__newsfeeds` SET `created` = $T$ WHERE `created` = $O$; + +ALTER TABLE `#__newsfeeds` CHANGE `modified` `modified` datetime NOT NULL DEFAULT $T$; +UPDATE `#__newsfeeds` SET `modified` = $T$ WHERE `modified` = $O$; + +ALTER TABLE `#__newsfeeds` CHANGE `publish_up` `publish_up` datetime NOT NULL DEFAULT $T$; +UPDATE `#__newsfeeds` SET `publish_up` = $T$ WHERE `publish_up` = $O$; + +ALTER TABLE `#__newsfeeds` CHANGE `publish_down` `publish_down` datetime NOT NULL DEFAULT $T$; +UPDATE `#__newsfeeds` SET `publish_down` = $T$ WHERE `publish_down` = $O$; + +ALTER TABLE `#__redirect_links` CHANGE `created_date` `created_date` datetime NOT NULL DEFAULT $T$; +UPDATE `#__redirect_links` SET `created_date` = $T$ WHERE `created_date` = $O$; + +ALTER TABLE `#__redirect_links` CHANGE `modified_date` `modified_date` datetime NOT NULL DEFAULT $T$; +UPDATE `#__redirect_links` SET `modified_date` = $T$ WHERE `modified_date` = $O$; + +ALTER TABLE `#__tags` CHANGE `checked_out_time` `checked_out_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__tags` SET `checked_out_time` = $T$ WHERE `checked_out_time` = $O$; + +ALTER TABLE `#__tags` CHANGE `created_time` `created_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__tags` SET `created_time` = $T$ WHERE `created_time` = $O$; + +ALTER TABLE `#__tags` CHANGE `modified_time` `modified_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__tags` SET `modified_time` = $T$ WHERE `modified_time` = $O$; + +ALTER TABLE `#__tags` CHANGE `publish_up` `publish_up` datetime NOT NULL DEFAULT $T$; +UPDATE `#__tags` SET `publish_up` = $T$ WHERE `publish_up` = $O$; + +ALTER TABLE `#__tags` CHANGE `publish_down` `publish_down` datetime NOT NULL DEFAULT $T$; +UPDATE `#__tags` SET `publish_down` = $T$ WHERE `publish_down` = $O$; + +ALTER TABLE `#__ucm_content` CHANGE `core_created_time` `core_created_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__ucm_content` SET `core_created_time` = $T$ WHERE `core_created_time` = $O$; + +ALTER TABLE `#__ucm_content` CHANGE `core_modified_time` `core_modified_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__ucm_content` SET `core_modified_time` = $T$ WHERE `core_modified_time` = $O$; + +ALTER TABLE `#__ucm_history` CHANGE `save_date` `save_date` datetime NOT NULL DEFAULT $T$; +UPDATE `#__ucm_history` SET `save_date` = $T$ WHERE `save_date` = $O$; + +ALTER TABLE `#__users` CHANGE `registerDate` `registerDate` datetime NOT NULL DEFAULT $T$; +UPDATE `#__users` SET `registerDate` = $T$ WHERE `registerDate` = $O$; + +ALTER TABLE `#__users` CHANGE `lastvisitDate` `lastvisitDate` datetime NOT NULL DEFAULT $T$; +UPDATE `#__users` SET `lastvisitDate` = $T$ WHERE `lastvisitDate` = $O$; + +ALTER TABLE `#__users` CHANGE `lastResetTime` `lastResetTime` datetime NOT NULL DEFAULT $T$; +UPDATE `#__users` SET `lastResetTime` = $T$ WHERE `lastResetTime` = $O$; + +ALTER TABLE `#__user_notes` CHANGE `checked_out_time` `checked_out_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__user_notes` SET `checked_out_time` = $T$ WHERE `checked_out_time` = $O$; + +ALTER TABLE `#__user_notes` CHANGE `created_time` `created_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__user_notes` SET `created_time` = $T$ WHERE `created_time` = $O$; + +ALTER TABLE `#__user_notes` CHANGE `modified_time` `modified_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__user_notes` SET `modified_time` = $T$ WHERE `modified_time` = $O$; + +ALTER TABLE `#__user_notes` CHANGE `review_time` `review_time` datetime NOT NULL DEFAULT $T$; +UPDATE `#__user_notes` SET `review_time` = $T$ WHERE `review_time` = $O$; + +ALTER TABLE `#__user_notes` CHANGE `publish_up` `publish_up` datetime NOT NULL DEFAULT $T$; +UPDATE `#__user_notes` SET `publish_up` = $T$ WHERE `publish_up` = $O$; + +ALTER TABLE `#__user_notes` CHANGE `publish_down` `publish_down` datetime NOT NULL DEFAULT $T$; +UPDATE `#__user_notes` SET `publish_down` = $T$ WHERE `publish_down` = $O$; \ No newline at end of file diff --git a/administrator/components/com_admin/sql/updates/mysql/3.7.0-2016-06-08.sql b/administrator/components/com_admin/sql/updates/mysql/3.7.0-2016-06-08.sql new file mode 100644 index 0000000000000..3c25c7401558c --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/3.7.0-2016-06-08.sql @@ -0,0 +1,13 @@ +-- +-- Table structure for table `#__nullDate_conversion` +-- + +CREATE TABLE IF NOT EXISTS `#__nullDate_conversion` ( + `converted` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +-- +-- Dumping data for table `#__nullDate_conversion` +-- + +INSERT INTO `#__nullDate_conversion` (`converted`) VALUES ('0000-00-00 00:00:00'); \ No newline at end of file diff --git a/administrator/components/com_admin/views/profile/tmpl/edit.php b/administrator/components/com_admin/views/profile/tmpl/edit.php index 0e9d8f8f4b785..7e7c15d950dc3 100644 --- a/administrator/components/com_admin/views/profile/tmpl/edit.php +++ b/administrator/components/com_admin/views/profile/tmpl/edit.php @@ -55,7 +55,7 @@ continue; } ?> - name, JText::_($fieldset->label)); ?> + name, JText::_($fieldset->label, true)); ?> form->getFieldset($fieldset->name) as $field) : ?> hidden) : ?>
diff --git a/administrator/components/com_checkin/models/checkin.php b/administrator/components/com_checkin/models/checkin.php index c9a08970919d8..323bdb90e2e33 100644 --- a/administrator/components/com_checkin/models/checkin.php +++ b/administrator/components/com_checkin/models/checkin.php @@ -238,7 +238,6 @@ public function getItems() // Pagination $limit = (int) $this->getState('list.limit'); - if ($limit !== 0) { $this->items = array_slice($results, $this->getState('list.start'), $limit); diff --git a/administrator/components/com_content/controllers/article.php b/administrator/components/com_content/controllers/article.php index 077c82c63160d..c633d649a11b5 100644 --- a/administrator/components/com_content/controllers/article.php +++ b/administrator/components/com_content/controllers/article.php @@ -86,12 +86,6 @@ protected function allowEdit($data = array(), $key = 'id') $user = JFactory::getUser(); $userId = $user->get('id'); - // If we get a deny at the component level, we cannot override here. - if (!parent::allowEdit($data, $key)) - { - return false; - } - // Check general edit permission first. if ($user->authorise('core.edit', 'com_content.article.' . $recordId)) { @@ -104,7 +98,6 @@ protected function allowEdit($data = array(), $key = 'id') { // Now test the owner is the user. $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; - if (empty($ownerId) && $recordId) { // Need to do a lookup from the model. @@ -118,14 +111,15 @@ protected function allowEdit($data = array(), $key = 'id') $ownerId = $record->created_by; } - // If the owner matches 'me' then permission is granted. + // If the owner matches 'me' then do the test. if ($ownerId == $userId) { return true; } } - return false; + // Since there is no asset tracking, revert to the component permissions. + return parent::allowEdit($data, $key); } /** diff --git a/administrator/components/com_joomlaupdate/controllers/update.php b/administrator/components/com_joomlaupdate/controllers/update.php index c271d4a8b38f8..7e18a68bf49ac 100644 --- a/administrator/components/com_joomlaupdate/controllers/update.php +++ b/administrator/components/com_joomlaupdate/controllers/update.php @@ -25,8 +25,6 @@ class JoomlaupdateControllerUpdate extends JControllerLegacy */ public function download() { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - $options['format'] = '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}'; $options['text_file'] = 'joomla_update.php'; JLog::addLogger($options, JLog::INFO, array('Update', 'databasequery', 'jerror')); @@ -45,7 +43,7 @@ public function download() if ($file) { JFactory::getApplication()->setUserState('com_joomlaupdate.file', $file); - $url = 'index.php?option=com_joomlaupdate&task=update.install&' . JFactory::getSession()->getFormToken() . '=1'; + $url = 'index.php?option=com_joomlaupdate&task=update.install'; JLog::add(JText::sprintf('COM_JOOMLAUPDATE_UPDATE_LOG_FILE', $file), JLog::INFO, 'Update'); } else @@ -67,8 +65,6 @@ public function download() */ public function install() { - JSession::checkToken('get') or jexit(JText::_('JINVALID_TOKEN')); - $options['format'] = '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}'; $options['text_file'] = 'joomla_update.php'; JLog::addLogger($options, JLog::INFO, array('Update', 'databasequery', 'jerror')); @@ -94,8 +90,6 @@ public function install() */ public function finalise() { - JSession::checkToken('get') or jexit(JText::_('JINVALID_TOKEN')); - $options['format'] = '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}'; $options['text_file'] = 'joomla_update.php'; JLog::addLogger($options, JLog::INFO, array('Update', 'databasequery', 'jerror')); @@ -107,7 +101,7 @@ public function finalise() $model->finaliseUpgrade(); - $url = 'index.php?option=com_joomlaupdate&task=update.cleanup&' . JFactory::getSession()->getFormToken() . '=1'; + $url = 'index.php?option=com_joomlaupdate&task=update.cleanup'; $this->setRedirect($url); } @@ -120,8 +114,6 @@ public function finalise() */ public function cleanup() { - JSession::checkToken('get') or jexit(JText::_('JINVALID_TOKEN')); - $options['format'] = '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}'; $options['text_file'] = 'joomla_update.php'; JLog::addLogger($options, JLog::INFO, array('Update', 'databasequery', 'jerror')); @@ -281,7 +273,7 @@ public function confirm() JLog::add(JText::sprintf('COM_JOOMLAUPDATE_UPDATE_LOG_FILE', $tempFile), JLog::INFO, 'Update'); // Redirect to the actual update page - $url = 'index.php?option=com_joomlaupdate&task=update.install&' . JFactory::getSession()->getFormToken() . '=1'; + $url = 'index.php?option=com_joomlaupdate&task=update.install'; $this->setRedirect($url); } diff --git a/administrator/components/com_joomlaupdate/joomlaupdate.xml b/administrator/components/com_joomlaupdate/joomlaupdate.xml index 85c467c9eaf35..71604e6a54547 100644 --- a/administrator/components/com_joomlaupdate/joomlaupdate.xml +++ b/administrator/components/com_joomlaupdate/joomlaupdate.xml @@ -7,7 +7,7 @@ GNU General Public License version 2 or later; see LICENSE.txt admin@joomla.org www.joomla.org - 3.6.2 + 3.6.0 COM_JOOMLAUPDATE_XML_DESCRIPTION js diff --git a/administrator/components/com_joomlaupdate/models/default.php b/administrator/components/com_joomlaupdate/models/default.php index 53b91c7adff8b..4aad82ad0fd7d 100644 --- a/administrator/components/com_joomlaupdate/models/default.php +++ b/administrator/components/com_joomlaupdate/models/default.php @@ -389,7 +389,7 @@ public function createRestorationFile($basename = null) $ftp_host = $app->input->get('ftp_host', ''); $ftp_port = $app->input->get('ftp_port', '21'); $ftp_user = $app->input->get('ftp_user', ''); - $ftp_pass = addcslashes($app->input->get('ftp_pass', '', 'raw'), "'\\"); + $ftp_pass = $app->input->get('ftp_pass', '', 'raw'); $ftp_root = $app->input->get('ftp_root', ''); // Is the tempdir really writable? diff --git a/administrator/components/com_joomlaupdate/views/update/tmpl/default.php b/administrator/components/com_joomlaupdate/views/update/tmpl/default.php index 5b5676e6d10b5..b0f45c0a6d26e 100644 --- a/administrator/components/com_joomlaupdate/views/update/tmpl/default.php +++ b/administrator/components/com_joomlaupdate/views/update/tmpl/default.php @@ -20,7 +20,7 @@ $password = JFactory::getApplication()->getUserState('com_joomlaupdate.password', null); $filesize = JFactory::getApplication()->getUserState('com_joomlaupdate.filesize', null); $ajaxUrl = JUri::base() . 'components/com_joomlaupdate/restore.php'; -$returnUrl = 'index.php?option=com_joomlaupdate&task=update.finalise&' . JFactory::getSession()->getFormToken() . '=1'; +$returnUrl = 'index.php?option=com_joomlaupdate&task=update.finalise'; JFactory::getDocument()->addScriptDeclaration( " diff --git a/administrator/components/com_plugins/views/plugin/tmpl/edit_options.php b/administrator/components/com_plugins/views/plugin/tmpl/edit_options.php index 5606f5475d074..9b51e06571682 100644 --- a/administrator/components/com_plugins/views/plugin/tmpl/edit_options.php +++ b/administrator/components/com_plugins/views/plugin/tmpl/edit_options.php @@ -13,7 +13,7 @@ { if (!isset($fieldset->repeat) || isset($fieldset->repeat) && $fieldset->repeat == false) { - $label = !empty($fieldset->label) ? JText::_($fieldset->label) : JText::_('COM_PLUGINS_' . $fieldset->name . '_FIELDSET_LABEL', true); + $label = !empty($fieldset->label) ? JText::_($fieldset->label, true) : JText::_('COM_PLUGINS_' . $fieldset->name . '_FIELDSET_LABEL', true); $optionsname = 'options-' . $fieldset->name; echo JHtml::_('bootstrap.addTab', 'myTab', $optionsname, $label); diff --git a/administrator/components/com_users/views/users/tmpl/default.php b/administrator/components/com_users/views/users/tmpl/default.php index 31e796c557303..4cd8e18400177 100644 --- a/administrator/components/com_users/views/users/tmpl/default.php +++ b/administrator/components/com_users/views/users/tmpl/default.php @@ -148,7 +148,7 @@ escape($item->email)); ?> - lastvisitDate != $this->db->getNullDate()):?> + lastvisitDate != '0000-00-00 00:00:00'):?> lastvisitDate, 'Y-m-d H:i:s'); ?> diff --git a/administrator/components/com_users/views/users/view.html.php b/administrator/components/com_users/views/users/view.html.php index 662e6e11b1643..24b148a156719 100644 --- a/administrator/components/com_users/views/users/view.html.php +++ b/administrator/components/com_users/views/users/view.html.php @@ -39,38 +39,6 @@ class UsersViewUsers extends JViewLegacy * @since 1.6 */ protected $state; - - /** - * A JForm instance with filter fields. - * - * @var JForm - * @since 3.6 - */ - public $filterForm; - - /** - * An array with active filters. - * - * @var array - * @since 3.6 - */ - public $activeFilters; - - /** - * An ACL object to verify user rights. - * - * @var JObject - * @since 3.6 - */ - protected $canDo; - - /** - * An instance of JDatabaseDriver. - * - * @var JDatabaseDriver - * @since 3.6 - */ - protected $db; /** * Display the view @@ -87,7 +55,6 @@ public function display($tpl = null) $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); $this->canDo = JHelperContent::getActions('com_users'); - $this->db = JFactory::getDbo(); UsersHelper::addSubmenu('users'); diff --git a/administrator/language/en-GB/en-GB.xml b/administrator/language/en-GB/en-GB.xml index afe5716c16178..b83d257911e7c 100644 --- a/administrator/language/en-GB/en-GB.xml +++ b/administrator/language/en-GB/en-GB.xml @@ -1,8 +1,8 @@ English (en-GB) - 3.6.3 - August 2016 + 3.6.1 + July 2016 Joomla! Project admin@joomla.org www.joomla.org diff --git a/administrator/language/en-GB/install.xml b/administrator/language/en-GB/install.xml index 7f26c90a9d76a..64ed05413d877 100644 --- a/administrator/language/en-GB/install.xml +++ b/administrator/language/en-GB/install.xml @@ -2,8 +2,8 @@ English (United Kingdom) en-GB - 3.6.3 - August 2016 + 3.6.1 + July 2016 Joomla! Project admin@joomla.org www.joomla.org diff --git a/administrator/manifests/files/joomla.xml b/administrator/manifests/files/joomla.xml index f09347b6cfe92..a425baf6640ad 100644 --- a/administrator/manifests/files/joomla.xml +++ b/administrator/manifests/files/joomla.xml @@ -6,8 +6,8 @@ www.joomla.org (C) 2005 - 2016 Open Source Matters. All rights reserved GNU General Public License version 2 or later; see LICENSE.txt - 3.6.3-dev - August 2016 + 3.6.1-rc2 + July 2016 FILES_JOOMLA_XML_DESCRIPTION administrator/components/com_admin/script.php diff --git a/administrator/manifests/packages/pkg_en-GB.xml b/administrator/manifests/packages/pkg_en-GB.xml index 55b99dedadb69..a44fdc7bf0979 100644 --- a/administrator/manifests/packages/pkg_en-GB.xml +++ b/administrator/manifests/packages/pkg_en-GB.xml @@ -2,8 +2,8 @@ English (en-GB) Language Pack en-GB - 3.6.3.1 - August 2016 + 3.6.1.1 + July 2016 Joomla! Project admin@joomla.org www.joomla.org diff --git a/administrator/templates/hathor/html/com_users/users/default.php b/administrator/templates/hathor/html/com_users/users/default.php index 56a3c144a4080..16587f5bf4674 100644 --- a/administrator/templates/hathor/html/com_users/users/default.php +++ b/administrator/templates/hathor/html/com_users/users/default.php @@ -190,7 +190,7 @@ escape($item->email); ?> - lastvisitDate != $this->db->getNullDate()) : ?> + lastvisitDate != '0000-00-00 00:00:00') : ?> lastvisitDate, 'Y-m-d H:i:s'); ?> diff --git a/components/com_contact/views/contact/tmpl/default.php b/components/com_contact/views/contact/tmpl/default.php index 38e0aa70e94d1..3265ce230fca4 100644 --- a/components/com_contact/views/contact/tmpl/default.php +++ b/components/com_contact/views/contact/tmpl/default.php @@ -171,7 +171,7 @@ params->get('presentation_style') == 'tabs') : ?> - + params->get('presentation_style') == 'plain'):?> ' . JText::_('COM_CONTACT_PROFILE') . ''; ?> diff --git a/components/com_content/views/featured/tmpl/default_item.php b/components/com_content/views/featured/tmpl/default_item.php index dfd0ca1d87ebe..37785c8e24285 100644 --- a/components/com_content/views/featured/tmpl/default_item.php +++ b/components/com_content/views/featured/tmpl/default_item.php @@ -95,7 +95,7 @@ item->state == 0 || strtotime($this->item->publish_up) > strtotime(JFactory::getDate()) - || ((strtotime($this->item->publish_down) < strtotime(JFactory::getDate())) && $this->item->publish_down != $this->db->getNullDate() )) : ?> + || ((strtotime($this->item->publish_down) < strtotime(JFactory::getDate())) && $this->item->publish_down != '0000-00-00 00:00:00' )) : ?>
diff --git a/components/com_content/views/featured/view.html.php b/components/com_content/views/featured/view.html.php index ceeaf1cd0b900..77037b3b2ede7 100644 --- a/components/com_content/views/featured/view.html.php +++ b/components/com_content/views/featured/view.html.php @@ -31,14 +31,6 @@ class ContentViewFeatured extends JViewLegacy protected $link_items = array(); protected $columns = 1; - - /** - * An instance of JDatabaseDriver. - * - * @var JDatabaseDriver - * @since 3.6 - */ - protected $db; /** * Execute and display a template script. @@ -70,6 +62,7 @@ public function display($tpl = null) // Get the metrics for the structural page layout. $numLeading = (int) $params->def('num_leading_articles', 1); $numIntro = (int) $params->def('num_intro_articles', 4); + $numLinks = (int) $params->def('num_links', 4); // Compute the article slugs and prepare introtext (runs content plugins). foreach ($items as &$item) @@ -152,7 +145,6 @@ public function display($tpl = null) $this->items = &$items; $this->pagination = &$pagination; $this->user = &$user; - $this->db = JFactory::getDbo(); $this->_prepareDocument(); diff --git a/components/com_mailto/views/mailto/tmpl/default.php b/components/com_mailto/views/mailto/tmpl/default.php index 25e35b2a08579..3b4f31aab9b90 100644 --- a/components/com_mailto/views/mailto/tmpl/default.php +++ b/components/com_mailto/views/mailto/tmpl/default.php @@ -66,7 +66,7 @@

- + diff --git a/components/com_users/views/profile/tmpl/default_core.php b/components/com_users/views/profile/tmpl/default_core.php index 299ac0c25c19d..a98637b65e57c 100644 --- a/components/com_users/views/profile/tmpl/default_core.php +++ b/components/com_users/views/profile/tmpl/default_core.php @@ -38,7 +38,7 @@ - data->lastvisitDate != $this->db->getNullDate()) : ?> + data->lastvisitDate != '0000-00-00 00:00:00') : ?>
data->lastvisitDate); ?>
diff --git a/components/com_users/views/profile/view.html.php b/components/com_users/views/profile/view.html.php index 8c7a2c5df499d..4a755fb9bf4b9 100644 --- a/components/com_users/views/profile/view.html.php +++ b/components/com_users/views/profile/view.html.php @@ -24,14 +24,6 @@ class UsersViewProfile extends JViewLegacy protected $state; - /** - * An instance of JDatabaseDriver. - * - * @var JDatabaseDriver - * @since 3.6 - */ - protected $db; - /** * Execute and display a template script. * @@ -51,7 +43,6 @@ public function display($tpl = null) $this->twofactorform = $this->get('Twofactorform'); $this->twofactormethods = UsersHelper::getTwoFactorMethods(); $this->otpConfig = $this->get('OtpConfig'); - $this->db = JFactory::getDbo(); // Check for errors. if (count($errors = $this->get('Errors'))) diff --git a/installation/language/ar-AA/ar-AA.ini b/installation/language/ar-AA/ar-AA.ini index 45f9a190b555f..d0594e745faf9 100644 --- a/installation/language/ar-AA/ar-AA.ini +++ b/installation/language/ar-AA/ar-AA.ini @@ -30,7 +30,6 @@ INSTL_PRECHECK_ACTUAL="حالياً" ; Database view INSTL_DATABASE="تهيئة قاعدة البيانات" -INSTL_DATABASE_ERROR_POSTGRESQL_QUERY="خطأ عند استعلام قاعدة البيانات PostgreSQL." INSTL_DATABASE_HOST_DESC="هذا عادة يكون "localhost"" INSTL_DATABASE_HOST_LABEL="اسم الموقع" INSTL_DATABASE_NAME_DESC="بعض مزودي الاستضافة يسمحون فقط باستخدام اسم قاعدة بيانات محددة لكل موقع. استخدم بادئة الجدول للتمييز بين أكثر من موقع جوملا!." diff --git a/installation/language/ar-AA/ar-AA.xml b/installation/language/ar-AA/ar-AA.xml index a8db58a39cbfa..f96f6bea760ba 100644 --- a/installation/language/ar-AA/ar-AA.xml +++ b/installation/language/ar-AA/ar-AA.xml @@ -3,8 +3,8 @@ version="3.6" client="installation"> Arabic Unitag (العربية الموحدة) - 3.6.1 - August 2016 + 3.6.0 + April 2016 Joomla! Arabic Unitag Translation team Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/en-GB/en-GB.xml b/installation/language/en-GB/en-GB.xml index e7fff1f645b1c..607f606c1f68f 100644 --- a/installation/language/en-GB/en-GB.xml +++ b/installation/language/en-GB/en-GB.xml @@ -3,8 +3,8 @@ version="3.6" client="installation"> English (United Kingdom) - 3.6.3 - August 2016 + 3.6.1 + July 2016 Joomla! Project Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/eu-ES/eu-ES.ini b/installation/language/eu-ES/eu-ES.ini index d4fade374c85d..b3181a60b135c 100644 --- a/installation/language/eu-ES/eu-ES.ini +++ b/installation/language/eu-ES/eu-ES.ini @@ -28,7 +28,6 @@ INSTL_PRECHECK_ACTUAL="Benetakoa" ; Database view INSTL_DATABASE="Datu-basearen konfigurazioa" -INSTL_DATABASE_ERROR_POSTGRESQL_QUERY="PostgreSQL datu-basearen kontsultak huts egin du." INSTL_DATABASE_HOST_DESC="Normalean hau izaten da "localhost"." INSTL_DATABASE_HOST_LABEL="Ostalariaren izena" INSTL_DATABASE_NAME_DESC="Ostalari batzuk datu-base izen jakin bat soilik onartzen dute gune bakoitzeko. Horrelakoetan, erabil ezazu taula-aurrizkia datu-base bera baliatzen duten Joomla! gune desberdinetarako." diff --git a/installation/language/eu-ES/eu-ES.xml b/installation/language/eu-ES/eu-ES.xml index 732f869b1dc80..267b566d800dc 100644 --- a/installation/language/eu-ES/eu-ES.xml +++ b/installation/language/eu-ES/eu-ES.xml @@ -3,8 +3,8 @@ version="3.6" client="installation"> Basque - 3.6.1 - August 2016 + 3.6.0 + May 2016 Miel Loinaz Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/ja-JP/ja-JP.ini b/installation/language/ja-JP/ja-JP.ini index 1c87195897b63..8db26c7ab2a1a 100644 --- a/installation/language/ja-JP/ja-JP.ini +++ b/installation/language/ja-JP/ja-JP.ini @@ -28,7 +28,6 @@ INSTL_PRECHECK_ACTUAL="現在" ; Database view INSTL_DATABASE="データベース設定" -INSTL_DATABASE_ERROR_POSTGRESQL_QUERY="PostgreSQLデータベースのクエリが失敗しました。" INSTL_DATABASE_HOST_DESC="通常は localhost ですが、専用のホストを指定することもあります。
(特に日本国内の一般向けレンタルサーバなど)" INSTL_DATABASE_HOST_LABEL="ホスト名" INSTL_DATABASE_NAME_DESC="データベース名です。" @@ -46,7 +45,6 @@ INSTL_DATABASE_TYPE_LABEL="データベース" INSTL_DATABASE_USER_DESC="データベースのユーザ名です。" INSTL_DATABASE_USER_LABEL="ユーザ名" - ;FTP view INSTL_AUTOFIND_FTP_PATH="FTPパスを自動検出" INSTL_FTP="FTP設定" @@ -331,9 +329,9 @@ INSTL_SAMPLE_BLOG_JP_SET="ブログ 日本語(JP)" INSTL_SAMPLE_BROCHURE_JP_SET="サイト 日本語(JP)" INSTL_SAMPLE_DATA_JP_SET="デフォルト 日本語(JP)" INSTL_SAMPLE_LEARN_JP_SET="Joomlaを学ぶ 日本語(JP)" -;INSTL_SAMPLE_TESTING_JP_SET="テスト 日本語(JP)" +INSTL_SAMPLE_TESTING_JP_SET="テスト 日本語(JP)" INSTL_SAMPLE_BLOG_JP_SET_DESC="いくつかの記事と過去の記事、ブログロール、最も読まれた記事などを表示したブログのサンプルです。" INSTL_SAMPLE_BROCHURE_JP_SET_DESC="いくつかのページ(ホーム・私たちについて・ニュース・お問い合わせで構成されるメニュー)と検索、カスタムHTML、ログインフォームモジュールを表示したサンプルです。" INSTL_SAMPLE_DATA_JP_SET_DESC="1ページ(1リンクのみのメニュー)と最新の記事、ログインフォームモジュールを表示したサンプルです。" INSTL_SAMPLE_LEARN_JP_SET_DESC="どのようにJoomla!が動作するかの解説記事を表示したサンプルです。" -;INSTL_SAMPLE_TESTING_JP_SET_DESC="Joomla!の動作テストに役立つすべてのメニューアイテムを表示したサンプルです。" \ No newline at end of file +INSTL_SAMPLE_TESTING_JP_SET_DESC="Joomla!の動作テストに役立つすべてのメニューアイテムを表示したサンプルです。" \ No newline at end of file diff --git a/installation/language/ja-JP/ja-JP.xml b/installation/language/ja-JP/ja-JP.xml index 7068d91d08684..ee8292188366d 100644 --- a/installation/language/ja-JP/ja-JP.xml +++ b/installation/language/ja-JP/ja-JP.xml @@ -1,8 +1,8 @@ Japanese 日本語 (Japan) - 3.6.2 - August 2016 + 3.6.0 + May 2016 Joomla.jp Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/language/pl-PL/pl-PL.ini b/installation/language/pl-PL/pl-PL.ini index 3549698fa83ad..a2e85b6892162 100644 --- a/installation/language/pl-PL/pl-PL.ini +++ b/installation/language/pl-PL/pl-PL.ini @@ -1,6 +1,8 @@ -; Joomla! Project -; Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. -; License GNU General Public License version 2 or later; see LICENSE.txt +; version ; 2013-10-29 15:05:47 ~0 +; author ; Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. +; copyright ; License GNU General Public License version 2 or later; see LICENSE.txt +; license ; Note : All ini files need to be saved as UTF-8 + ; Note : All ini files need to be saved as UTF-8 ;Stepbar @@ -26,6 +28,7 @@ INSTL_PRECHECK_DIRECTIVE="Wytyczna" INSTL_PRECHECK_RECOMMENDED="Zalecane" INSTL_PRECHECK_ACTUAL="Bieżące" + ; Database view INSTL_DATABASE="Konfiguracja bazy danych" INSTL_DATABASE_HOST_DESC="Zwykle jest to „localhost”" @@ -116,27 +119,20 @@ INSTL_EMAIL_NOT_SENT="Email nie został wysłany." ;Complete view INSTL_COMPLETE_ADMINISTRATION_LOGIN_DETAILS="Szczegóły logowania dla administratora" -; The word 'installation' should not be translated as it is a physical folder. -INSTL_COMPLETE_ERROR_FOLDER_ALREADY_REMOVED="Katalog installation został już usunięty." -; The word 'installation' should not be translated as it is a physical folder. -INSTL_COMPLETE_ERROR_FOLDER_DELETE="Nie można usunąć katalogu installation. Usuń ten katalog ręcznie." -; The word 'installation' should not be translated as it is a physical folder. -INSTL_COMPLETE_FOLDER_REMOVED="Katalog installation usunięto." +INSTL_COMPLETE_ERROR_FOLDER_ALREADY_REMOVED="Katalog instalacyjny został już usunięty" +INSTL_COMPLETE_ERROR_FOLDER_DELETE="Folderu instalacyjnego nie można usunąć. Usuń ten katalog ręcznie." +INSTL_COMPLETE_FOLDER_REMOVED="Katalog instalacyjny usunięto" INSTL_COMPLETE_LANGUAGE_1="Joomla! w twoim języku ojczystym i automatycznie utworzonej wielojęzyczności" -; The word 'installation' should not be translated as it is a physical folder. -INSTL_COMPLETE_LANGUAGE_DESC="Przed usunięciem katalogu installation można zainstalować dodatkowe języki. Jeśli chcesz dodać kolejne języki do aplikacji Joomla!, kliknij poniższy przycisk." +INSTL_COMPLETE_LANGUAGE_DESC="Przed usunięciem folderu instalacyjnego można zainstalować dodatkowe języki. Jeśli chcesz dodać kolejne języki do aplikacji Joomla!, kliknij poniższy przycisk." INSTL_COMPLETE_LANGUAGE_DESC2="Uwaga: będzie potrzebny dostęp do Internetu, aby umożliwić Joomla! pobranie i zainstalowanie nowych języków.
Niektóre konfiguracje serwerów nie pozwolą Joomla! na przeprowadzenie instalacji języków. Jeśli tak jest w twoim przypadku, nie martw się, języki będzie można zainstalować później za pomocą instalatora dostępnego na zapleczu administracyjnym." -; The word 'installation' should not be translated as it is a physical folder. -INSTL_COMPLETE_REMOVE_FOLDER="Usuń katalog installation" -; The word 'installation' should not be translated as it is a physical folder. -INSTL_COMPLETE_REMOVE_INSTALLATION="PAMIĘTAJ, BY CALKOWICIE USUNĄĆ KATALOG INSTALLATION.
Nie będziesz mógł przejść do kolejnego kroku procesu instalacji, dopóki nie usuniesz tego katalogu. Jest to wymóg podyktowany bezpieczeństwem środowiska Joomla!" +INSTL_COMPLETE_REMOVE_FOLDER="Usuń katalog instalacyjny" +INSTL_COMPLETE_REMOVE_INSTALLATION="Pamiętaj, by całkowicie usunąć katalog instalacyjny (nazwany installation).
Nie będziesz mógł przejść do kolejnego kroku procesu instalacji, dopóki nie usuniesz tego katalogu. Jest to wymóg podyktowany bezpieczeństwem środowiska Joomla!" INSTL_COMPLETE_TITLE="Gratulacje! Udało Ci się zainstalować Joomla!" INSTL_COMPLETE_INSTALL_LANGUAGES="Dodatkowy krok: Instaluj języki" ;Languages view INSTL_LANGUAGES="Zainstaluj pakiety językowe" INSTL_LANGUAGES_COLUMN_HEADER_LANGUAGE="Język" -INSTL_LANGUAGES_COLUMN_HEADER_LANGUAGE_TAG="Znacznik języka" INSTL_LANGUAGES_COLUMN_HEADER_VERSION="Wersja" INSTL_LANGUAGES_DESC="Interfejs Joomla! jest dostępny w wielu językach. Zaznacz preferowane języki, klikając w polu wyboru i zainstaluj je, klikając przycisk Dalej.
Uwaga: Ta operacja trwa około 10 sekund potrzebnych na pobranie i zainstalowanie każdego języka. Proszę wybrać nie więcej niż 3 języki do zainstalowania, aby uniknąć opóźnień." INSTL_LANGUAGES_MESSAGE_PLEASE_WAIT="Ta operacja wymaga około 10 sekund na zakończenie
Proszę czekać, aż wybrane języki zostaną pobrane i..." @@ -193,7 +189,6 @@ INSTL_DATABASE_ERROR_CREATE="Podczas próby stworzenia bazy danych %s wystąpił INSTL_DATABASE_ERROR_DELETE="Podczas usuwania bazy danych wystąpiły błędy." INSTL_DATABASE_FIELD_VALUE_REMOVE="Usuń starsze tabele" INSTL_DATABASE_FIELD_VALUE_BACKUP="Archiwizuj starsze tabele" -INSTL_DATABASE_FIX_LOWERCASE="Przedrostek tabel dla PostgreSQL musi byż złożony z małych liter." INSTL_DATABASE_FIX_TOO_LONG="Przedrostek tabel MySQL nie może mieć więcej niż 15 znaków." INSTL_DATABASE_INVALID_DB_DETAILS="Podane szczegóły dotyczące bazy danych są nieprawidłowe i/lub puste." INSTL_DATABASE_INVALID_MYSQL_VERSION="By móc kontynuować proces instalacji, konieczny jest serwer bazy danych MySQL w wersji 5.0.4 lub wyższej. Twoja wersja: %s" @@ -250,10 +245,8 @@ INSTL_MAGIC_QUOTES_GPC="Magiczne apostrofy GPC wyłączone" INSTL_MAGIC_QUOTES_RUNTIME="Magiczne apostrofy Runtime" INSTL_MB_LANGUAGE_IS_DEFAULT="Język wielobajtowy - neutralny" INSTL_MB_STRING_OVERLOAD_OFF="Nadpisywanie funkcji MB - wyłączone" -INSTL_MCRYPT_SUPPORT_AVAILABLE="Obsługa Mcrypt" INSTL_NOTICEMBLANGNOTDEFAULT="Wartość dyrektywy PHP mb_language nie została ustawiona na "_QQ_"neutral"_QQ_". Można zmienić to ustawienie poprzez dopisanie php_value mbstring.language neutral w pliku .htaccess." INSTL_NOTICEMBSTRINGOVERLOAD="Funkcja PHP przeciążania mbstring jest włączona. Można ją lokalnie wyłączyć poprzez dopisanie php_value mbstring.func_overload 0 w pliku .htaccess." -INSTL_NOTICEMCRYPTNOTAVAILABLE="Ostrzeżenie! Rozszerzenie PHP mcrypt powinno być zainstalowane i włączone. Bez tego niektóre funkcje Joomla nie będą dostępne." INSTL_NOTICEYOUCANSTILLINSTALL="
Możesz kontynuować instalację, ponieważ ustawienia konfiguracyjne zostaną wyświetlone na ostatnim etapie. Będziesz musiał ręcznie wprowadzić wtedy wyświetlony kod. Kliknij obszar zawierający tekst, by go podświetlić, a następnie wklej go do nowego pliku tekstowego. Nadaj temu plikowi nazwę 'configuration.php' i prześlij go do głównego katalogu swojej witryny." INSTL_OUTPUT_BUFFERING="Buforowanie wyjścia" INSTL_PARSE_INI_FILE_AVAILABLE="Obsługa parsera INI" @@ -300,7 +293,7 @@ JLIB_FORM_FIELD_INVALID="Niepoprawne pole: " JLIB_FORM_VALIDATE_FIELD_INVALID="Niepoprawne pole: %s" JLIB_FORM_VALIDATE_FIELD_REQUIRED="Wymagane pole: %s" JLIB_INSTALLER_ERROR_FAIL_COPY_FILE="JInstaller: :Install: Nie udało się kopiowanie pliku %1$s do %2$s." -JLIB_INSTALLER_NOT_ERROR="Jeśli błąd jest związany z instalacją plików językowych TinyMCE, nie ma to wpływu na instalację języka. Niektóre pakiety językowe stworzone przed Joomla! 3.2.0 mogą próbować instalować osobne pliki językowe TinyMCE. Ponieważ są one obecnie zawarte w rdzeniu, nie trzeba ich już instalować." +JLIB_INSTALLER_NOT_ERROR="Jeśli bład jest związany z instalacją plików językowych TinyMCE, nie ma to wpływu na instalację języka. Niektóre pakiety językowe stworzone przed Joomla! 3.2.0 mogą próbowac instalowac osobne pliki językowe TinyMCE. Ponieważ są one obecnie zawarte w rdzeniu, nie trzeba ich już instalować." JLIB_UTIL_ERROR_CONNECT_DATABASE="JDatabase: :getInstance: Nie można się połączyć z bazą danych
joomla.library: %1$s - %2$s" ; Strings for the language debugger diff --git a/installation/language/pl-PL/pl-PL.xml b/installation/language/pl-PL/pl-PL.xml index 0b88f2496a3b4..429fe66d3ae13 100644 --- a/installation/language/pl-PL/pl-PL.xml +++ b/installation/language/pl-PL/pl-PL.xml @@ -3,8 +3,8 @@ version="3.6" client="installation"> Polski (PL) - 3.6.1 - 03/08/2016 + 3.4.2 + 15/10/2012 Polskie Centrum Joomla!: joomla.pl Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt diff --git a/installation/model/database.php b/installation/model/database.php old mode 100644 new mode 100755 index a7fea7473faf5..95b30aef90e64 --- a/installation/model/database.php +++ b/installation/model/database.php @@ -652,6 +652,8 @@ public function createTables($options) } } + + // Handle default backend language setting. This feature is available for localized versions of Joomla. $app = JFactory::getApplication(); $languages = $app->getLocaliseAdmin($db); @@ -1022,7 +1024,16 @@ public function populateDatabase($db, $schema) * necessary, so there's no need to check the conditions in JInstaller. */ $query = $db->convertUtf8mb4QueryToUtf8($query); - + + /** + * If the Driver has set a nullDate which differs from the default (oldschool) nullDate + * replace it in the query + */ + if ($db->getNullDate()) + { + $query = $db->convertNullDate($query,$db->getNullDate()); + } + /** * This is a query which was supposed to convert tables to utf8mb4 charset but the server doesn't * support utf8mb4. Therefore we don't have to run it, it has no effect and it's a mere waste of time. diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql old mode 100644 new mode 100755 index 5fbfe52d4586f..09f620b77a795 --- a/installation/sql/mysql/joomla.sql +++ b/installation/sql/mysql/joomla.sql @@ -1231,7 +1231,7 @@ CREATE TABLE IF NOT EXISTS `#__menu` ( `level` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'The relative level in the tree.', `component_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to #__extensions.id', `checked_out` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to #__users.id', - `checked_out_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'The time the menu item was checked out.', + `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'The time the menu item was checked out.', `browserNav` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'The click behaviour of the link.', `access` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'The access level required to view the menu item.', `img` varchar(255) NOT NULL COMMENT 'The image of the menu item.', @@ -1969,6 +1969,21 @@ CREATE TABLE IF NOT EXISTS `#__utf8_conversion` ( INSERT INTO `#__utf8_conversion` (`converted`) VALUES (0); +-- +-- Table structure for table `#__nullDate_conversion` +-- + +CREATE TABLE IF NOT EXISTS `#__nullDate_conversion` ( + `converted` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +-- +-- Dumping data for table `#__nullDate_conversion` +-- + +INSERT INTO `#__nullDate_conversion` (`converted`) VALUES ('0000-00-00 00:00:00'); + + -- -- Table structure for table `#__viewlevels` -- diff --git a/language/en-GB/en-GB.xml b/language/en-GB/en-GB.xml index 40155080b7ca7..f22411343aa73 100644 --- a/language/en-GB/en-GB.xml +++ b/language/en-GB/en-GB.xml @@ -1,8 +1,8 @@ English (en-GB) - 3.6.3 - August 2016 + 3.6.1 + July 2016 Joomla! Project admin@joomla.org www.joomla.org diff --git a/language/en-GB/install.xml b/language/en-GB/install.xml index 6e0cb52153058..2f6b7b56539a4 100644 --- a/language/en-GB/install.xml +++ b/language/en-GB/install.xml @@ -2,8 +2,8 @@ English (United Kingdom) en-GB - 3.6.3 - August 2016 + 3.6.1 + July 2016 Joomla! Project admin@joomla.org www.joomla.org diff --git a/layouts/joomla/edit/params.php b/layouts/joomla/edit/params.php index 17095fb368413..fb49b5418cc12 100644 --- a/layouts/joomla/edit/params.php +++ b/layouts/joomla/edit/params.php @@ -49,16 +49,16 @@ if (!empty($fieldSet->label)) { - $label = JText::_($fieldSet->label); + $label = JText::_($fieldSet->label, true); } else { $label = strtoupper('JGLOBAL_FIELDSET_' . $name); - if (JText::_($label) == $label) + if (JText::_($label, true) == $label) { $label = strtoupper($app->input->get('option') . '_' . $name . '_FIELDSET_LABEL'); } - $label = JText::_($label); + $label = JText::_($label, true); } echo JHtml::_('bootstrap.addTab', 'myTab', 'attrib-' . $name, $label); diff --git a/libraries/cms/html/email.php b/libraries/cms/html/email.php index b348921879b51..08e8a74914236 100644 --- a/libraries/cms/html/email.php +++ b/libraries/cms/html/email.php @@ -99,8 +99,23 @@ public static function cloak($mail, $mailto = true, $text = '', $email = true) $tmpScript "; - // TODO: Use inline script for now - $inlineScript = ""; + if (strtolower(JFactory::getApplication()->input->server->get('HTTP_X_REQUESTED_WITH', '')) == 'xmlhttprequest') + { + // Use inline script for ajax calls + $inlineScript = ""; + } + else + { + JFactory::getDocument()->addScriptDeclaration( + " + document.onreadystatechange = function () { + if (document.readyState == 'interactive') { + " . $script . " + } + }; + " + ); + } return '' . JText::_('JLIB_HTML_CLOAKING') . '' . $inlineScript; } diff --git a/libraries/cms/schema/changeitem/mysql.php b/libraries/cms/schema/changeitem/mysql.php index 673a5c65289d9..fdfb4e2d6c099 100644 --- a/libraries/cms/schema/changeitem/mysql.php +++ b/libraries/cms/schema/changeitem/mysql.php @@ -60,10 +60,12 @@ protected function buildCheckQuery() $command = strtoupper($wordArray[0] . ' ' . $wordArray[1]); // Check for special update statement to reset utf8mb4 conversion status - if (($command == 'UPDATE `#__UTF8_CONVERSION`' + if ((($command == 'UPDATE `#__UTF8_CONVERSION`' || $command == 'UPDATE #__UTF8_CONVERSION') && strtoupper($wordArray[2]) == 'SET' && strtolower(substr(str_replace('`', '', $wordArray[3]), 0, 9)) == 'converted') + || (($command == 'INSERT INTO `#__nullDate_conversion`') + && strtolower(substr(str_replace('`', '', $wordArray[3]), 0, 9)) == 'converted')) { // Statement is special statement to reset conversion status $this->queryType = 'UTF8CNV'; diff --git a/libraries/cms/version/version.php b/libraries/cms/version/version.php index d276866c9a8c0..f7ca032565cbc 100644 --- a/libraries/cms/version/version.php +++ b/libraries/cms/version/version.php @@ -38,7 +38,7 @@ final class JVersion * @var string * @since 3.5 */ - const DEV_LEVEL = '3-dev'; + const DEV_LEVEL = '1-rc2'; /** * Development status. @@ -46,7 +46,7 @@ final class JVersion * @var string * @since 3.5 */ - const DEV_STATUS = 'Development'; + const DEV_STATUS = 'Release Candidate'; /** * Build number. @@ -70,7 +70,7 @@ final class JVersion * @var string * @since 3.5 */ - const RELDATE = '5-August-2016'; + const RELDATE = '31-July-2016'; /** * Release time. @@ -78,7 +78,7 @@ final class JVersion * @var string * @since 3.5 */ - const RELTIME = '00:32'; + const RELTIME = '16:51'; /** * Release timezone. diff --git a/libraries/joomla/database/driver.php b/libraries/joomla/database/driver.php old mode 100644 new mode 100755 index 8c5c5f12fb77d..457b38c4a83d1 --- a/libraries/joomla/database/driver.php +++ b/libraries/joomla/database/driver.php @@ -873,7 +873,26 @@ public function getAlterTableCharacterSet($tableName) return $queries; } - + + /** + * Automatically changes the null date in the Query File + * + * @param string $query The query to convert + * + * @param string $nullDate The used nullDate + * + * @return string The converted query + */ + public function convertNullDate($query,$nullDate) + { + if ($nullDate != '0000-00-00 00:00:00') + { + $query = str_replace('0000-00-00 00:00:00', $nullDate, $query); + } + + return $query; + } + /** * Automatically downgrade a CREATE TABLE or ALTER TABLE query from utf8mb4 (UTF-8 Multibyte) to plain utf8. Used * when the server doesn't support UTF-8 Multibyte. diff --git a/libraries/joomla/database/driver/mysqli.php b/libraries/joomla/database/driver/mysqli.php index b26e8423ee0a4..9b0fe79d0ba36 100644 --- a/libraries/joomla/database/driver/mysqli.php +++ b/libraries/joomla/database/driver/mysqli.php @@ -194,6 +194,12 @@ public function connect() // Pre-populate the UTF-8 Multibyte compatibility flag based on server version $this->utf8mb4 = $this->serverClaimsUtf8mb4Support(); + + // Use different NullTime + if ($this->serverUsesNewNullTime()) + { + $this->nullDate = '1000-01-01 00:00:00'; + } // Set the character set (needed for MySQL 4.1.2+). $this->utf = $this->setUtf(); @@ -974,6 +980,21 @@ private function serverClaimsUtf8mb4Support() } } } + + /** + * Does the database server uses the new null time (1000-01-01 00:00:00) instead of the old one (0000-00-00 00:00:00) + * + * libmysql uses the new null time since 5.7 (same version as the MySQL server). + * + * @return boolean + * + * @since 12.2 + */ + public function serverUsesNewNullTime() + { + $server_version = $this->getVersion(); + return version_compare($server_version, '5.7.0', '>='); + } /** * Return the actual SQL Error number diff --git a/libraries/joomla/database/driver/pdomysql.php b/libraries/joomla/database/driver/pdomysql.php index 024b1e97578b2..04ec5bcb7ae45 100644 --- a/libraries/joomla/database/driver/pdomysql.php +++ b/libraries/joomla/database/driver/pdomysql.php @@ -45,21 +45,21 @@ class JDatabaseDriverPdomysql extends JDatabaseDriverPdo protected $nameQuote = '`'; /** - * The null or zero representation of a timestamp for the database driver. This should be - * defined in child classes to hold the appropriate value for the engine. + * The minimum supported database version. * * @var string * @since 3.4 */ - protected $nullDate = '0000-00-00 00:00:00'; + protected static $dbMinimum = '5.0.4'; /** - * The minimum supported database version. + * The null or zero representation of a timestamp for the database driver. This should be + * defined in child classes to hold the appropriate value for the engine. * * @var string * @since 3.4 */ - protected static $dbMinimum = '5.0.4'; + protected $nullDate = '0000-00-00 00:00:00'; /** * Constructor. @@ -130,15 +130,16 @@ public function connect() parent::connect(); } + $serverVersion = $this->connection->getAttribute(PDO::ATTR_SERVER_VERSION); if ($this->utf8mb4) { /* * At this point we know the client supports utf8mb4. Now * we must check if the server supports utf8mb4 as well. */ - $serverVersion = $this->connection->getAttribute(PDO::ATTR_SERVER_VERSION); + $this->utf8mb4 = version_compare($serverVersion, '5.5.3', '>='); - + if (!$this->utf8mb4) { // Reconnect with the utf8 character set. @@ -148,6 +149,14 @@ public function connect() } } + /* + * checking if the new null type format of myaql 5.7.0 is used + */ + if (version_compare($serverVersion, '5.7.0', '>=')) + { + $this->nullDate = '1000-01-01 00:00:00'; + } + $this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $this->connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); @@ -166,6 +175,21 @@ public static function isSupported() { return class_exists('PDO') && in_array('mysql', PDO::getAvailableDrivers()); } + + /** + * Does the database server uses the new null time (1000-01-01 00:00:00) instead of the old one (0000-00-00 00:00:00) + * + * libmysql uses the new null time since 5.7 (same version as the MySQL server). + * + * @return boolean + * + * @since 12.2 + */ + public function serverUsesNewNullTime() + { + return ($this->nullDate == "1000-01-01 00:00:00"); + } + /** * Drops a table from the database. diff --git a/libraries/joomla/database/driver/sqlsrv.php b/libraries/joomla/database/driver/sqlsrv.php index 4ae9054d83e69..959b72096a468 100644 --- a/libraries/joomla/database/driver/sqlsrv.php +++ b/libraries/joomla/database/driver/sqlsrv.php @@ -382,7 +382,10 @@ public function getTableColumns($table, $typeOnly = true) { foreach ($fields as $field) { - $field->Default = preg_replace("/(^(\(\(|\('|\(N'|\()|(('\)|(?Default); + if (stristr(strtolower($field->Type), "nvarchar")) + { + $field->Default = ""; + } $result[$field->Field] = $field; } } diff --git a/libraries/joomla/session/handler/native.php b/libraries/joomla/session/handler/native.php index bc13c8ab327f9..9b439b6d9c3eb 100644 --- a/libraries/joomla/session/handler/native.php +++ b/libraries/joomla/session/handler/native.php @@ -22,7 +22,7 @@ class JSessionHandlerNative implements JSessionHandlerInterface * @var boolean * @since 3.5 */ - private $started = false; + private $started; /** * Has the session been closed @@ -30,7 +30,7 @@ class JSessionHandlerNative implements JSessionHandlerInterface * @var boolean * @since 3.5 */ - private $closed = false; + private $closed; /** * Starts the session @@ -151,7 +151,6 @@ public function regenerate($destroy = false, $lifetime = null) // Workaround for https://bugs.php.net/bug.php?id=61470 as suggested by David Grudl session_write_close(); - $this->closed = true; if (isset($_SESSION)) { diff --git a/libraries/joomla/session/session.php b/libraries/joomla/session/session.php index 25dc216cdf7a3..e9af2d8014510 100644 --- a/libraries/joomla/session/session.php +++ b/libraries/joomla/session/session.php @@ -698,7 +698,6 @@ public function destroy() return true; } - // Kill session $this->_handler->clear(); // Create new data storage @@ -769,6 +768,9 @@ public function fork() // Keep session config $cookie = session_get_cookie_params(); + // Kill session + $this->_handler->clear(); + // Re-register the session store after a session has been destroyed, to avoid PHP bug $this->_store->register(); diff --git a/libraries/joomla/updater/update.php b/libraries/joomla/updater/update.php index e8053c60002ef..291371f08f54f 100644 --- a/libraries/joomla/updater/update.php +++ b/libraries/joomla/updater/update.php @@ -391,6 +391,9 @@ public function _characterData($parser, $data) { $tag = $this->_getLastTag(); + // @todo remove code: if(!isset($this->$tag->_data)) $this->$tag->_data = ''; + // @todo remove code: $this->$tag->_data .= $data; + // Throw the data for this item together $tag = strtolower($tag); diff --git a/libraries/joomla/user/helper.php b/libraries/joomla/user/helper.php index c03e924c8d101..45585a8894a2e 100644 --- a/libraries/joomla/user/helper.php +++ b/libraries/joomla/user/helper.php @@ -243,7 +243,7 @@ public static function activateUser($activation) ->from($db->quoteName('#__users')) ->where($db->quoteName('activation') . ' = ' . $db->quote($activation)) ->where($db->quoteName('block') . ' = 1') - ->where($db->quoteName('lastvisitDate') . ' = ' . $db->quote($db->getNullDate())); + ->where($db->quoteName('lastvisitDate') . ' = ' . $db->quote('0000-00-00 00:00:00')); $db->setQuery($query); $id = (int) $db->loadResult(); diff --git a/phpunit.xml.dist b/phpunit.xml.dist index de08879d53d08..c222c3a066441 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -31,9 +31,6 @@ tests/unit/suites/finderIndexer - - tests/unit/suites/plugins - @@ -48,7 +45,6 @@ libraries/joomla libraries/legacy administrator/components/com_finder/helpers/indexer - plugins administrator/includes/helper.php libraries/loader.php libraries/platform.php diff --git a/plugins/content/emailcloak/emailcloak.php b/plugins/content/emailcloak/emailcloak.php index d6266af9ae225..503f507430b11 100644 --- a/plugins/content/emailcloak/emailcloak.php +++ b/plugins/content/emailcloak/emailcloak.php @@ -479,12 +479,8 @@ protected function _cloak(&$text, &$params) $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); } - /* - * Search for plain text email addresses, such as email@example.org but not within HTML tags: - * or - * The negative lookahead '(?![^<]*>)' is used to exclude this kind of occurrences - */ - $pattern = '~(?![^<>]*>)' . $searchEmail . '~i'; + // Search for plain text email@example.org + $pattern = '~' . $searchEmail . '([^a-z0-9]|$)~i'; while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) { diff --git a/plugins/user/joomla/joomla.php b/plugins/user/joomla/joomla.php index 1399acd7bc9dd..910bd6f6e408d 100644 --- a/plugins/user/joomla/joomla.php +++ b/plugins/user/joomla/joomla.php @@ -182,7 +182,7 @@ public function onUserLogin($user, $options = array()) } // If the user is blocked, redirect with an error - if ($instance->block == 1) + if ($instance->get('block') == 1) { $this->app->enqueueMessage(JText::_('JERROR_NOLOGIN_BLOCKED'), 'warning'); @@ -206,25 +206,22 @@ public function onUserLogin($user, $options = array()) } // Mark the user as logged in - $instance->guest = 0; + $instance->set('guest', 0); + // Register the needed session variables $session = JFactory::getSession(); - - // Grab the current session ID - $oldSessionId = $session->getId(); - - // Fork the session - $session->fork(); - $session->set('user', $instance); - // Ensure the new session's metadata is written to the database + // Check to see the the session already exists. $this->app->checkSession(); - // Purge the old session + // Update the user related fields for the Joomla sessions table. $query = $this->db->getQuery(true) - ->delete('#__session') - ->where($this->db->quoteName('session_id') . ' = ' . $this->db->quote($oldSessionId)); + ->update($this->db->quoteName('#__session')) + ->set($this->db->quoteName('guest') . ' = ' . $this->db->quote($instance->guest)) + ->set($this->db->quoteName('username') . ' = ' . $this->db->quote($instance->username)) + ->set($this->db->quoteName('userid') . ' = ' . (int) $instance->id) + ->where($this->db->quoteName('session_id') . ' = ' . $this->db->quote($session->getId())); try { @@ -232,7 +229,7 @@ public function onUserLogin($user, $options = array()) } catch (RuntimeException $e) { - // The old session is already invalidated, don't let this block logging in + return false; } // Hit the user last visit field @@ -273,7 +270,7 @@ public function onUserLogout($user, $options = array()) } // Check to see if we're deleting the current session - if ($my->id == $user['id'] && $options['clientid'] == $this->app->getClientId()) + if ($my->get('id') == $user['id'] && $options['clientid'] == $this->app->getClientId()) { // Hit the user last visit field $my->setLastVisit(); @@ -323,7 +320,7 @@ public function onUserLogout($user, $options = array()) * @param array $user Holds the user data. * @param array $options Array holding options (remember, autoregister, group). * - * @return JUser + * @return object A JUser object * * @since 1.5 */ @@ -345,14 +342,14 @@ protected function _getUser($user, $options = array()) // Hard coded default to match the default value from com_users. $defaultUserGroup = $config->get('new_usertype', 2); - $instance->id = 0; - $instance->name = $user['fullname']; - $instance->username = $user['username']; - $instance->password_clear = $user['password_clear']; + $instance->set('id', 0); + $instance->set('name', $user['fullname']); + $instance->set('username', $user['username']); + $instance->set('password_clear', $user['password_clear']); // Result should contain an email (check). - $instance->email = $user['email']; - $instance->groups = array($defaultUserGroup); + $instance->set('email', $user['email']); + $instance->set('groups', array($defaultUserGroup)); // If autoregister is set let's register the user $autoregister = isset($options['autoregister']) ? $options['autoregister'] : $this->params->get('autoregister', 1); diff --git a/tests/README.md b/tests/README.md index c06eaf71e1818..c8ac6d073d448 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,8 +1,10 @@ Testing Joomla CMS ========== -The current folder contains the Tests for Quality Assurance of the Joomla Content Management System. +The current folder contains the Tests for Quality Assurance of the Joomla Content Management System. The Tests are divided into 3 main subfolders: * unit: contains the Joomla-cms unit tests based on PHPUnit +* system: contains the Webdriver-Nearsoft based Selenium tests +* codeception: contains the new System Tests based on the Codeception Testing Framework Find more details inside each folder. diff --git a/tests/codeception/README.md b/tests/codeception/README.md new file mode 100644 index 0000000000000..aec27b62548fb --- /dev/null +++ b/tests/codeception/README.md @@ -0,0 +1,46 @@ +Testing Joomla CMS +========== + +## System testing +This folder contains a System Tests suite based on Codeception Testing Framework. For more information see: https://docs.joomla.org/Testing_Joomla_Extensions_with_Codeception + +### Getting Joomla +The first step to execute the System tests at Joomla-CMS a Joomla website. To do it automatically you can execute the following commands: + +``` +cd tests/codeception +composer install +# The following comand uses a Joomla Framework App that downloads the latests Joomla +php cli/getjoomlacli.php +``` + +note: to execute the previous commands you will need Composer in your system. See https://docs.joomla.org/Testing_Joomla_Extensions_with_Codeception#Testing_with_Codeception. + + +### Running the tests + +Rename tests/acceptance.suite.dist.yml to tests/acceptance.suite.yml + +Modify the configuration at tests/acceptance.suite.yml to fit your server details. Find the instructions in the same file: https://github.com/joomla/joomla-cms/tests/codeception/acceptance.suite.dist.yml#L3 + +Run Selenium server (is the software that drives your Firefox browser): + +``` +# Download Selenium Server +curl -O http://selenium-release.storage.googleapis.com/2.41/selenium-server-standalone-2.41.0.jar + +# Go to the folder were you have downloaded the file and start the Selenium Server +java -Xms40m -Xmx256m -jar ./selenium-server-standalone-2.41.0.jar +``` + + +Execute the tests: + +``` +php vendor/bin/codecept build +php vendor/bin/codecept run tests/acceptance/installation/ --steps +php vendor/bin/codecept run tests/acceptance/administrator/ --steps +``` + +You can also execute the tests using runsystemtests.sh file + diff --git a/tests/codeception/cli/getjoomlacli.php b/tests/codeception/cli/getjoomlacli.php new file mode 100644 index 0000000000000..ab387c4fbb5cb --- /dev/null +++ b/tests/codeception/cli/getjoomlacli.php @@ -0,0 +1,102 @@ +input->get('h') || $this->input->get('help')) + { + $this->out(); + $this->out('GetJoomlaCLI ' . self::VERSION); + $this->out('--------------------------------------------------------'); + $this->out('GetJoomlaCLI is a Joomla Framework simple Command Line Apllication.'); + $this->out('With GetJoomlaCLI you can easily download the latest Joomla CMS into a folder.'); + $this->out('called "testingsite".'); + $this->out(); + $this->out(' -h | --help Prints this usage information.'); + $this->out(' -folder the folder name where to create the joomla site'); + $this->out(' "testingsite" will be used if no name is provided'); + $this->out('EXAMPLE USAGE:'); + $this->out(' php -f getjoomlacli.php -h'); + $this->out(' php -f getjoomlacli.php --folder=testingsite'); + $this->out(); + } + else + { + $folder = JPATH_ROOT . '/' . $this->input->get('folder', 'testingsite'); + + if (is_dir($folder)) + { + $this->out('Removing old files in the folder...'); + Folder::delete($folder); + } + + Folder::create($folder); + + $this->out('Downloading Joomla...'); + $repository = 'https://github.com/joomla/joomla-cms.git'; + $branch = 'staging'; + + $command = "git clone -b ${branch} --single-branch --depth 1 ${repository} ${folder}"; + $this->out($command); + + $output = array(); + + exec($command, $output, $returnValue); + + if ($returnValue) + { + $this->out('Sadly we were not able to download Joomla.'); + } + else + { + $this->out('Joomla Downloaded and ready for executing the tests.'); + } + } + } +} + +define('JPATH_ROOT', realpath(dirname(__DIR__))); + +$app = new GetJoomlaCli; +$app->execute(); + diff --git a/tests/codeception/codeception.yml b/tests/codeception/codeception.yml new file mode 100644 index 0000000000000..b9a584df57336 --- /dev/null +++ b/tests/codeception/codeception.yml @@ -0,0 +1,10 @@ +actor: Tester +paths: + tests: tests + log: tests/_output + data: tests/_data + helpers: tests/_support +settings: + bootstrap: _bootstrap.php + colors: true + memory_limit: 1024M diff --git a/tests/codeception/composer.json b/tests/codeception/composer.json new file mode 100644 index 0000000000000..f8557d158b334 --- /dev/null +++ b/tests/codeception/composer.json @@ -0,0 +1,14 @@ +{ + "name" : "joomla-cms", + "description": "The Joomla Content Management System", + "license" : "GPL-2.0+", + "require" : { + "php": ">=5.3.10" + }, + "require-dev": { + "codeception/codeception": "2.0.*@dev", + "joomla/application": "~1.0", + "joomla/filesystem": "~1.0", + "joomla/di" : "~1.0" + } +} diff --git a/tests/codeception/runsystemtests.sh b/tests/codeception/runsystemtests.sh new file mode 100755 index 0000000000000..676991e1dc425 --- /dev/null +++ b/tests/codeception/runsystemtests.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +printf "\nUpdating composer\n" +composer update +printf "\nDownloading Joomla\n" +php cli/getjoomlacli.php +printf "\nPreparing Codeception\n" +php vendor/bin/codecept build +printf "\nRunning Installation test\n" +php vendor/bin/codecept run tests/acceptance/installation --steps --debug +printf "\nSetting Error Reporting to Development\n" +php vendor/bin/codecept run tests/acceptance/administrator/setDevelopmentErrorReportingCept.php --steps \ No newline at end of file diff --git a/tests/codeception/tests/_bootstrap.php b/tests/codeception/tests/_bootstrap.php new file mode 100644 index 0000000000000..243f9c85bc6da --- /dev/null +++ b/tests/codeception/tests/_bootstrap.php @@ -0,0 +1,2 @@ +config[$element]; + } +} diff --git a/tests/codeception/tests/_support/FunctionalHelper.php b/tests/codeception/tests/_support/FunctionalHelper.php new file mode 100644 index 0000000000000..22cc714277faa --- /dev/null +++ b/tests/codeception/tests/_support/FunctionalHelper.php @@ -0,0 +1,10 @@ + "#mod-login-username", + 'password' => "#mod-login-password" + ); +} diff --git a/tests/codeception/tests/acceptance/administrator/_pages/system/globalconfigurationpage.php b/tests/codeception/tests/acceptance/administrator/_pages/system/globalconfigurationpage.php new file mode 100644 index 0000000000000..d04e911e124ab --- /dev/null +++ b/tests/codeception/tests/acceptance/administrator/_pages/system/globalconfigurationpage.php @@ -0,0 +1,27 @@ + "//div[@id='jform_error_reporting_chzn']/a", + 'option: Development' => "//div[@id='jform_error_reporting_chzn']/div/ul/li[contains(text(), 'Development')]", + ); +} diff --git a/tests/codeception/tests/acceptance/administrator/_steps/loginsteps.php b/tests/codeception/tests/acceptance/administrator/_steps/loginsteps.php new file mode 100644 index 0000000000000..f53a95d930e38 --- /dev/null +++ b/tests/codeception/tests/acceptance/administrator/_steps/loginsteps.php @@ -0,0 +1,30 @@ +am('Administrator'); + $I->amOnPage(\AdministratorLoginPage::$URL); + $I->fillField(\AdministratorLoginPage::$elements['username'], $user); + $I->fillField(\AdministratorLoginPage::$elements['password'], $password); + $I->click('Log in'); + $I->waitForText('Control Panel',10,'H1'); + } +} diff --git a/tests/codeception/tests/acceptance/administrator/setDevelopmentErrorReporting.txt b/tests/codeception/tests/acceptance/administrator/setDevelopmentErrorReporting.txt new file mode 100644 index 0000000000000..fa20a942f31f5 --- /dev/null +++ b/tests/codeception/tests/acceptance/administrator/setDevelopmentErrorReporting.txt @@ -0,0 +1,12 @@ +I WANT TO SET JOOMLA ERROR REPORTING TO DEVELOPMENT + +I do administrator login('admin', 'admin') +I am on page '/administrator/index.php?option=com_config' +I wait for text 'Global Configuration',10,'.page-title' +I click 'Server' +I wait for element visible "$globalConfiguration['Error Reporting Dropdown']" +I click "$globalConfiguration['Error Reporting Dropdown']" +I click "$globalConfiguration['option: Development']" +I click 'Save' +I wait for text 'Global Configuration',10,'.page-title' +I see 'Configuration successfully saved.','#system-message-container' \ No newline at end of file diff --git a/tests/codeception/tests/acceptance/administrator/setDevelopmentErrorReportingCept.php b/tests/codeception/tests/acceptance/administrator/setDevelopmentErrorReportingCept.php new file mode 100644 index 0000000000000..e5c422d492868 --- /dev/null +++ b/tests/codeception/tests/acceptance/administrator/setDevelopmentErrorReportingCept.php @@ -0,0 +1,30 @@ +wantTo('set Joomla Error Reporting to Development'); + +// The following command is using a method defined in the Step Object (see _steps/loginsteps.php) +$I->doAdministratorLogin($I->getConfiguration('Username'), $I->getConfiguration('Password')); + +$I->amOnPage('/administrator/index.php?option=com_config'); + +$globalConfiguration = \GlobalconfigurationPage::$elements; +$I->waitForText('Global Configuration',10,'.page-title'); +$I->click('Server'); +$I->waitForElementVisible($globalConfiguration['Error Reporting Dropdown']); +$I->click($globalConfiguration['Error Reporting Dropdown']); +$I->click($globalConfiguration['option: Development']); +$I->click('Save'); +$I->waitForText('Global Configuration',10,'.page-title'); +$I->see('Configuration successfully saved.','#system-message-container'); \ No newline at end of file diff --git a/tests/codeception/tests/acceptance/installation/InstallJoomla.txt b/tests/codeception/tests/acceptance/installation/InstallJoomla.txt new file mode 100644 index 0000000000000..a057dfcad0d3b --- /dev/null +++ b/tests/codeception/tests/acceptance/installation/InstallJoomla.txt @@ -0,0 +1,29 @@ +I WANT TO INSTALL JOOMLA CMS + +I expect 'no configuration.php is in the Joomla CMS folder' +I don't see file found('configuration.php', $i->get configuration 'Joomla folder')" +I am on page '/installation/index.php' +I wait for text 'Main Configuration',"10",'h3' +I click "$configurationPage['Language Selector']" +I click($configuration page[$i->get configuration 'Language')]" +I fill field 'Site Name','Joomla CMS test' +I fill field 'Description','Site for testing Joomla CMS' +I fill field('admin email',admin@mydomain.com)" +I fill field('admin username','admin')" +I fill field('admin password','admin')" +I fill field('confirm admin password','admin')" +I click "$configurationPage['No Site Offline']" +I click 'Next' +I wait for text 'Database Configuration',10,'h3' +I select option('database type', 'msqli')" +I fill field('host name','localhost')" +I fill field('username','root')" +I fill field('password','root')" +I fill field('database name','testjoomla')" +I fill field('table prefix','jos_')" +I click "$databasePage['Remove Old Database button']" +I click 'Next' +I wait for text 'Finalisation',10," 'h3' +I select option($overview page['sample data'], 'none')" +I click 'Install' +I wait for text 'Congratulations! Joomla! is now installed.',30,'h3' \ No newline at end of file diff --git a/tests/codeception/tests/acceptance/installation/InstallJoomlaCept.php b/tests/codeception/tests/acceptance/installation/InstallJoomlaCept.php new file mode 100644 index 0000000000000..421bda8c614f7 --- /dev/null +++ b/tests/codeception/tests/acceptance/installation/InstallJoomlaCept.php @@ -0,0 +1,61 @@ +wantTo('Install Joomla CMS'); +$I->expect('no configuration.php is in the Joomla CMS folder'); +$I->dontSeeFileFound('configuration.php', $I->getConfiguration('Joomla folder')); + +$I->amOnPage('/installation/index.php'); + +// I Wait for the text Main Configuration, meaning that the page is loaded +$I->waitForText('Main Configuration',10,'h3'); + +// I instantiate the Installation Configuration Page Elements: +$configurationPage = \JoomlaInstallationConfigurationPage::$elements; +$I->click($configurationPage['Language Selector']); +$I->click($configurationPage[$I->getConfiguration('Language')]); +$I->fillField('Site Name','Joomla CMS test'); +$I->fillField('Description','Site for testing Joomla CMS'); +// I get the configuration from acceptance.suite.yml (see: tests/_support/acceptancehelper.php) +$I->fillField('Admin Email',$I->getConfiguration('Admin email')); +$I->fillField('Admin Username',$I->getConfiguration('Username')); +$I->fillField('Admin Password',$I->getConfiguration('Password')); +$I->fillField('Confirm Admin Password',$I->getConfiguration('Password')); +$I->click($configurationPage['No Site Offline']); +$I->click('Next'); + +$I->wantTo('Fill the form for creating the Joomla site Database'); +$I->waitForText('Database Configuration', 10, 'h3'); +// I instance the Install Joomla Database Page +$databasePage = \JoomlaInstallationDatabasePage::$elements; +$I->selectOption($databasePage['Database Type'], $I->getConfiguration('Database Type')); +$I->fillField('Host Name',$I->getConfiguration('Database Host')); +$I->fillField('Username',$I->getConfiguration('Database User')); +$I->fillField('Password',$I->getConfiguration('Database Password')); +$I->fillField('Database Name',$I->getConfiguration('Database Name')); +$I->fillField('Table Prefix',$I->getConfiguration('Database Prefix')); +$I->click($databasePage['Remove Old Database button']); +$I->click('Next'); + +$I->wantTo('Fill the form for creating the Joomla site database'); +$I->waitForText('Finalisation', 10, 'h3'); +$overviewPage = \JoomlaInstallationOverviewPage::$elements; + +if ($I->getConfiguration('Install Sample Data')) : + $I->selectOption($overviewPage['Sample Data'], $I->getConfiguration('Sample Data')); +else : + $I->selectOption($overviewPage['Sample Data'], $overviewPage['No sample Data']); +endif; + +$I->click('Install'); + +// Wait while Joomla gets installed +$I->waitForText('Congratulations! Joomla! is now installed.',30,'h3'); diff --git a/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationconfigurationpage.php b/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationconfigurationpage.php new file mode 100644 index 0000000000000..76b80ca801173 --- /dev/null +++ b/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationconfigurationpage.php @@ -0,0 +1,30 @@ + "//div[@id='jform_language_chzn']/a", + 'English (United Kingdom)' => "//li[text()='English (United Kingdom)']", + 'No Site Offline' => "//fieldset[@id='jform_site_offline']/label[2]" + ); +} diff --git a/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationdatabasepage.php b/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationdatabasepage.php new file mode 100644 index 0000000000000..a699511b239e9 --- /dev/null +++ b/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationdatabasepage.php @@ -0,0 +1,30 @@ + "#jform_db_type", + 'Remove Old Database button' => "//label[@for='jform_db_old1']" + ); +} + diff --git a/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationoverviewpage.php b/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationoverviewpage.php new file mode 100644 index 0000000000000..9633626d49fe2 --- /dev/null +++ b/tests/codeception/tests/acceptance/installation/_pages/joomlainstallationoverviewpage.php @@ -0,0 +1,30 @@ + '#jform_sample_file', + 'No sample Data' => '#jform_sample_file0', + 'Default English (GB) Sample Data' => '#jform_sample_file3' + ); +} diff --git a/tests/codeception/tests/functional.suite.yml b/tests/codeception/tests/functional.suite.yml new file mode 100644 index 0000000000000..3b17a39dc7c53 --- /dev/null +++ b/tests/codeception/tests/functional.suite.yml @@ -0,0 +1,9 @@ +# Codeception Test Suite Configuration + +# suite for functional (integration) tests. +# emulate web requests and make application process them. +# Include one of framework modules (Symfony2, Yii2, Laravel4) to use it. + +class_name: FunctionalTester +modules: + enabled: [Filesystem, FunctionalHelper] diff --git a/tests/codeception/tests/functional/_bootstrap.php b/tests/codeception/tests/functional/_bootstrap.php new file mode 100644 index 0000000000000..8a885558065a1 --- /dev/null +++ b/tests/codeception/tests/functional/_bootstrap.php @@ -0,0 +1,2 @@ +baseURI = $this->folder . $this->path; + } + +} diff --git a/tests/system/webdriver/Pages/Components/BannerEditPage.php b/tests/system/webdriver/Pages/Components/BannerEditPage.php new file mode 100644 index 0000000000000..e5cbfb2357e0b --- /dev/null +++ b/tests/system/webdriver/Pages/Components/BannerEditPage.php @@ -0,0 +1,92 @@ + 'Name', 'id' => 'jform_name', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Alias', 'id' => 'jform_alias', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Type', 'id' => 'jform_type', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Image', 'id' => 'jform_params_imageurl', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Width', 'id' => 'jform_params_width', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Height', 'id' => 'jform_params_height', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Alternative Text', 'id' => 'jform_params_alt', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Click URL', 'id' => 'jform_clickurl', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Description', 'id' => 'jform_description', 'type' => 'textarea', 'tab' => 'details'), + array('label' => 'Status', 'id' => 'jform_state', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Category', 'id' => 'jform_catid', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Pinned', 'id' => 'jform_sticky', 'type' => 'fieldset', 'tab' => 'details'), + array('label' => 'Language', 'id' => 'jform_language', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Version Note', 'id' => 'jform_version_note', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Max. Impressions', 'id' => 'jform_imptotal', 'type' => 'input', 'tab' => 'otherparams'), + array('label' => 'Total Impressions', 'id' => 'jform_impmade', 'type' => 'input', 'tab' => 'otherparams'), + array('label' => 'Total Clicks', 'id' => 'jform_clicks', 'type' => 'input', 'tab' => 'otherparams'), + array('label' => 'Client', 'id' => 'jform_cid', 'type' => 'select', 'tab' => 'otherparams'), + array('label' => 'Purchase Type', 'id' => 'jform_purchase_type', 'type' => 'select', 'tab' => 'otherparams'), + array('label' => 'Track Impressions', 'id' => 'jform_track_impressions', 'type' => 'select', 'tab' => 'otherparams'), + array('label' => 'Track Clicks', 'id' => 'jform_track_clicks', 'type' => 'select', 'tab' => 'otherparams'), + array('label' => 'Start Publishing', 'id' => 'jform_publish_up', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Finish Publishing', 'id' => 'jform_publish_down', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Created Date', 'id' => 'jform_created', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Created By', 'id' => 'jform_created_by', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Created by Alias', 'id' => 'jform_created_by_alias', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Modified Date', 'id' => 'jform_modified', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Modified By', 'id' => 'jform_modified_by', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Revision', 'id' => 'jform_version', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'ID', 'id' => 'jform_id', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Meta Keywords', 'id' => 'jform_metakey', 'type' => 'textarea', 'tab' => 'publishing'), + array('label' => 'Use Own Prefix', 'id' => 'jform_own_prefix', 'type' => 'fieldset', 'tab' => 'publishing'), + array('label' => 'Meta Keyword Prefix', 'id' => 'jform_metakey_prefix', 'type' => 'input', 'tab' => 'publishing'), + ); + +} + diff --git a/tests/system/webdriver/Pages/Components/BannerManagerPage.php b/tests/system/webdriver/Pages/Components/BannerManagerPage.php new file mode 100644 index 0000000000000..53d4a5b8add37 --- /dev/null +++ b/tests/system/webdriver/Pages/Components/BannerManagerPage.php @@ -0,0 +1,169 @@ + 'list_fullordering', + '20' => 'list_limit', + 'Select Status' => 'filter_state', + 'Select Client' => 'filter_client_id', + 'Select Category' => 'filter_category_id', + 'Select Language' => 'filter_language' + ); + + /** + * Array of toolbar id values for this page + * + * @var array + * @since 3.2 + */ + public $toolbar = array ( + 'New' => 'toolbar-new', + 'Edit' => 'toolbar-edit', + 'Publish' => 'toolbar-publish', + 'Unpublish' => 'toolbar-unpublish', + 'Archive' => 'toolbar-archive', + 'Check In' => 'toolbar-check-in', + 'Trash' => 'toolbar-trash', + 'Empty Trash' => 'toolbar-delete', + 'Batch' => 'toolbar-batch', + 'Options' => 'toolbar-options', + 'Help' => 'toolbar-help', + ); + + /** + * Add a new Banner item in the Banner Manager: Component screen. + * + * @param string $name Test Banner Name + * @param array $fields associative array of fields in the form label => value. + * + * @return BannerManagerPage + */ + public function addBanner($name='Test Banner', $fields = null) + { + $this->clickButton('toolbar-new'); + $bannerEditPage = $this->test->getPageObject('BannerEditPage'); + $bannerEditPage->setFieldValues(array('Name' => $name)); + if ($fields) + { + $bannerEditPage->setFieldValues($fields); + } + $bannerEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('BannerManagerPage'); + } + + /** + * Edit a Banner item in the Banner Manager: Banner Items screen. + * + * @param string $name Banner Title field + * @param array $fields associative array of fields in the form label => value. + * + * @return void + */ + public function editBanner($name, $fields) + { + $this->clickItem($name); + $bannerEditPage = $this->test->getPageObject('BannerEditPage'); + $bannerEditPage->setFieldValues($fields); + $bannerEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('BannerManagerPage'); + $this->searchFor(); + } + + /** + * Get state of a Banner item in the Banner Manager: Banner Items screen. + * + * @param string $name Banner Title field + * + * @return State of the Banner //Published or Unpublished + */ + public function getState($name) + { + $result = false; + $row = $this->getRowNumber($name); + $text = $this->driver->findElement(By::xPath("//tbody/tr[" . $row . "]/td[3]//a"))->getAttribute(@onclick); + if (strpos($text, 'banners.unpublish') > 0) + { + $result = 'published'; + } + if (strpos($text, 'banners.publish') > 0) + { + $result = 'unpublished'; + } + return $result; + } + + /** + * Change state of a Banner item in the Banner Manager: Banner Items screen. + * + * @param string $name Banner Title field + * @param string $state State of the Banner + * + * @return void + */ + public function changeBannerState($name, $state = 'published') + { + $this->searchFor($name); + $this->checkAll(); + if (strtolower($state) == 'published') + { + $this->clickButton('toolbar-publish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif (strtolower($state) == 'unpublished') + { + $this->clickButton('toolbar-unpublish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif (strtolower($state) == 'archived') + { + $this->clickButton('toolbar-archive'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + $this->searchFor(); + } +} diff --git a/tests/system/webdriver/Pages/Components/CategoryEditPage.php b/tests/system/webdriver/Pages/Components/CategoryEditPage.php new file mode 100644 index 0000000000000..22de7351d6882 --- /dev/null +++ b/tests/system/webdriver/Pages/Components/CategoryEditPage.php @@ -0,0 +1,90 @@ + 'Title', 'id' => 'jform_title', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Alias', 'id' => 'jform_alias', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Description', 'id' => 'jform_description', 'type' => 'textarea', 'tab' => 'general'), + array('label' => 'Parent', 'id' => 'jform_parent_id', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Status', 'id' => 'jform_published', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Access', 'id' => 'jform_access', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Language', 'id' => 'jform_language', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Tags', 'id' => 'jform_tags', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Note', 'id' => 'jform_note', 'type' => 'input', 'tab' => 'general'), + array('label' => 'Version Note', 'id' => 'jform_version_note', 'type' => 'input', 'tab' => 'general'), + array('label' => 'Created Date', 'id' => 'jform_created_time', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Created By', 'id' => 'jform_created_user_id', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Modified Date', 'id' => 'jform_modified_time', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Modified By', 'id' => 'jform_modified_user_id', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Hits', 'id' => 'jform_hits', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'ID', 'id' => 'jform_id', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Meta Description', 'id' => 'jform_metadesc', 'type' => 'textarea', 'tab' => 'publishing'), + array('label' => 'Meta Keywords', 'id' => 'jform_metakey', 'type' => 'textarea', 'tab' => 'publishing'), + array('label' => 'Author', 'id' => 'jform_metadata_author', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Robots', 'id' => 'jform_metadata_robots', 'type' => 'select', 'tab' => 'publishing'), + array('label' => 'Alternative Layout', 'id' => 'jform_params_category_layout', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Image', 'id' => 'jform_params_image', 'type' => 'input', 'tab' => 'attrib-basic'), + array('label' => 'Alt Text', 'id' => 'jform_params_image_alt', 'type' => 'input', 'tab' => 'attrib-basic'), + ); +} diff --git a/tests/system/webdriver/Pages/Components/CategoryManagerPage.php b/tests/system/webdriver/Pages/Components/CategoryManagerPage.php new file mode 100644 index 0000000000000..a3b797ac894e9 --- /dev/null +++ b/tests/system/webdriver/Pages/Components/CategoryManagerPage.php @@ -0,0 +1,174 @@ + 'list_fullordering', + '20' => 'list_limit', + 'Select Max Levels' => 'filter_level', + 'Select Status' => 'filter_published', + 'Select Access' => 'filter_access', + 'Select Language' => 'filter_language', + 'Select Tag' => 'filter_tag' + ); + + /** + * Array of toolbar id values for this page + * + * @var array + * @since 3.0 + */ + public $toolbar = array ( + 'New' => 'toolbar-new', + 'Edit' => 'toolbar-edit', + 'Publish' => 'toolbar-publish', + 'Unpublish' => 'toolbar-unpublish', + 'Featured' => 'toolbar-featured', + 'Archive' => 'toolbar-archive', + 'Check In' => 'toolbar-checkin', + 'Trash' => 'toolbar-trash', + 'Empty Trash' => 'toolbar-delete', + 'Batch' => 'toolbar-batch', + 'Options' => 'toolbar-options', + 'Help' => 'toolbar-help', + ); + + /** + * Add a new Category item in the Category Manager: Category Manager Screen. + * + * @param string $name Test Category Title + * + * @param string $desc Test Description of Category + * + * @param array $fields Optional associative array of fields to set + * + * @return CategoryManagerPage + */ + public function addCategory($name='ABC Testing', $desc='System Test Category', $fields = array()) + { + $new_name = $name; + $this->clickButton('toolbar-new'); + $categoryEditPage = $this->test->getPageObject('CategoryEditPage'); + $categoryEditPage->setFieldValues(array('Title' => $name, 'Description'=>$desc)); + $categoryEditPage->setFieldValues($fields); + $categoryEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('CategoryManagerPage'); + } + + /** + * Edit a Category item in the Category Manager: Category Manager Screen. + * + * @param string $name Title field + * @param array $fields associative array of fields in the form label => value. + * + * @return void + */ + public function editCategory($name, $fields) + { + $this->clickItem($name); + $categoryEditPage = $this->test->getPageObject('CategoryEditPage'); + $categoryEditPage->setFieldValues($fields); + $categoryEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('CategoryManagerPage'); + $this->searchFor(); + } + + /** + * Get state of a Category in Category Manager: Category Manager Screen. + * + * @param string $name Category Title field + * + * @return State of the Category //Published or Unpublished + */ + public function getState($name) + { + $result = false; + $this->searchFor($name); + $row = $this->getRowNumber($name); + $text = $this->driver->findElement(By::xPath("//tbody/tr[" . $row . "]/td[3]/a"))->getAttribute(@onclick); + if (strpos($text, 'categories.unpublish') > 0) + { + $result = 'published'; + } + if (strpos($text, 'categories.publish') > 0) + { + $result = 'unpublished'; + } + return $result; + } + + /** + * Change state of a Category in Category Manager: Category Manager Screen. + * + * @param string $name Category Title field + * @param string $state State of the Category + * + * @return void + */ + public function changeCategoryState($name, $state = 'published') + { + $this->searchFor($name); + $this->checkAll(); + if (strtolower($state) == 'published') + { + $this->clickButton('toolbar-publish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif (strtolower($state) == 'unpublished') + { + $this->clickButton('toolbar-unpublish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif(strtolower($state) == 'archived') + { + $this->clickButton('toolbar-archive'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + $this->searchFor(); + } + +} diff --git a/tests/system/webdriver/Pages/Components/ContactEditPage.php b/tests/system/webdriver/Pages/Components/ContactEditPage.php new file mode 100644 index 0000000000000..54490e2f9e706 --- /dev/null +++ b/tests/system/webdriver/Pages/Components/ContactEditPage.php @@ -0,0 +1,143 @@ + 'Name', 'id' => 'jform_name', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Alias', 'id' => 'jform_alias', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Linked User', 'id' => 'jform_user_id', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Image', 'id' => 'jform_image', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Position', 'id' => 'jform_con_position', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Email', 'id' => 'jform_email_to', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Address', 'id' => 'jform_address', 'type' => 'textarea', 'tab' => 'details'), + array('label' => 'City or Suburb', 'id' => 'jform_suburb', 'type' => 'input', 'tab' => 'details'), + array('label' => 'State or Province', 'id' => 'jform_state', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Postal/ZIP Code', 'id' => 'jform_postcode', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Country', 'id' => 'jform_country', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Telephone', 'id' => 'jform_telephone', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Mobile', 'id' => 'jform_mobile', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Fax', 'id' => 'jform_fax', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Website', 'id' => 'jform_webpage', 'type' => 'input', 'tab' => 'details'), + array('label' => 'First Sort Field', 'id' => 'jform_sortname1', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Second Sort Field', 'id' => 'jform_sortname2', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Third Sort Field', 'id' => 'jform_sortname3', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Status', 'id' => 'jform_published', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Category', 'id' => 'jform_catid', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Featured', 'id' => 'jform_featured', 'type' => 'fieldset', 'tab' => 'details'), + array('label' => 'Access', 'id' => 'jform_access', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Language', 'id' => 'jform_language', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Tags', 'id' => 'jform_tags', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Version Note', 'id' => 'jform_version_note', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Miscellaneous Information', 'id' => 'jform_misc', 'type' => 'textarea', 'tab' => 'misc'), + array('label' => 'Start Publishing', 'id' => 'jform_publish_up', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Finish Publishing', 'id' => 'jform_publish_down', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Created Date', 'id' => 'jform_created', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Created By', 'id' => 'jform_created_by', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Created By Alias', 'id' => 'jform_created_by_alias', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Modified Date', 'id' => 'jform_modified', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Modified By', 'id' => 'jform_modified_by', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Revision', 'id' => 'jform_version', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Hits', 'id' => 'jform_hits', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'ID', 'id' => 'jform_id', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Meta Description', 'id' => 'jform_metadesc', 'type' => 'textarea', 'tab' => 'publishing'), + array('label' => 'Meta Keywords', 'id' => 'jform_metakey', 'type' => 'textarea', 'tab' => 'publishing'), + array('label' => 'Robots', 'id' => 'jform_metadata_robots', 'type' => 'select', 'tab' => 'publishing'), + array('label' => 'Rights', 'id' => 'jform_metadata_rights', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Show Category', 'id' => 'jform_params_show_contact_category', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Show Contact List', 'id' => 'jform_params_show_contact_list', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Display Format', 'id' => 'jform_params_presentation_style', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Show Tags', 'id' => 'jform_params_show_tags', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Name', 'id' => 'jform_params_show_name', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Contact\'s Position', 'id' => 'jform_params_show_position', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Email', 'id' => 'jform_params_show_email', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Street Address', 'id' => 'jform_params_show_street_address', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'City or Suburb', 'id' => 'jform_params_show_suburb', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'State or County', 'id' => 'jform_params_show_state', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Postal Code', 'id' => 'jform_params_show_postcode', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Country', 'id' => 'jform_params_show_country', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Telephone', 'id' => 'jform_params_show_telephone', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Mobile Phone', 'id' => 'jform_params_show_mobile', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Fax', 'id' => 'jform_params_show_fax', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Webpage', 'id' => 'jform_params_show_webpage', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Misc. Information', 'id' => 'jform_params_show_misc', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Image', 'id' => 'jform_params_show_image', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'vCard', 'id' => 'jform_params_allow_vcard', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Show User Articles', 'id' => 'jform_params_show_articles', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => '# Articles to List', 'id' => 'jform_params_articles_display_num', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Show Profile', 'id' => 'jform_params_show_profile', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Show Links', 'id' => 'jform_params_show_links', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Link A Label', 'id' => 'jform_params_linka_name', 'type' => 'input', 'tab' => 'attrib-display'), + array('label' => 'Link A URL', 'id' => 'jform_params_linka', 'type' => 'input', 'tab' => 'attrib-display'), + array('label' => 'Link B Label', 'id' => 'jform_params_linkb_name', 'type' => 'input', 'tab' => 'attrib-display'), + array('label' => 'Link B URL', 'id' => 'jform_params_linkb', 'type' => 'input', 'tab' => 'attrib-display'), + array('label' => 'Link C Label', 'id' => 'jform_params_linkc_name', 'type' => 'input', 'tab' => 'attrib-display'), + array('label' => 'Link C URL', 'id' => 'jform_params_linkc', 'type' => 'input', 'tab' => 'attrib-display'), + array('label' => 'Link D Label', 'id' => 'jform_params_linkd_name', 'type' => 'input', 'tab' => 'attrib-display'), + array('label' => 'Link D URL', 'id' => 'jform_params_linkd', 'type' => 'input', 'tab' => 'attrib-display'), + array('label' => 'Link E Label', 'id' => 'jform_params_linke_name', 'type' => 'input', 'tab' => 'attrib-display'), + array('label' => 'Link E URL', 'id' => 'jform_params_linke', 'type' => 'input', 'tab' => 'attrib-display'), + array('label' => 'Alternative Layout', 'id' => 'jform_params_contact_layout', 'type' => 'select', 'tab' => 'attrib-display'), + array('label' => 'Show Contact Form', 'id' => 'jform_params_show_email_form', 'type' => 'select', 'tab' => 'attrib-email'), + array('label' => 'Send Copy to Submitter', 'id' => 'jform_params_show_email_copy', 'type' => 'select', 'tab' => 'attrib-email'), + array('label' => 'Banned Email', 'id' => 'jform_params_banned_email', 'type' => 'textarea', 'tab' => 'attrib-email'), + array('label' => 'Banned Subject', 'id' => 'jform_params_banned_subject', 'type' => 'textarea', 'tab' => 'attrib-email'), + array('label' => 'Banned Text', 'id' => 'jform_params_banned_text', 'type' => 'textarea', 'tab' => 'attrib-email'), + array('label' => 'Session Check', 'id' => 'jform_params_validate_session', 'type' => 'select', 'tab' => 'attrib-email'), + array('label' => 'Custom Reply', 'id' => 'jform_params_custom_reply', 'type' => 'select', 'tab' => 'attrib-email'), + array('label' => 'Contact Redirect', 'id' => 'jform_params_redirect', 'type' => 'input', 'tab' => 'attrib-email'), + ); + +} + diff --git a/tests/system/webdriver/Pages/Components/ContactManagerPage.php b/tests/system/webdriver/Pages/Components/ContactManagerPage.php new file mode 100644 index 0000000000000..dfd8d48808f89 --- /dev/null +++ b/tests/system/webdriver/Pages/Components/ContactManagerPage.php @@ -0,0 +1,170 @@ + 'filter_published', + 'Select Category' => 'filter_category_id', + 'Select Access' => 'filter_access', + 'Select Language' => 'filter_language', + 'Select Tags' => 'filter_tag', + ); + + /** + * Array of toolbar id values for this page + * + * @var array + * @since 3.2 + */ + public $toolbar = array ( + 'New' => 'toolbar-new', + 'Edit' => 'toolbar-edit', + 'Publish' => 'toolbar-publish', + 'Unpublish' => 'toolbar-unpublish', + 'Archive' => 'toolbar-archive', + 'Check In' => 'toolbar-check-in', + 'Trash' => 'toolbar-trash', + 'Empty Trash' => 'toolbar-delete', + 'Batch' => 'toolbar-batch', + 'Options' => 'toolbar-options', + 'Help' => 'toolbar-help', + ); + + /** + * Add a new Contact item in the Contact Manager: Component screen. + * + * @param string $name Test Contact Name + * @param array $fields associative array of fields in the form label => value. + * + * @return ContactManagerPage + */ + public function addContact($name='Test Contact', $fields) + { + $new_name = $name; + $login = "testing"; + $this->clickButton('toolbar-new'); + $contactEditPage = $this->test->getPageObject('ContactEditPage'); + $contactEditPage->setFieldValues(array('Name' => $name)); + if ($fields) + { + $contactEditPage->setFieldValues($fields); + } + $contactEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('ContactManagerPage'); + } + + /** + * Edit a Contact item in the Contact Manager: Contact Items screen. + * + * @param string $name Contact Title field + * @param array $fields associative array of fields in the form label => value. + * + * @return void + */ + public function editContact($name, $fields) + { + $this->clickItem($name); + $contactEditPage = $this->test->getPageObject('ContactEditPage'); + $contactEditPage->setFieldValues($fields); + $contactEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('ContactManagerPage'); + $this->searchFor(); + } + + /** + * Get state of a Contact item in the Contact Manager: Contact Items screen. + * + * @param string $name Contact Title field + * + * @return State of the Contact Published or Unpublished + */ + public function getState($name) + { + $result = false; + $row = $this->getRowNumber($name); + $text = $this->driver->findElement(By::xPath("//tbody/tr[" . $row . "]/td[3]//a"))->getAttribute(@onclick); + if (strpos($text, 'contacts.unpublish') > 0) + { + $result = 'published'; + } + if (strpos($text, 'contacts.publish') > 0) + { + $result = 'unpublished'; + } + return $result; + } + + /** + * Change state of a Contact item in the Contact Manager: Contact Items screen. + * + * @param string $name Contact Title field + * @param string $state State of the Contact + * + * @return void + */ + public function changeContactState($name, $state = 'published') + { + $this->searchFor($name); + $this->checkAll(); + if (strtolower($state) == 'published') + { + $this->clickButton('toolbar-publish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif (strtolower($state) == 'unpublished') + { + $this->clickButton('toolbar-unpublish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif (strtolower($state) == 'archived') + { + $this->clickButton('toolbar-archive'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + $this->searchFor(); + } +} diff --git a/tests/system/webdriver/Pages/Components/MessagingEditPage.php b/tests/system/webdriver/Pages/Components/MessagingEditPage.php new file mode 100644 index 0000000000000..3f3dfe522c6f6 --- /dev/null +++ b/tests/system/webdriver/Pages/Components/MessagingEditPage.php @@ -0,0 +1,63 @@ + 'Recipient', 'id' => 'jform_user_id_to', 'type' => 'input', 'tab' => ''), + array('label' => 'Subject', 'id' => 'jform_subject', 'type' => 'input', 'tab' => ''), + array('label' => 'Description', 'id' => 'jform_message_ifr', 'type' => 'textarea', 'tab' => ''), + ); + +} + diff --git a/tests/system/webdriver/Pages/Components/NewsFeedEditPage.php b/tests/system/webdriver/Pages/Components/NewsFeedEditPage.php new file mode 100644 index 0000000000000..c572454dae632 --- /dev/null +++ b/tests/system/webdriver/Pages/Components/NewsFeedEditPage.php @@ -0,0 +1,102 @@ + 'Title', 'id' => 'jform_name', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Alias', 'id' => 'jform_alias', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Link', 'id' => 'jform_link', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Description', 'id' => 'jform_description', 'type' => 'textarea', 'tab' => 'details'), + array('label' => 'Status', 'id' => 'jform_published', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Category', 'id' => 'jform_catid', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Access', 'id' => 'jform_access', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Language', 'id' => 'jform_language', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Tags', 'id' => 'jform_tags', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Version Note', 'id' => 'jform_version_note', 'type' => 'input', 'tab' => 'details'), + array('label' => 'First Image', 'id' => 'jform_images_image_first', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Image Float', 'id' => 'jform_images_float_first', 'type' => 'select', 'tab' => 'images'), + array('label' => 'Alt Text', 'id' => 'jform_images_image_first_alt', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Caption', 'id' => 'jform_images_image_first_caption', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Second Image', 'id' => 'jform_images_image_second', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Image Float', 'id' => 'jform_images_float_second', 'type' => 'select', 'tab' => 'images'), + array('label' => 'Alt Text', 'id' => 'jform_images_image_second_alt', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Caption', 'id' => 'jform_images_image_second_caption', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Start Publishing', 'id' => 'jform_publish_up', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Finish Publishing', 'id' => 'jform_publish_down', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Created Date', 'id' => 'jform_created', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Created By', 'id' => 'jform_created_by', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Author\'s Alias', 'id' => 'jform_created_by_alias', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Modified Date', 'id' => 'jform_modified', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Modified By', 'id' => 'jform_modified_by', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Revision', 'id' => 'jform_version', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'ID', 'id' => 'jform_id', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Meta Description', 'id' => 'jform_metadesc', 'type' => 'textarea', 'tab' => 'publishing'), + array('label' => 'Meta Keywords', 'id' => 'jform_metakey', 'type' => 'textarea', 'tab' => 'publishing'), + array('label' => 'External Reference', 'id' => 'jform_xreference', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Robots', 'id' => 'jform_metadata_robots', 'type' => 'select', 'tab' => 'publishing'), + array('label' => 'Content Rights', 'id' => 'jform_metadata_rights', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Number of Articles', 'id' => 'jform_numarticles', 'type' => 'input', 'tab' => 'attrib-jbasic'), + array('label' => 'Cache Time', 'id' => 'jform_cache_time', 'type' => 'input', 'tab' => 'attrib-jbasic'), + array('label' => 'Language Direction', 'id' => 'jform_rtl', 'type' => 'select', 'tab' => 'attrib-jbasic'), + array('label' => 'Feed Image', 'id' => 'jform_params_show_feed_image', 'type' => 'select', 'tab' => 'attrib-jbasic'), + array('label' => 'Feed Description', 'id' => 'jform_params_show_feed_description', 'type' => 'select', 'tab' => 'attrib-jbasic'), + array('label' => 'Feed Content', 'id' => 'jform_params_show_item_description', 'type' => 'select', 'tab' => 'attrib-jbasic'), + array('label' => 'Characters Count', 'id' => 'jform_params_feed_character_count', 'type' => 'input', 'tab' => 'attrib-jbasic'), + array('label' => 'Alternative Layout', 'id' => 'jform_params_newsfeed_layout', 'type' => 'select', 'tab' => 'attrib-jbasic'), + array('label' => 'Feed Display Order', 'id' => 'jform_params_feed_display_order', 'type' => 'select', 'tab' => 'attrib-jbasic'), + ); + + +} diff --git a/tests/system/webdriver/Pages/Components/NewsFeedManagerPage.php b/tests/system/webdriver/Pages/Components/NewsFeedManagerPage.php new file mode 100644 index 0000000000000..4d180e5605831 --- /dev/null +++ b/tests/system/webdriver/Pages/Components/NewsFeedManagerPage.php @@ -0,0 +1,175 @@ + 'filter_published', + 'Select Category' => 'filter_category_id', + 'Select Access' => 'filter_access', + 'Select Language' => 'filter_language', + 'Select Tags' => 'filter_tag' + ); + + /** + * Array of toolbar id values for this page + * + * @var array + * @since 3.0 + */ + public $toolbar = array ( + 'New' => 'toolbar-new', + 'Edit' => 'toolbar-edit', + 'Publish' => 'toolbar-publish', + 'Unpublish' => 'toolbar-unpublish', + 'Archive' => 'toolbar-archive', + 'Check In' => 'toolbar-check-in', + 'Trash' => 'toolbar-trash', + 'Empty Trash' => 'toolbar-delete', + 'Batch' => 'toolbar-batch', + 'Options' => 'toolbar-options', + 'Help' => 'toolbar-help', + ); + + /** + * Add a new NewsFeed item in the News Feed Manager: Component screen. + * + * @param string $name Test Feed Name + * + * @param string $link Test URL for the News Feed + * + * @param string $category Test Feed Category + * + * @param string $description Test Feed description + * + * @param string $caption Test Feed Image Caption + * + * @param string $alt Test Feed Image Alt + * + * @return NewsFeedManagerPage + */ + public function addFeed($name='Test Tag', $link='administrator/index.php/dummysrc', $category= 'Sample Data-Newsfeeds', $description='Sample', $caption='',$alt='') + { + $new_name = $name; + $this->clickButton('toolbar-new'); + $newsFeedEditPage = $this->test->getPageObject('NewsFeedEditPage'); + $newsFeedEditPage->setFieldValues(array('Title' => $name, 'Link'=> $link, 'Category'=>$category, 'Description'=>$description, 'Caption'=>$caption, 'Alt text'=>$alt)); + $newsFeedEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('NewsFeedManagerPage'); + } + + /** + * Edit a News Feed item in the News Feed Manager: Newsfeed Items screen. + * + * @param string $name Newsfeed Title field + * @param array $fields associative array of fields in the form label => value. + * + * @return void + */ + public function editFeed($name, $fields) + { + $this->clickItem($name); + $newsFeedEditPage = $this->test->getPageObject('NewsFeedEditPage'); + $newsFeedEditPage->setFieldValues($fields); + $newsFeedEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('NewsFeedManagerPage'); + $this->searchFor(); + } + + /** + * Get state of a News Feed in the News Feed Manager: News Feed Items screen. + * + * @param string $name News Feed Title field + * + * @return State of the NewsFeed //Published or Unpublished + */ + public function getState($name) + { + $result = false; + $row = $this->getRowNumber($name); + $text = $this->driver->findElement(By::xPath("//tbody/tr[" . $row . "]/td[3]//a"))->getAttribute(@onclick); + if (strpos($text, 'newsfeeds.unpublish') > 0) + { + $result = 'published'; + } + if (strpos($text, 'newsfeeds.publish') > 0) + { + $result = 'unpublished'; + } + return $result; + } + + /** + * Change state of a News Feed item in the News Feed Manager: News Feed Items screen. + * + * @param string $name News Feed Title field + * @param string $state State of the Feed + * + * @return void + */ + public function changeFeedState($name, $state = 'published') + { + $this->searchFor($name); + $this->checkAll(); + if (strtolower($state) == 'published') + { + $this->clickButton('toolbar-publish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif (strtolower($state) == 'unpublished') + { + $this->clickButton('toolbar-unpublish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif (strtolower($state) == 'archived') + { + $this->clickButton('toolbar-archive'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + $this->searchFor(); + } + +} diff --git a/tests/system/webdriver/Pages/Components/PostinstallPage.php b/tests/system/webdriver/Pages/Components/PostinstallPage.php new file mode 100644 index 0000000000000..aea1fec911956 --- /dev/null +++ b/tests/system/webdriver/Pages/Components/PostinstallPage.php @@ -0,0 +1,41 @@ +driver->findElements(By::xPath("//a[contains(text(), 'Hide this message')]")); + while (count($clearButtons) > 0) + { + $clearButtons[0]->click(); + $page = $this->test->getPageObject('PostinstallPage'); + $clearButtons = $this->driver->findElements(By::xPath("//a[contains(text(), 'Hide this message')]")); + } + + } + +} \ No newline at end of file diff --git a/tests/system/webdriver/Pages/Components/RedirectEditPage.php b/tests/system/webdriver/Pages/Components/RedirectEditPage.php new file mode 100644 index 0000000000000..71e2b5501048f --- /dev/null +++ b/tests/system/webdriver/Pages/Components/RedirectEditPage.php @@ -0,0 +1,77 @@ + 'Source URL', 'id' => 'jform_old_url', 'type' => 'input', 'tab' => 'basic'), + array('label' => 'Destination URL', 'id' => 'jform_new_url', 'type' => 'input', 'tab' => 'basic'), + array('label' => 'Status', 'id' => 'jform_published', 'type' => 'select', 'tab' => 'basic'), + array('label' => 'Comment', 'id' => 'jform_comment', 'type' => 'input', 'tab' => 'basic'), + array('label' => 'ID', 'id' => 'jform_id', 'type' => 'input', 'tab' => 'basic'), + array('label' => 'Created Date', 'id' => 'jform_created_date', 'type' => 'input', 'tab' => 'basic'), + array('label' => 'Last Updated Date', 'id' => 'jform_modified_date', 'type' => 'input', 'tab' => 'basic'), + + ); + + +} diff --git a/tests/system/webdriver/Pages/Components/RedirectManagerPage.php b/tests/system/webdriver/Pages/Components/RedirectManagerPage.php new file mode 100644 index 0000000000000..d48c5db3aa413 --- /dev/null +++ b/tests/system/webdriver/Pages/Components/RedirectManagerPage.php @@ -0,0 +1,166 @@ + 'filter_state', + ); + + /** + * Array of toolbar id values for this page + * + * @var array + * @since 3.0 + */ + public $toolbar = array ( + 'New' => 'toolbar-new', + 'Edit' => 'toolbar-edit', + 'Enable' => 'toolbar-publish', + 'Disable' => 'toolbar-unpublish', + 'Archive' => 'toolbar-archive', + 'Trash' => 'toolbar-trash', + 'Options' => 'toolbar-options', + 'Help' => 'toolbar-help', + 'Empty Trash' => 'toolbar-delete', + ); + + /** + * Add a new Redirect item in the Redirect Manager: Component screen. + * + * @param string $srcLink Test Source Link + * + * @param string $desLink Test Destination Link + * + * @param string $status Status for the Redirect + * + * @param string $comment Comments on the Redirection + * + * @return RedirectManagerPage + */ + public function addRedirect($srcLink='administrator/index.php/dummysrc', $desLink='administrator/index.php/dummydest', $status='Enabled', $comments='') + { + $this->clickButton('toolbar-new'); + $redirectEditPage = $this->test->getPageObject('RedirectEditPage'); + $redirectEditPage->setFieldValues(array('Source URL' => $srcLink, 'Destination URL' => $desLink, 'Status' => $status, 'Comment' => $comments)); + $redirectEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('RedirectManagerPage'); + } + + /** + * Edit a Redirect item in the Redirect Manager: Redirect Items screen. + * + * @param string $src Link Src Field + * @param array $fields associative array of fields in the form label => value. + * + * @return void + */ + public function editRedirect($src, $fields) + { + $this->clickItem($src); + $redirectEditPage = $this->test->getPageObject('RedirectEditPage'); + $redirectEditPage->setFieldValues($fields); + $redirectEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('RedirectManagerPage'); + $this->searchFor(); + } + + /** + * Get state of a Redirect in the Redirect Manager: Redirect Items screen. + * + * @param string $src Redirect Src field + * + * @return State of the Redirect Link //Enabled or Disabled which is equvalent to publish and unpublish at backend + */ + public function getState($src) + { + $result = false; + $row = $this->getRowNumber($src); + $text = $this->driver->findElement(By::xPath("//tbody/tr[" . $row . "]/td[2]/a"))->getAttribute(@onclick); + if (strpos($text, 'links.unpublish') > 0) + { + $result = 'published'; + } + if (strpos($text, 'links.publish') > 0) + { + $result = 'unpublished'; + } + return $result; + } + + /** + * Change state of a Redirect link item in the Redirect Manager: Redirect Items screen. + * + * @param string $src Redirect link SRC field + * @param string $state State of the Link + * + * @return void + */ + public function changeRedirectState($src, $state = 'published') + { + $this->searchFor($src); + $rowNumber = $this->getRowNumber($src) - 1; + $this->driver->findElement(By::xPath("//input[@id='cb" . $rowNumber ."']"))->click(); + if (strtolower($state) == 'published') + { + $this->clickButton('toolbar-publish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif (strtolower($state) == 'unpublished') + { + $this->clickButton('toolbar-unpublish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif (strtolower($state) == 'archived') + { + $this->clickButton('toolbar-archive'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + $this->searchFor(); + } + + +} diff --git a/tests/system/webdriver/Pages/Components/TagEditPage.php b/tests/system/webdriver/Pages/Components/TagEditPage.php new file mode 100644 index 0000000000000..03e71c86471af --- /dev/null +++ b/tests/system/webdriver/Pages/Components/TagEditPage.php @@ -0,0 +1,91 @@ + 'Title', 'id' => 'jform_title', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Alias', 'id' => 'jform_alias', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Description', 'id' => 'jform_description', 'type' => 'textarea', 'tab' => 'details'), + array('label' => 'Parent', 'id' => 'jform_parent_id', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Status', 'id' => 'jform_published', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Access', 'id' => 'jform_access', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Language', 'id' => 'jform_language', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Note', 'id' => 'jform_note', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Version Note', 'id' => 'jform_version_note', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Created Date', 'id' => 'jform_created_time', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Created By', 'id' => 'jform_created_user_id', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Author\'s Alias', 'id' => 'jform_created_by_alias', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Modified Date', 'id' => 'jform_modified_time', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Modified By', 'id' => 'jform_modified_user_id', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Hits', 'id' => 'jform_hits', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'ID', 'id' => 'jform_id', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Meta Description', 'id' => 'jform_metadesc', 'type' => 'textarea', 'tab' => 'publishing'), + array('label' => 'Meta Keywords', 'id' => 'jform_metakey', 'type' => 'textarea', 'tab' => 'publishing'), + array('label' => 'Author', 'id' => 'jform_metadata_author', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Robots', 'id' => 'jform_metadata_robots', 'type' => 'select', 'tab' => 'publishing'), + array('label' => 'Alternative Layout', 'id' => 'jform_params_tag_layout', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'CSS Class for tag link.', 'id' => 'jform_params_tag_link_class', 'type' => 'input', 'tab' => 'attrib-basic'), + array('label' => 'Teaser Image.', 'id' => 'jform_images_image_intro', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Float', 'id' => 'jform_images_float_intro', 'type' => 'select', 'tab' => 'images'), + array('label' => 'Alt', 'id' => 'jform_images_image_intro_alt', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Caption', 'id' => 'jform_images_image_intro_caption', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Full Image', 'id' => 'jform_images_image_fulltext', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Float', 'id' => 'jform_images_float_fulltext', 'type' => 'select', 'tab' => 'images'), + array('label' => 'Alt', 'id' => 'jform_images_image_fulltext_alt', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Caption', 'id' => 'jform_images_image_fulltext_caption', 'type' => 'input', 'tab' => 'images'), + ); + +} + diff --git a/tests/system/webdriver/Pages/Components/TagManagerPage.php b/tests/system/webdriver/Pages/Components/TagManagerPage.php new file mode 100644 index 0000000000000..a7fdc5363fa9f --- /dev/null +++ b/tests/system/webdriver/Pages/Components/TagManagerPage.php @@ -0,0 +1,170 @@ + 'filter_published', + 'Select Access' => 'filter_access', + 'Select Language' => 'filter_language', + ); + + /** + * Array of toolbar id values for this page + * + * @var array + * @since 3.0 + */ + public $toolbar = array ( + 'New' => 'toolbar-new', + 'Edit' => 'toolbar-edit', + 'Publish' => 'toolbar-publish', + 'Unpublish' => 'toolbar-unpublish', + 'Archive' => 'toolbar-archive', + 'Check In' => 'toolbar-check-in', + 'Trash' => 'toolbar-trash', + 'Empty Trash' => 'toolbar-delete', + 'Batch' => 'toolbar-batch', + 'Options' => 'toolbar-options', + 'Help' => 'toolbar-help', + ); + + /** + * Add a new Tag item in the Tag Manager: Component screen. + * + * @param string $name Test Tag Name + * + * @param string $caption Caption of the test Image + * + * @param string $alt Alternative Caption for the Image + * + * @param string $float Position of the Image of the tag + * + * @return TagManagerPage + */ + public function addTag($name='Test Tag', $caption='sample', $alt='Sample_Alt', $float='Use Global') + { + $new_name = $name; + $login = "testing"; + $this->clickButton('toolbar-new'); + $tagEditPage = $this->test->getPageObject('TagEditPage'); + $tagEditPage->setFieldValues(array('Title' => $name, 'Caption' => $caption, 'Alt'=>$alt,'Float'=>$float)); + $tagEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('TagManagerPage'); + } + + /** + * Edit a Tag item in the Tag Manager: Tag Items screen. + * + * @param string $name Tag Title field + * @param array $fields associative array of fields in the form label => value. + * + * @return void + */ + public function editTag($name, $fields) + { + $this->clickItem($name); + $tagEditPage = $this->test->getPageObject('TagEditPage'); + $tagEditPage->setFieldValues($fields); + $tagEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('TagManagerPage'); + $this->searchFor(); + } + + /** + * Get state of a Tag item in the Tag Manager: Tag Items screen. + * + * @param string $name Tag Title field + * + * @return State of the Tag //Published or Unpublished + */ + public function getState($name) + { + $result = false; + $row = $this->getRowNumber($name); + $text = $this->driver->findElement(By::xPath("//tbody/tr[" . $row . "]/td[3]//a"))->getAttribute(@onclick); + if (strpos($text, 'tags.unpublish') > 0) + { + $result = 'published'; + } + if (strpos($text, 'tags.publish') > 0) + { + $result = 'unpublished'; + } + return $result; + } + + /** + * Change state of a Tag item in the Tag Manager: Tag Items screen. + * + * @param string $name Tag Title field + * @param string $state State of the Tag + * + * @return void + */ + public function changeTagState($name, $state = 'published') + { + $this->searchFor($name); + $this->checkAll(); + if (strtolower($state) == 'published') + { + $this->clickButton('toolbar-publish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif (strtolower($state) == 'unpublished') + { + $this->clickButton('toolbar-unpublish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif (strtolower($state) == 'archived') + { + $this->clickButton('toolbar-archive'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + $this->searchFor(); + } + +} diff --git a/tests/system/webdriver/Pages/Components/WeblinkEditPage.php b/tests/system/webdriver/Pages/Components/WeblinkEditPage.php new file mode 100644 index 0000000000000..829a94eb01dab --- /dev/null +++ b/tests/system/webdriver/Pages/Components/WeblinkEditPage.php @@ -0,0 +1,97 @@ + 'Title', 'id' => 'jform_title', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Alias', 'id' => 'jform_alias', 'type' => 'input', 'tab' => 'header'), + array('label' => 'URL', 'id' => 'jform_url', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Description', 'id' => 'jform_description', 'type' => 'textarea', 'tab' => 'details'), + array('label' => 'Category', 'id' => 'jform_catid', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Tags', 'id' => 'jform_tags', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Status', 'id' => 'jform_state', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Access', 'id' => 'jform_access', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Language', 'id' => 'jform_language', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Version Note', 'id' => 'jform_version_note', 'type' => 'input', 'tab' => 'details'), + array('label' => 'First image', 'id' => 'jform_images_image_first', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Image Float', 'id' => 'jform_images_float_first', 'type' => 'select', 'tab' => 'images'), + array('label' => 'Alt text', 'id' => 'jform_images_image_first_alt', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Caption', 'id' => 'jform_images_image_first_caption', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Second image', 'id' => 'jform_images_image_second', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Image Float', 'id' => 'jform_images_float_second', 'type' => 'select', 'tab' => 'images'), + array('label' => 'Alt text', 'id' => 'jform_images_image_second_alt', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Caption', 'id' => 'jform_images_image_second_caption', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Start Publishing', 'id' => 'jform_publish_up', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Finish Publishing', 'id' => 'jform_publish_down', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Created Date', 'id' => 'jform_created', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Created by', 'id' => 'jform_created_by', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Author\'s Alias', 'id' => 'jform_created_by_alias', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Modified Date', 'id' => 'jform_modified', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Modified by', 'id' => 'jform_modified_by', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Revision', 'id' => 'jform_version', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Hits', 'id' => 'jform_hits', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'ID', 'id' => 'jform_id', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Meta Description', 'id' => 'jform_metadesc', 'type' => 'textarea', 'tab' => 'publishing'), + array('label' => 'Meta Keywords', 'id' => 'jform_metakey', 'type' => 'textarea', 'tab' => 'publishing'), + array('label' => 'External Reference', 'id' => 'jform_xreference', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Robots', 'id' => 'jform_metadata_robots', 'type' => 'select', 'tab' => 'publishing'), + array('label' => 'Content Rights', 'id' => 'jform_metadata_rights', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Target', 'id' => 'jform_params_target', 'type' => 'select', 'tab' => 'attrib-jbasic'), + array('label' => 'Width', 'id' => 'jform_params_width', 'type' => 'input', 'tab' => 'attrib-jbasic'), + array('label' => 'Height', 'id' => 'jform_params_height', 'type' => 'input', 'tab' => 'attrib-jbasic'), + array('label' => 'Count Clicks', 'id' => 'jform_params_count_clicks', 'type' => 'select', 'tab' => 'attrib-jbasic'), ); + +} + diff --git a/tests/system/webdriver/Pages/Components/WeblinkManagerPage.php b/tests/system/webdriver/Pages/Components/WeblinkManagerPage.php new file mode 100644 index 0000000000000..fbc9d9deaac3f --- /dev/null +++ b/tests/system/webdriver/Pages/Components/WeblinkManagerPage.php @@ -0,0 +1,163 @@ + 'filter_state', + 'Select Category' => 'filter_category_id', + 'Select Access' => 'filter_access', + 'Select Language' => 'filter_language', + 'Select Tag' => 'filter_tag', + ); + + /** + * Array of toolbar id values for this page + * + * @var array + * @since 3.2 + */ + public $toolbar = array ( + 'New' => 'toolbar-new', + 'Edit' => 'toolbar-edit', + 'Publish' => 'toolbar-publish', + 'Unpublish' => 'toolbar-unpublish', + 'Archive' => 'toolbar-archive', + 'Check In' => 'toolbar-check-in', + 'Trash' => 'toolbar-trash', + 'Empty Trash' => 'toolbar-delete', + 'Batch' => 'toolbar-batch', + 'Options' => 'toolbar-options', + 'Help' => 'toolbar-help', + ); + + /** + * Add a new Weblink item in the Weblink Manager: Component screen. + * + * @param string $name Test Weblink Name + * @param array $fields associative array of fields in the form label => value. + * + * @return WeblinkManagerPage + */ + public function addWeblink($name='Test Weblink', $url, $fields) + { + $this->clickButton('toolbar-new'); + $contactEditPage = $this->test->getPageObject('WeblinkEditPage'); + $contactEditPage->setFieldValues(array('Title' => $name, 'URL' => $url)); + if ($fields) + { + $contactEditPage->setFieldValues($fields); + } + $contactEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('WeblinkManagerPage'); + } + + /** + * Edit a Weblink item in the Weblink Manager: Weblink Items screen. + * + * @param string $name Weblink Title field + * @param array $fields associative array of fields in the form label => value. + * + * @return void + */ + public function editWeblink($name, $fields) + { + $this->clickItem($name); + $contactEditPage = $this->test->getPageObject('WeblinkEditPage'); + $contactEditPage->setFieldValues($fields); + $contactEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('WeblinkManagerPage'); + $this->searchFor(); + } + + /** + * Get state of a Weblink item in the Weblink Manager: Weblink Items screen. + * + * @param string $name Weblink Title field + * + * @return State of the Weblink //Published or Unpublished + */ + public function getState($name) + { + $result = false; + $row = $this->getRowNumber($name); + $text = $this->driver->findElement(By::xPath("//tbody/tr[" . $row . "]/td[3]//a"))->getAttribute(@onclick); + if (strpos($text, 'weblinks.unpublish') > 0) + { + $result = 'published'; + } + if (strpos($text, 'weblinks.publish') > 0) + { + $result = 'unpublished'; + } + return $result; + } + + /** + * Change state of a Weblink item in the Weblink Manager: Weblink Items screen. + * + * @param string $name Weblink Title field + * @param string $state State of the Weblink + * + * @return void + */ + public function changeWeblinkState($name, $state = 'published') + { + $this->searchFor($name); + $this->checkAll(); + if (strtolower($state) == 'published') + { + $this->clickButton('toolbar-publish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif (strtolower($state) == 'unpublished') + { + $this->clickButton('toolbar-unpublish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + $this->searchFor(); + } +} diff --git a/tests/system/webdriver/Pages/Content/ArticleEditPage.php b/tests/system/webdriver/Pages/Content/ArticleEditPage.php new file mode 100644 index 0000000000000..3cebfb6b25132 --- /dev/null +++ b/tests/system/webdriver/Pages/Content/ArticleEditPage.php @@ -0,0 +1,166 @@ + 'Title', 'id' => 'jform_title', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Alias', 'id' => 'jform_alias', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Category', 'id' => 'jform_catid', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Tags', 'id' => 'jform_tags', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Status', 'id' => 'jform_state', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Featured', 'id' => 'jform_featured', 'type' => 'fieldset', 'tab' => 'general'), + array('label' => 'Access', 'id' => 'jform_access', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Language', 'id' => 'jform_language', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Version Note', 'id' => 'jform_version_note', 'type' => 'input', 'tab' => 'general'), + array('label' => 'articletext', 'id' => 'jform_articletext', 'type' => 'textarea', 'tab' => 'general'), + array('label' => 'Start Publishing', 'id' => 'jform_publish_up', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Finish Publishing', 'id' => 'jform_publish_down', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Created Date', 'id' => 'jform_created', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Created by', 'id' => 'jform_created_by', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Created by alias', 'id' => 'jform_created_by_alias', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Modified Date', 'id' => 'jform_modified', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Modified by', 'id' => 'jform_modified_by', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Revision', 'id' => 'jform_version', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Hits', 'id' => 'jform_hits', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'ID', 'id' => 'jform_id', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Meta Description', 'id' => 'jform_metadesc', 'type' => 'textarea', 'tab' => 'publishing'), + array('label' => 'Meta Keywords', 'id' => 'jform_metakey', 'type' => 'textarea', 'tab' => 'publishing'), + array('label' => 'Key Reference', 'id' => 'jform_xreference', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Robots', 'id' => 'jform_metadata_robots', 'type' => 'select', 'tab' => 'publishing'), + array('label' => 'Author', 'id' => 'jform_metadata_author', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Content Rights', 'id' => 'jform_metadata_rights', 'type' => 'textarea', 'tab' => 'publishing'), + array('label' => 'External Reference', 'id' => 'jform_metadata_xreference', 'type' => 'input', 'tab' => 'publishing'), + array('label' => 'Intro Image', 'id' => 'jform_images_image_intro', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Image Float', 'id' => 'jform_images_float_intro', 'type' => 'select', 'tab' => 'images'), + array('label' => 'Alt text', 'id' => 'jform_images_image_intro_alt', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Caption', 'id' => 'jform_images_image_intro_caption', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Full article image', 'id' => 'jform_images_image_fulltext', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Image Float', 'id' => 'jform_images_float_fulltext', 'type' => 'select', 'tab' => 'images'), + array('label' => 'Alt text', 'id' => 'jform_images_image_fulltext_alt', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Caption', 'id' => 'jform_images_image_fulltext_caption', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Link A', 'id' => 'jform_urls_urla', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Link A Text', 'id' => 'jform_urls_urlatext', 'type' => 'input', 'tab' => 'images'), + array('label' => 'URL Target Window', 'id' => 'jform_urls_targeta', 'type' => 'select', 'tab' => 'images'), + array('label' => 'Link B', 'id' => 'jform_urls_urlb', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Link B Text', 'id' => 'jform_urls_urlbtext', 'type' => 'input', 'tab' => 'images'), + array('label' => 'URL Target Window', 'id' => 'jform_urls_targetb', 'type' => 'select', 'tab' => 'images'), + array('label' => 'Link C', 'id' => 'jform_urls_urlc', 'type' => 'input', 'tab' => 'images'), + array('label' => 'Link C Text', 'id' => 'jform_urls_urlctext', 'type' => 'input', 'tab' => 'images'), + array('label' => 'URL Target Window', 'id' => 'jform_urls_targetc', 'type' => 'select', 'tab' => 'images'), + array('label' => 'Show Title', 'id' => 'jform_attribs_show_title', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Linked Titles', 'id' => 'jform_attribs_link_titles', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Show Tags', 'id' => 'jform_attribs_show_tags', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Show Intro Text', 'id' => 'jform_attribs_show_intro', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Position of Article Info', 'id' => 'jform_attribs_info_block_position', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Show Category', 'id' => 'jform_attribs_show_category', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Link Category', 'id' => 'jform_attribs_link_category', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Show Parent', 'id' => 'jform_attribs_show_parent_category', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Link Parent', 'id' => 'jform_attribs_link_parent_category', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Show Author', 'id' => 'jform_attribs_show_author', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Link Author', 'id' => 'jform_attribs_link_author', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Show Create Date', 'id' => 'jform_attribs_show_create_date', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Show Modify Date', 'id' => 'jform_attribs_show_modify_date', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Show Publish Date', 'id' => 'jform_attribs_show_publish_date', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Show Navigation', 'id' => 'jform_attribs_show_item_navigation', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Show Icons', 'id' => 'jform_attribs_show_icons', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Show Print Icon', 'id' => 'jform_attribs_show_print_icon', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Show Email Icon', 'id' => 'jform_attribs_show_email_icon', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Show Voting', 'id' => 'jform_attribs_show_vote', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Show Hits', 'id' => 'jform_attribs_show_hits', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Show Unauthorised Links', 'id' => 'jform_attribs_show_noauth', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Positioning of the Links', 'id' => 'jform_attribs_urls_position', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Read More Text', 'id' => 'jform_attribs_alternative_readmore', 'type' => 'input', 'tab' => 'attrib-basic'), + array('label' => 'Alternative Layout', 'id' => 'jform_attribs_article_layout', 'type' => 'select', 'tab' => 'attrib-basic'), + array('label' => 'Show Publishing Options', 'id' => 'jform_attribs_show_publishing_options', 'type' => 'select', 'tab' => 'editor'), + array('label' => 'Show Article Options', 'id' => 'jform_attribs_show_article_options', 'type' => 'select', 'tab' => 'editor'), + array('label' => 'Administrator Images and Links', 'id' => 'jform_attribs_show_urls_images_backend', 'type' => 'select', 'tab' => 'editor'), + array('label' => 'Frontend Images and Links', 'id' => 'jform_attribs_show_urls_images_frontend', 'type' => 'select', 'tab' => 'editor'), + ); + + /** + * function to add test to the article\ + * + * @param String $text text to be writen in the article + * + * @return void + */ + public function addArticleText($text) + { + $values = array('id' => 'jform_articletext', 'value' => $text); + $this->setTextAreaValues($values); + } + + /** + * function to set the field values + * + * @param array $array array stores the value of the different input fields + * + * @return void + */ + public function setFieldValues($array) + { + if (isset($array['text'])) + { + $this->addArticleText($array['text']); + unset($array['text']); + } + + if (count($array) > 0) + { + parent::setFieldValues($array); + } + + } +} diff --git a/tests/system/webdriver/Pages/Content/ArticleManagerPage.php b/tests/system/webdriver/Pages/Content/ArticleManagerPage.php new file mode 100644 index 0000000000000..c8439cb57dc1f --- /dev/null +++ b/tests/system/webdriver/Pages/Content/ArticleManagerPage.php @@ -0,0 +1,334 @@ + 'list_fullordering', + '20' => 'list_limit', + 'Select Status' => 'filter_published', + 'Select Category' => 'filter_category_id', + 'Select Max Levels' => 'filter_level', + 'Select Access' => 'filter_access', + 'Select Author' => 'filter_author_id', + 'Select Language' => 'filter_language', + 'Select Tag' => 'filter_tag' + ); + + /** + * Array of toolbar id values for this page + * + * @var array + * @since 3.0 + */ + public $toolbar = array ( + 'New' => 'toolbar-new', + 'Edit' => 'toolbar-edit', + 'Publish' => 'toolbar-publish', + 'Unpublish' => 'toolbar-unpublish', + 'Featured' => 'toolbar-featured', + 'Archive' => 'toolbar-archive', + 'Check In' => 'toolbar-checkin', + 'Trash' => 'toolbar-trash', + 'Empty Trash' => 'toolbar-delete', + 'Batch' => 'toolbar-batch', + 'Options' => 'toolbar-options', + 'Help' => 'toolbar-help', + ); + + /** + * Add a new Article item in the Article Manager: Article Manager Screen. + * + * @param string $name Test Article Title + * + * @param string $category Test Article Category + * + * @return ArticleManagerPage + */ + public function addArticle($name = 'Testing Articles', $category = 'Sample Data-Articles', $otherFields = array()) + { + $new_name = $name; + $this->clickButton('toolbar-new'); + $articleEditPage = $this->test->getPageObject('ArticleEditPage'); + $articleEditPage->setFieldValues(array( + 'Title' => $name, + 'Category' => $category + )); + + if (count($otherFields > 0)) + { + $articleEditPage->setFieldValues($otherFields); + } + + $articleEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('ArticleManagerPage'); + } + + /** + * Edit an Article item in the Article Manager: Article Manager Screen. + * + * @param string $name Title field + * @param array $fields associative array of fields in the form label => value. + * + * @return void + */ + public function editArticle($name, $fields = array()) + { + $this->clickItem($name); + $articleEditPage = $this->test->getPageObject('ArticleEditPage'); + $articleEditPage->setFieldValues($fields); + $articleEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('ArticleManagerPage'); + $this->searchFor(); + } + + /** + * Get state of an Article in Article Manager Screen: Article Manager. + * + * @param string $name Article Title field + * + * @return State of the Article //Published or Unpublished + */ + public function getState($name) + { + $this->setFilter('Select Status', 'All'); + $this->searchFor($name); + $row = $this->getRowNumber($name); + $text = $this->driver->findElement(By::xPath("//tbody/tr[" . $row . "]/td[3]/div/a/i[1]"))->getAttribute('class'); + + switch ($text) + { + case 'icon-publish': + $result = 'published'; + break; + + case 'icon-unpublish': + $result = 'unpublished'; + break; + + case 'icon-archive': + $result = 'archived'; + break; + + default: + $result = false; + } + + $this->searchFor(); + + return $result; + } + + /** + * Change state of an Article Item in Article Manager Screen + * + * @param string $name Article Title field + * @param string $state State of the Article + * + * @return void + */ + public function changeArticleState($name, $state = 'published') + { + $this->setFilter('Status', 'All'); + $this->searchFor($name); + $this->checkAll(); + + if (strtolower($state) == 'published') + { + $this->clickButton('toolbar-publish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif (strtolower($state) == 'unpublished') + { + $this->clickButton('toolbar-unpublish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif(strtolower($state) == 'archived') + { + $container = $this->driver->findElement(By::xPath("//tr[@class='row0']/td[3]/div[@class='btn-group']/button")); + $container->click(); + $el = $this->driver->findElement(By::xPath("//li/a[contains(@onclick, 'articles.archive')]")); + $el->click(); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif(strtolower($state) == 'trashed') + { + $this->clickButton('toolbar-trash'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + + $this->searchFor(); + } + + /** + * change the Filter state for the page + * + * @param string $label Filter Label which is to be changed + * @param string $value Value to which the filter is to be changed + * + * @return void + */ + public function changeFilter($label, $value) + { + $this->setFilter($label, $value); + } + + /** + * get access level of article + * + * @param string $name Article Title field + * + * @return accesslevel + */ + public function getAccessLevel($name) + { + $this->searchFor($name); + $row = $this->getRowNumber($name); + $text = $this->driver->findElement(By::xPath("//tbody/tr[" . $row . "]/td[5]"))->getText(); + $this->searchFor(); + + return $text; + } + + /** + * Change access level of article + * + * @param string $name Article Title field + * @param string $accessLevel Desired Access level to which we want it to change to + * + * @return void + */ + public function changeAccessLevel($name, $accessLevel) + { + $this->searchFor($name); + $this->checkAll(); + $this->clickButton('toolbar-batch'); + $this->driver->waitForElementUntilIsPresent(By::xPath("//div[@class='modal hide fade in']")); + $this->driver->findElement(By::xPath("//div[@id='batch_access_chzn']/a"))->click(); + $this->driver->findElement(By::xPath("//div[@id='batch_access_chzn']//ul[@class='chzn-results']/li[contains(.,'" . $accessLevel . "')]"))->click(); + $this->driver->findElement(By::xPath("//button[contains(text(),'Process')]"))->click(); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + $this->searchFor(); + } + + /** + * Fetch Category of Article + * + * @param string $name Article Name for which the Categoory is to be Returned + * + * @return categoryName + */ + public function getCategoryName($name) + { + $this->searchFor($name); + $row = $this->getRowNumber($name); + $categoryName = $this->driver->findElement(By::xPath("//tbody/tr[" . $row . "]/td[4]/div/div[@class = 'small']"))->getText(); + + return $categoryName; + } + + /** + * Function that does Batch Process for Articles, Copy, Move articles + * + * @param string $articleName Article for which Batch Processing is to be done + * @param string $searchString Value entered in the drop down to filter the results + * @param string $newCategory Category to which the Article is to be moved or copied + * @param string $action Action to be taken, either Move or Copy + * + * @return void + */ + public function doBatchAction($articleName, $searchString, $newCategory, $action) + { + $this->searchFor($articleName); + $row = $this->getRowNumber($articleName); + $this->driver->findElement(By::xPath("//input[@id='cb" . ($row - 1) . "']"))->click(); + $this->clickButton('toolbar-batch'); + $this->driver->waitForElementUntilIsPresent(By::xPath("//div[@class='modal hide fade in']")); + $this->driver->findElement(By::xPath("//div[@id='batch_category_id_chzn']/a"))->click(); + $this->driver->findElement(By::xPath("//div[@id='batch_category_id_chzn']/div/div/input"))->sendKeys($searchString); + $this->driver->findElement(By::xPath("//div[@id='batch_category_id_chzn']//ul[@class = 'chzn-results']/li[contains(.,'" . $newCategory . "')]"))->click(); + + if (strtolower($action) == 'copy') + { + $this->driver->findElement(By::xPath("//input[@id='batch[move_copy]c']"))->click(); + } + else + { + $this->driver->findElement(By::XPath("//input[@id='batch[move_copy]m']"))->click(); + } + + $this->driver->findElement(By::xPath("//button[contains(text(),'Process')]"))->click(); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + + /** + * change the Category Filter from Article Manager Page + * + * @param string $category Name of the Category to which the filter is to be set to + * + * @return void + */ + public function changeCategoryFilter($category = 'Select Category') + { + $filterElement = $this->driver->findElement(By::xPath("//div[@id='filter_category_id_chzn']/a")); + + if (! $filterElement->isDisplayed()) + { + $elements = $this->driver->findElements(By::xPath("//button[contains(., 'Search tools')]")); + + if (isset($elements[0])) + { + $elements[0]->click(); + sleep(3); + } + } + + $filterElement->click(); + $this->driver->findElement(By::xPath("//div[@id='filter_category_id_chzn']/div/div/input"))->sendKeys(substr($category, 0, 2)); + $this->driver->findElement(By::xPath("//div[@id='filter_category_id_chzn']//ul[@class='chzn-results']/li[contains(.,'" . $category . "')]"))->click(); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } +} diff --git a/tests/system/webdriver/Pages/Extensions/LanguageEditPage.php b/tests/system/webdriver/Pages/Extensions/LanguageEditPage.php new file mode 100644 index 0000000000000..cb813232e1974 --- /dev/null +++ b/tests/system/webdriver/Pages/Extensions/LanguageEditPage.php @@ -0,0 +1,79 @@ + 'Title', 'id' => 'jform_title', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Title Native', 'id' => 'jform_title_native', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Language Tag', 'id' => 'jform_lang_code', 'type' => 'input', 'tab' => 'details'), + array('label' => 'URL Language Code', 'id' => 'jform_sef', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Image Prefix', 'id' => 'jform_image', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Status', 'id' => 'jform_published', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Access', 'id' => 'jform_access', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Description', 'id' => 'jform_description', 'type' => 'textarea', 'tab' => 'details'), + array('label' => 'ID', 'id' => 'jform_lang_id', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Meta Keywords', 'id' => 'jform_metakey', 'type' => 'textarea', 'tab' => 'metadata'), + array('label' => 'Meta Description', 'id' => 'jform_metadesc', 'type' => 'textarea', 'tab' => 'metadata'), + array('label' => 'Custom Site Name', 'id' => 'jform_sitename', 'type' => 'input', 'tab' => 'site_name'), + ); +} diff --git a/tests/system/webdriver/Pages/Extensions/LanguageManagerPage.php b/tests/system/webdriver/Pages/Extensions/LanguageManagerPage.php new file mode 100644 index 0000000000000..58bf1bf8b5e59 --- /dev/null +++ b/tests/system/webdriver/Pages/Extensions/LanguageManagerPage.php @@ -0,0 +1,168 @@ + 'filter_published', + 'Select Access' => 'filter_access', + ); + + /** + * Array of toolbar id values for this page + * + * @var array + * @since 3.0 + */ + public $toolbar = array ( + 'New' => 'toolbar-new', + 'Edit' => 'toolbar-edit', + 'Publish' => 'toolbar-publish', + 'Unpublish' => 'toolbar-unpublish', + 'Trash' => 'toolbar-trash', + 'Install Language' => 'toolbar-upload', + 'Empty Trash' => 'toolbar-delete', + 'Options' => 'toolbar-options', + 'Help' => 'toolbar-help', + ); + + /** + * Add a new Language item in the Language Manager: Component screen. + * + * @param string $title Test Language Name + * + * @param string $native_title Native Title for the Test Language + * + * @param string $url URL for the Test Language + * + * @param string $image_prefix image prefix for the test Language + * + * @param string $language_tag Tag for the test language + * + * @return LanguageManagerPage + */ + public function addLanguage($title='Test Lang', $native_title='Default', $url='Default', $image_prefix='us', $language_tag='Default') + { + $new_name = $title; + $this->clickButton('toolbar-new'); + $languageEditPage = $this->test->getPageObject('LanguageEditPage'); + $languageEditPage->setFieldValues(array('Title' => $title, 'Title Native' => $native_title, 'URL Language Code' => $url, 'Image Prefix' => $image_prefix, 'Language Tag' => $language_tag)); + $languageEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('LanguageManagerPage'); + + } + + /** + * Edit a Language Content item in the Language Manager: Language-Content Screen Items screen. + * + * @param string $name Language Title field + * @param array $fields associative array of fields in the form label => value. + * + * @return void + */ + public function editLanguage($name, $fields) + { + $this->clickItem($name); + $languageEditPage = $this->test->getPageObject('LanguageEditPage'); + $languageEditPage->setFieldValues($fields); + $languageEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('LanguageManagerPage'); + $this->searchFor(); + } + + /** + * Get state of a Language item in the Language Manager: Language Items screen. + * + * @param string $name Language Title field + * + * @return State of the Language //Published or Unpublished + */ + public function getState($name) + { + $result = false; + $row = $this->getRowNumber($name); + $text = $this->driver->findElement(By::xPath("//tbody/tr[" . $row . "]/td[3]/a"))->getAttribute(@onclick); + + if (strpos($text, 'languages.unpublish') > 0) + { + $result = 'published'; + } + + if (strpos($text, 'languages.publish') > 0) + { + $result = 'unpublished'; + } + + return $result; + } + + /** + * Change state of a Language item in the Language Manager: Language Items screen. + * + * @param string $name Language Title field + * @param string $state State of the Language + * + * @return void + */ + public function changeLanguageState($name, $state = 'published') + { + $this->searchFor($name); + $this->checkAll(); + + if (strtolower($state) == 'published') + { + $this->clickButton('toolbar-publish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif (strtolower($state) == 'unpublished') + { + $this->clickButton('toolbar-unpublish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + + $this->searchFor(); + } +} diff --git a/tests/system/webdriver/Pages/Extensions/ModuleEditPage.php b/tests/system/webdriver/Pages/Extensions/ModuleEditPage.php new file mode 100644 index 0000000000000..b4bada5c1ad16 --- /dev/null +++ b/tests/system/webdriver/Pages/Extensions/ModuleEditPage.php @@ -0,0 +1,142 @@ + => . Note that each menu item type has its own options and its own groups. + * These are the common ones for almost all core menu item types. + * + * @var array + * @since 3.2 + */ + public $groups = array( + 'options' => array('Basic Options', 'Advanced Options'), + ); + + /** + * Associative array of expected input fields for the Account Details and Basic Settings tabs + * Assigned User Groups tab is omitted because that depends on the groups set up in the sample data + * @var unknown_type + */ + public $inputFields = array ( + array('label' => 'Title', 'id' => 'jform_title', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Parent Category', 'id' => 'jform_params_parent', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Category Descriptions', 'id' => 'jform_params_show_description', 'type' => 'fieldset', 'tab' => 'general'), + array('label' => 'Show Number of Articles', 'id' => 'jform_params_numitems', 'type' => 'fieldset', 'tab' => 'general'), + array('label' => 'Show Subcategories', 'id' => 'jform_params_show_children', 'type' => 'fieldset', 'tab' => 'general'), + array('label' => '# First Subcategories', 'id' => 'jform_params_count', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Maximum Level Depth', 'id' => 'jform_params_maxlevel', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Show Title', 'id' => 'jform_showtitle', 'type' => 'fieldset', 'tab' => 'general'), + array('label' => 'Position', 'id' => 'jform_position', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Status', 'id' => 'jform_published', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Start Publishing', 'id' => 'jform_publish_up', 'type' => 'input', 'tab' => 'general'), + array('label' => 'Finish Publishing', 'id' => 'jform_publish_down', 'type' => 'input', 'tab' => 'general'), + array('label' => 'Access', 'id' => 'jform_access', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Ordering', 'id' => 'jform_ordering', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Language', 'id' => 'jform_language', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Note', 'id' => 'jform_note', 'type' => 'input', 'tab' => 'general'), + array('label' => 'Module Assignment', 'id' => 'jform_menus', 'type' => 'div', 'tab' => 'assignment'), + array('label' => 'Alternative Layout', 'id' => 'jform_params_layout', 'type' => 'select', 'tab' => 'attrib-advanced'), + array('label' => 'Heading style', 'id' => 'jform_params_item_heading', 'type' => 'select', 'tab' => 'attrib-advanced'), + array('label' => 'Module Class Suffix', 'id' => 'jform_params_moduleclass_sfx', 'type' => 'textarea', 'tab' => 'attrib-advanced'), + array('label' => 'Caching', 'id' => 'jform_params_owncache', 'type' => 'select', 'tab' => 'attrib-advanced'), + array('label' => 'Cache Time', 'id' => 'jform_params_cache_time', 'type' => 'input', 'tab' => 'attrib-advanced'), + array('label' => 'Module Tag', 'id' => 'jform_params_module_tag', 'type' => 'select', 'tab' => 'attrib-advanced'), + array('label' => 'Bootstrap Size', 'id' => 'jform_params_bootstrap_size', 'type' => 'select', 'tab' => 'attrib-advanced'), + array('label' => 'Header Tag', 'id' => 'jform_params_header_tag', 'type' => 'select', 'tab' => 'attrib-advanced'), + array('label' => 'Header Class', 'id' => 'jform_params_header_class', 'type' => 'input', 'tab' => 'attrib-advanced'), + array('label' => 'Module Style', 'id' => 'jform_params_style', 'type' => 'select', 'tab' => 'attrib-advanced'), + array('label' => 'Select Menu', 'id' => 'jform_params_menutype', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Base Item', 'id' => 'jform_params_base', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Start Level', 'id' => 'jform_params_startLevel', 'type' => 'select', 'tab' => 'general'), + array('label' => 'End Level', 'id' => 'jform_params_endLevel', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Show Sub-menu Items', 'id' => 'jform_params_showAllChildren', 'type' => 'fieldset', 'tab' => 'general'), + array('label' => 'Menu Tag ID', 'id' => 'jform_params_tag_id', 'type' => 'input', 'tab' => 'attrib-advanced'), + array('label' => 'Menu Class Suffix', 'id' => 'jform_params_class_sfx', 'type' => 'input', 'tab' => 'attrib-advanced'), + array('label' => 'Target Position', 'id' => 'jform_params_window_open', 'type' => 'input', 'tab' => 'attrib-advanced'), + ); + + /** + * Checks for Type and calls special method for this field. + * Otherwise, just calls parent::getFieldValue() + * + * @see AdminEditPage::getFieldValue() + */ + public function getFieldValue($label) + { + if ($label == 'Type') + { + return $this->getModuleType(); + } + else + { + return parent::getFieldValue($label); + } + } + + /** + * function to get module type + * + * @return bool + */ + protected function getModuleType() + { + $elements = $this->driver->findElements(By::xPath("//span[@class = 'label']")); + + if (count($elements >= 2)) + { + return $elements[1]->getText(); + } + else + { + return false; + } + } + + /** + * function to get tab IDs + * + * @return array + */ + public function getTabIds() + { + $tabs = $this->driver->findElements(By::xPath("//div[@class='tab-content'][@id='myTabContent']/div")); + $return = array(); + + foreach ($tabs as $tab) + { + $return[] = $tab->getAttribute('id'); + } + + return $return; + } +} diff --git a/tests/system/webdriver/Pages/Extensions/ModuleManagerPage.php b/tests/system/webdriver/Pages/Extensions/ModuleManagerPage.php new file mode 100644 index 0000000000000..bcad3aa5f7433 --- /dev/null +++ b/tests/system/webdriver/Pages/Extensions/ModuleManagerPage.php @@ -0,0 +1,233 @@ + 'filter_client_id', + 'Status' => 'filter_state', + 'Position' => 'filter_position', + 'Type' => 'filter_module', + 'Access' => 'filter_access', + 'Language' => 'filter_language', + ); + + public $toolbar = array ( + 'New' => 'toolbar-new', + 'Edit' => 'toolbar-edit', + 'Duplicate' => 'toolbar-copy', + 'Publish' => 'toolbar-publish', + 'Unpublish' => 'toolbar-unpublish', + 'Check In' => 'toolbar-checkin', + 'Trash' => 'toolbar-trash', + 'Empty Trash' => 'toolbar-delete', + 'Batch' => 'toolbar-batch', + 'Options' => 'toolbar-options', + 'Help' => 'toolbar-help', + ); + + public $submenu = array ( + 'option=com_modules&filter_client_id=0', + 'option=com_modules&filter_client_id=1', + ); + + public $moduleTypes = array( + array('client' => 'site', 'name' => 'Articles - Archived'), + array('client' => 'site', 'name' => 'Articles - Categories'), + array('client' => 'site', 'name' => 'Articles - Category'), + array('client' => 'site', 'name' => 'Articles - Latest'), + array('client' => 'site', 'name' => 'Articles - Most Read'), + array('client' => 'site', 'name' => 'Articles - Newsflash'), + array('client' => 'site', 'name' => 'Articles - Related'), + array('client' => 'site', 'name' => 'Banners'), + array('client' => 'site', 'name' => 'Breadcrumbs'), + array('client' => 'site', 'name' => 'Custom HTML'), + array('client' => 'site', 'name' => 'Feed Display'), + array('client' => 'site', 'name' => 'Footer'), + array('client' => 'site', 'name' => 'Language Switcher'), + array('client' => 'site', 'name' => 'Latest Users'), + array('client' => 'site', 'name' => 'Login'), + array('client' => 'site', 'name' => 'Menu'), + array('client' => 'site', 'name' => 'Random Image'), + array('client' => 'site', 'name' => 'Search'), + array('client' => 'site', 'name' => 'Smart Search'), + array('client' => 'site', 'name' => 'Statistics'), + array('client' => 'site', 'name' => 'Syndication Feeds'), + array('client' => 'site', 'name' => 'Tags - Popular'), + array('client' => 'site', 'name' => 'Tags - Similar'), + array('client' => 'site', 'name' => 'Who\'s Online'), + array('client' => 'site', 'name' => 'Wrapper'), + array('client' => 'administrator', 'name' => 'Admin Sub-Menu'), + array('client' => 'administrator', 'name' => 'Administrator Menu'), + array('client' => 'administrator', 'name' => 'Articles - Latest'), + array('client' => 'administrator', 'name' => 'Custom HTML'), + array('client' => 'administrator', 'name' => 'Feed Display'), + array('client' => 'administrator', 'name' => 'Joomla! Version Information'), + array('client' => 'administrator', 'name' => 'Logged-in Users'), + array('client' => 'administrator', 'name' => 'Login Form'), + array('client' => 'administrator', 'name' => 'Multilingual Status'), + array('client' => 'administrator', 'name' => 'Popular Articles'), + array('client' => 'administrator', 'name' => 'Quick Icons'), + array('client' => 'administrator', 'name' => 'Statistics'), + array('client' => 'administrator', 'name' => 'Title'), + array('client' => 'administrator', 'name' => 'Toolbar'), + array('client' => 'administrator', 'name' => 'User Status'), + ); + + /** + * functioon to add a module + * + * @param string $title name of the module + * @param string $client client of the module + * @param string $type type of the module + * @param null $otherFields values of other input fields + * + * @return void + */ + public function addModule($title = 'Test Module', $client = 'Site', $type = 'Articles - Archived', $otherFields = null) + { + $this->setFilter('filter_client_id', $client); + $this->clickButton('toolbar-new'); + $this->driver->waitForElementUntilIsPresent(By::xPath("//a/strong[contains(., '" . $type . "')]"))->click(); + $moduleEditPage = $this->test->getPageObject('ModuleEditPage'); + $moduleEditPage->setFieldValues(array('Title' => $title)); + + if (is_array($otherFields)) + { + $moduleEditPage->setFieldValues($otherFields); + } + + $moduleEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('ModuleManagerPage'); + } + + /** + * function to change the state of the module + * + * @param string $name name of the module + * @param string $state state of the module + * + * @return void + */ + public function changeModuleState($name, $state = 'published') + { + $this->searchFor($name); + $this->checkAll(); + + if (strtolower($state) == 'published') + { + $this->clickButton('toolbar-publish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif (strtolower($state) == 'unpublished') + { + $this->clickButton('toolbar-unpublish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + + $this->searchFor(); + } + + public function editModule($name, $fields, $groupNames = array()) + { + $this->clickItem($name); + $moduleEditPage = $this->test->getPageObject('ModuleEditPage'); + $moduleEditPage->setFieldValues($fields); + $moduleEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('ModuleManagerPage'); + $this->searchFor(); + } + + /** + * Gets the modules field values. In turn calls getFieldValues of AdminManagerPage after selecting module client. + * + * @param string $title name of the module + * @param string $client client of the module + * @param array $fieldNames values of the input fields + * + * @return array + */ + public function getModuleFieldValues($title, $client, $fieldNames = array()) + { + $this->setFilter('filter_client_id', $client); + return $this->getFieldValues('ModuleEditPage', $title, $fieldNames); + } + + /** + * Gets all module types available + * + * @return array associative array of 'site' or 'administrator' => module name + */ + public function getModuleTypes() + { + $result = array(); + $clients = array('Site', 'Administrator'); + + foreach ($clients as $client) + { + $this->setFilter('filter_client_id', $client); + $this->clickButton('toolbar-new'); + $this->driver->waitForElementUntilIsPresent(By::xPath("//h2[contains(., 'Select a Module Type')]")); + $el = $this->driver->findElement(By::id('new-modules-list')); + $moduleElements = $el->findElements(By::xPath("//a/strong")); + + foreach ($moduleElements as $element) + { + $result[] = array('client' => strtolower($client), 'name' => $element->getText()); + } + + $this->driver->findElement(By::xPath("//button[contains(., 'Cancel')]"))->click(); + $moduleManagerPage = $this->test->getPageObject('ModuleManagerPage'); + } + + return $result; + } + + /** + * function to get the state of the module + * + * @param string $title name of the module + * + * @return bool|string + */ + public function getState($title) + { + $result = false; + $this->searchFor($title); + $text = $this->driver->findElement(By::xPath("//tbody/tr//a[contains(@onclick, 'listItemTask')]"))->getAttribute(@onclick); + + if (strpos($text, 'modules.publish') > 0) + { + $result = 'unpublished'; + } + elseif (strpos($text, 'modules.unpublish') > 0) + { + $result = 'published'; + } + + $this->searchFor(); + + return $result; + } +} diff --git a/tests/system/webdriver/Pages/Extensions/PluginEditPage.php b/tests/system/webdriver/Pages/Extensions/PluginEditPage.php new file mode 100644 index 0000000000000..7d1bbe45355de --- /dev/null +++ b/tests/system/webdriver/Pages/Extensions/PluginEditPage.php @@ -0,0 +1,74 @@ + 'Status', 'id' => 'jform_enabled', 'type' => 'fieldset', 'tab' => 'general'), + array('label' => 'Access', 'id' => 'jform_access', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Ordering', 'id' => 'jformordering', 'type' => 'select', 'tab' => 'general'), + array('label' => 'Check category deletion', 'id' => 'jform_params_check_categories', 'type' => 'fieldset', 'tab' => 'general'), + array('label' => 'Email on new site article', 'id' => 'jform_params_email_new_fe', 'type' => 'fieldset', 'tab' => 'general'), + ); +} diff --git a/tests/system/webdriver/Pages/Extensions/PluginManagerPage.php b/tests/system/webdriver/Pages/Extensions/PluginManagerPage.php new file mode 100644 index 0000000000000..ac84d6253befe --- /dev/null +++ b/tests/system/webdriver/Pages/Extensions/PluginManagerPage.php @@ -0,0 +1,170 @@ + 'filter_enabled', + 'Select Type' => 'filter_folder', + 'Select Access' => 'filter_access', + ); + + /** + * Array of toolbar id values for this page + * + * @var array + * @since 3.0 + */ + public $toolbar = array ( + 'Edit' => 'toolbar-edit', + 'Enable' => 'toolbar-publish', + 'Disable' => 'toolbar-unpublish', + 'Check In' => 'toolbar-checkin', + 'Options' => 'toolbar-options', + 'Help' => 'toolbar-help', + ); + + /** + * Get state of a Plugin in the Plug-in Manager: Plugin Items screen. + * + * @param string $name Plugin Name + * + * @return State of the Plugin //Enabled or Disabled which is equvalent to publish and unpublish at backend + */ + public function getState($name) + { + $result = false; + $row = $this->getRowNumber($name); + $text = $this->driver->findElement(By::xPath("//tbody/tr[" . $row . "]/td[3]/a"))->getAttribute(@onclick); + + if (strpos($text, 'plugins.unpublish') > 0) + { + $result = 'published'; + } + + if (strpos($text, 'plugins.publish') > 0) + { + $result = 'unpublished'; + } + + return $result; + } + + /** + * Change state of a Plugin item in the Plugin Manager: Plugin Manager Items screen. + * + * @param string $name Name of the Plugin + * @param string $state State of the Plugin + * + * @return void + */ + public function changePluginState($name, $state = 'published') + { + $this->searchFor($name); + $this->checkAll(); + + if (strtolower($state) == 'published') + { + $this->clickButton('toolbar-publish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + elseif (strtolower($state) == 'unpublished') + { + $this->clickButton('toolbar-unpublish'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + + $this->searchFor(); + } + + /** + * Get Access of a Plugin item in the Plugin Manager: Plugin Manager Items screen. + * + * @param string $name Name of the Plugin + * + * @return PluginAccessLevel + */ + public function getPluginAccess($name) + { + $row = $this->getRowNumber($name); + $text = $this->driver->findElement(By::xPath("//tbody/tr[" . $row . "]/td[7]"))->gettext(); + + return $text; + } + + /** + * Get Type of a Plugin item in the Plugin Manager: Plugin Manager Items screen. + * + * @param string $name Name of the Plugin + * + * @return Plugin type + */ + public function getPluginType($name) + { + $row = $this->getRowNumber($name); + $text = $this->driver->findElement(By::xPath("//tbody/tr[" . $row . "]/td[5]"))->gettext(); + + return $text; + } + + /** + * Edit a Plugin item in the Plugin Manager: Plugin Manager Edit Screen. + * + * @param string $name Name of the Plugin + * @param string $fields Input Fields that are to be changed in the form of an array + * + * @return void + */ + public function editPlugin($name,$fields) + { + $this->clickItem($name); + $pluginEditPage = $this->test->getPageObject('PluginEditPage'); + $pluginEditPage->setFieldValues($fields); + $pluginEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('pluginManagerPage'); + $this->searchFor(); + } +} diff --git a/tests/system/webdriver/Pages/Extensions/TemplateEditPage.php b/tests/system/webdriver/Pages/Extensions/TemplateEditPage.php new file mode 100644 index 0000000000000..02c34ba01eb54 --- /dev/null +++ b/tests/system/webdriver/Pages/Extensions/TemplateEditPage.php @@ -0,0 +1,75 @@ + 'Style Name', 'id' => 'jform_title', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Default', 'id' => 'jform_home', 'type' => 'fieldset', 'tab' => 'details'), + array('lable' => 'Show Site Name', 'id' => 'jform_params_showSiteName', 'type' => 'fieldset', 'tab' => 'options'), + array('lable' => 'Select Colour', 'id' => 'jform_params_colourChoice', 'type' => 'select', 'tab' => 'options'), + array('lable' => 'Bold Text', 'id' => 'jform_params_boldText', 'type' => 'fieldset', 'tab' => 'options'), + ); +} diff --git a/tests/system/webdriver/Pages/Extensions/TemplateManagerPage.php b/tests/system/webdriver/Pages/Extensions/TemplateManagerPage.php new file mode 100644 index 0000000000000..a508047e71102 --- /dev/null +++ b/tests/system/webdriver/Pages/Extensions/TemplateManagerPage.php @@ -0,0 +1,121 @@ + 'filter_template', + 'Select Location' => 'filter_client_id', + ); + + /** + * Array of toolbar id values for this page + * + * @var array + * @since 3.0 + */ + public $toolbar = array ( + 'Make Default' => 'toolbar-star', + 'Edit' => 'toolbar-edit', + 'Duplicate' => 'toolbar-copy', + 'Delete' => 'toolbar-delete', + 'Options' => 'toolbar-options', + 'Help' => 'toolbar-help', + 'Save as Copy' => 'toolbar-save-copy', + ); + + /** + * Copy Style from the Template Manager Screen + * @param string $name Template Name whose Copy is to be made + * + * @return void + */ + public function copyStyle($name) + { + $this->searchFor($name); + $row_number = $this->getRowNumber($name) - 1; + $el = $this->driver->findElement(By::xPath(".//input[@id='cb" . $row_number . "']")); + $el->click(); + $this->clickButton('toolbar-copy'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + + /** + * function to delete style + * + * @param string $name stores name of the style + * + * @return void + */ + public function deleteStyle($name) + { + $this->searchFor($name); + $row_number = $this->getRowNumber($name) - 1; + $el = $this->driver->findElement(By::xPath(".//input[@id='cb" . $row_number . "']")); + $el->click(); + $this->clickButton('toolbar-delete'); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + + /** + * function to edit style + * + * @param string $name stores name of the style + * @param array $fields stores the value of the input fields + * + * @return void + * + */ + public function editStyle($name, $fields) + { + $this->searchFor($name); + $this->clickItem($name); + $templateEditPage = $this->test->getPageObject('TemplateEditPage'); + $templateEditPage->setFieldValues($fields); + $templateEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('TemplateManagerPage'); + } +} diff --git a/tests/system/webdriver/Pages/Menus/MenuEditPage.php b/tests/system/webdriver/Pages/Menus/MenuEditPage.php new file mode 100644 index 0000000000000..b972cecb5432d --- /dev/null +++ b/tests/system/webdriver/Pages/Menus/MenuEditPage.php @@ -0,0 +1,36 @@ + 'Title', 'id' => 'jform_title', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Menu Type', 'id' => 'jform_menutype', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Description', 'id' => 'jform_menudescription', 'type' => 'input', 'tab' => 'header'), + ); +} diff --git a/tests/system/webdriver/Pages/Menus/MenuItemEditPage.php b/tests/system/webdriver/Pages/Menus/MenuItemEditPage.php new file mode 100644 index 0000000000000..c7584c8a5b5a7 --- /dev/null +++ b/tests/system/webdriver/Pages/Menus/MenuItemEditPage.php @@ -0,0 +1,327 @@ + => . Note that each menu item type has its own options and its own groups. + * These are the common ones for almost all core menu item types. + * + * @var array + * @since 3.2 + */ + public $groups = array( + 'options' => array('Link Type', 'Page Display', 'Metadata'), + ); + + /** + * Associative array of expected input fields for the Menu Manager: Add / Edit Menu + * @var array + */ + public $inputFields = array ( + array('label' => 'Menu Title', 'id' => 'jform_title', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Alias', 'id' => 'jform_alias', 'type' => 'input', 'tab' => 'header'), + array('label' => 'Menu Item Type', 'id' => 'jform_type', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Link', 'id' => 'jform_link', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Target Window', 'id' => 'jform_browserNav', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Template Style', 'id' => 'jform_template_style_id', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Menu Location', 'id' => 'jform_menutype', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Parent Item', 'id' => 'jform_parent_id', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Status', 'id' => 'jform_published', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Default Page', 'id' => 'jform_home', 'type' => 'fieldset', 'tab' => 'details'), + array('label' => 'Access', 'id' => 'jform_access', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Language', 'id' => 'jform_language', 'type' => 'select', 'tab' => 'details'), + array('label' => 'Note', 'id' => 'jform_note', 'type' => 'input', 'tab' => 'details'), + array('label' => 'Link Title Attribute', 'id' => 'jform_params_menu_anchor_title', 'type' => 'input', 'tab' => 'attrib-menu-options'), + array('label' => 'Link CSS Style', 'id' => 'jform_params_menu_anchor_css', 'type' => 'input', 'tab' => 'attrib-menu-options'), + array('label' => 'Link Image', 'id' => 'jform_params_menu_image', 'type' => 'input', 'tab' => 'attrib-menu-options'), + array('label' => 'Add Menu Title', 'id' => 'jform_params_menu_text', 'type' => 'fieldset', 'tab' => 'attrib-menu-options'), + array('label' => 'Browser Page Title', 'id' => 'jform_params_page_title', 'type' => 'input', 'tab' => 'attrib-page-options'), + array('label' => 'Show Page Heading', 'id' => 'jform_params_show_page_heading', 'type' => 'fieldset', 'tab' => 'attrib-page-options'), + array('label' => 'Page Heading', 'id' => 'jform_params_page_heading', 'type' => 'input', 'tab' => 'attrib-page-options'), + array('label' => 'Page Class', 'id' => 'jform_params_pageclass_sfx', 'type' => 'input', 'tab' => 'attrib-page-options'), + array('label' => 'Meta Description', 'id' => 'jform_params_menu_meta_description', 'type' => 'textarea', 'tab' => 'attrib-metadata'), + array('label' => 'Meta Keywords', 'id' => 'jform_params_menu_meta_keywords', 'type' => 'textarea', 'tab' => 'attrib-metadata'), + array('label' => 'Robots', 'id' => 'jform_params_robots', 'type' => 'select', 'tab' => 'attrib-metadata'), + array('label' => 'Secure', 'id' => 'jform_params_secure', 'type' => 'select', 'tab' => 'attrib-metadata'), + array('label' => 'Hide Unassigned Modules', 'id' => 'showmods', 'type' => 'input', 'tab' => 'modules'), + array('label' => 'Show Title', 'id ' => 'jform_params_show_title', 'type' => 'fieldset', 'tab' => 'attrib-basic' ), + array('label' => 'Linked Titles','id' => 'jform_params_link_titles','type' => 'fieldset','tab' => 'attrib-basic' ), + array('label' => 'Show Intro Text','id' => 'jform_params_show_intro','type' => 'fieldset','tab' => 'attrib-basic' ), + array('label' => 'Position of Article Info', 'id' => 'jform_params_info_block_position', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + array('label' => 'Show Category', 'id' => 'jform_params_show_category', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + array('label' => 'Link Category', 'id' => 'jform_params_link_category', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + array('label' => 'Show Parent', 'id' => 'jform_params_show_parent', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + array('label' => 'Link Parent', 'id' => 'jform_params_link_parent_category', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + array('label' => 'Show Author', 'id' => 'jform_params_show_author', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + array('label' => 'Link Author', 'id' => 'jform_params_link_author', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + array('label' => 'Show Create Date', 'id' => 'jform_params_show_create', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + array('label' => 'Show Modify Date', 'id' => 'jform_params_show_modify_date', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + array('label' => 'Show Publish Date', 'id' => 'jform_params_show_publish_date', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + array('label' => 'Show Navigation', 'id' => 'jform_params_show_item_navigation', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + array('label' => 'Show Voting', 'id' => 'jform_params_show_vote', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + array('label' => 'Show Tags', 'id' => 'jform_params_show_tags', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + array('label' => 'Show Icons', 'id' => 'jform_params_show_icons', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + array('label' => 'Show Print Icon', 'id' => 'jform_params_show_print_icon', 'type' => 'fieldset','tab' => 'attrib-basic'), + array('label' => 'Show Email Icon', 'id' => 'jform_params_show_email_icon','type' => 'fieldset','tab' => 'attrib-basic'), + array('label' => 'Show Hits', 'id' => 'jform_params_show_hits', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + array('label' => 'Show Unauthorised Links', 'id' => 'jform_params_show_noauth', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + array('label' => 'Positioning of the Links', 'id' => 'jform_params_urls_position', 'type' => 'fieldset', 'tab' => 'attrib-basic'), + ); + + public $menuItemTypes = array( + array('group' => 'Articles', 'type' => 'Archived Articles ' ), + array('group' => 'Articles', 'type' => 'Category Blog ' ), + array('group' => 'Articles', 'type' => 'Category List ' ), + array('group' => 'Articles', 'type' => 'Create Article ' ), + array('group' => 'Articles', 'type' => 'Featured Articles ' ), + array('group' => 'Articles', 'type' => 'List All Categories ' ), + array('group' => 'Articles', 'type' => 'Single Article ' ), + array('group' => 'Configuration Manager', 'type' => 'Display Site Configuration Options ' ), + array('group' => 'Configuration Manager', 'type' => 'Display Template Options ' ), + array('group' => 'Contacts', 'type' => 'Featured Contacts ' ), + array('group' => 'Contacts', 'type' => 'List All Contact Categories ' ), + array('group' => 'Contacts', 'type' => 'List Contacts in a Category ' ), + array('group' => 'Contacts', 'type' => 'Single Contact ' ), + array('group' => 'News Feeds', 'type' => 'List All News Feed Categories ' ), + array('group' => 'News Feeds', 'type' => 'List News Feeds in a Category ' ), + array('group' => 'News Feeds', 'type' => 'Single News Feed ' ), + array('group' => 'Search', 'type' => 'Search Form or Search Results ' ), + array('group' => 'Smart Search', 'type' => 'Search ' ), + array('group' => 'System Links', 'type' => 'External URL ' ), + array('group' => 'System Links', 'type' => 'Menu Heading ' ), + array('group' => 'System Links', 'type' => 'Menu Item Alias ' ), + array('group' => 'System Links', 'type' => 'Text Separator ' ), + array('group' => 'Tags', 'type' => 'Compact list of tagged items ' ), + array('group' => 'Tags', 'type' => 'List of all tags ' ), + array('group' => 'Tags', 'type' => 'Tagged Items ' ), + array('group' => 'Users Manager', 'type' => 'Edit User Profile ' ), + array('group' => 'Users Manager', 'type' => 'Login Form ' ), + array('group' => 'Users Manager', 'type' => 'Password Reset ' ), + array('group' => 'Users Manager', 'type' => 'Registration Form ' ), + array('group' => 'Users Manager', 'type' => 'User Profile ' ), + array('group' => 'Users Manager', 'type' => 'Username Reminder Request ' ), + array('group' => 'Wrapper', 'type' => 'Iframe Wrapper ' ), + ); + + /** + * function to get field value + * + * @param string $label stores label + * + * @return bool|String + */ + public function getFieldValue($label) + { + $result = false; + + if (strtolower($label) === 'menu item type') + { + $result = $this->getMenuItemType($label); + } + elseif (in_array(strtolower($label), array('article', 'contact', 'newsfeed', 'weblink'))) + { + $result = $this->getRequestVariable($label); + } + elseif (strtolower($label) == 'category') + { + $result = parent::getSelectValues(array('tab' => 'Details', 'id' => 'jform_request_id')); + } + else + { + $result = parent::getFieldValue($label); + } + + return $result; + } + + /** + * function to get the group name + * + * @param string $value stores value + * + * @return bool + */ + protected function getGroupName($value) + { + foreach ($this->menuItemTypes as $array) + { + if (strpos($array['type'], $value) !== false) + return $array['group']; + } + + return false; + } + + /** + * function to get menu type + * + * @return String + */ + public function getMenuItemType() + { + return $this->driver->findElement(By::xPath("//label[@id='jform_type-lbl']/../..//input"))->getAttribute('value'); + } + + /** + * function to get all menu types + * + * @return array + */ + public function getMenuItemTypes() + { + $result = array(); + $d = $this->driver; + $d->findElement(By::xPath("//a[contains(@onclick, 'option=com_menus&view=menutypes')]"))->click(); + $el = $d->waitForElementUntilIsPresent(By::xPath("//iframe[contains(@src, 'option=com_menus&view=menutypes')]")); + $el = $d->switchTo()->getFrameByWebElement($el); + $groups = $d->findElements(By::className('accordion-group')); + + foreach ($groups as $group) + { + $toggle = $group->findElement(By::className('accordion-toggle')); + $toggleName = $toggle->getText(); + $toggle->click(); + $d->waitForElementUntilIsPresent(By::xPath("//div[contains(@class, 'accordion-body in')]/div/ul/li/a")); + $menuTypes = $el->findElements(By::xPath("//div[contains(@class, 'accordion-body in')]/div/ul/li/a")); + + foreach ($menuTypes as $menuType) + { + $allText = $menuType->getText(); + $subTextLength = strlen($menuType->findElement(By::tagName('small'))->getText()); + $menuTypeText = substr($allText, 0, (strlen($allText) - $subTextLength)); + $result[] = array ('group' => $toggleName, 'type' => $menuTypeText); + } + } + + return $result; + } + + /** + * function to get request variable + * + * @return String + */ + public function getRequestVariable() + { + return $this->driver->findElement(By::id('jform_request_id_name'))->getAttribute('value'); + } + + /** + * function to set value + * + * @param string $label stores value of label + * @param string $value stores value + * + * @return $this|void + */ + public function setFieldValue($label, $value) + { + if (strtolower($label) === 'menu item type') + { + $this->setMenuItemType($value); + } + elseif (in_array(strtolower($label), array('article', 'contact', 'newsfeed', 'weblink'))) + { + $this->setRequestVariable($value); + } + elseif (in_array(strtolower($label), array('category'))) + { + parent::setSelectValues(array('tab' => 'Details', 'id' => 'jform_request_id', 'value' => $value)); + } + else + { + parent::setFieldValue($label, $value); + } + + return $this; + } + + /** + * function to set menu type + * + * @param string $value stores value + * + * @return $this + */ + public function setMenuItemType($value) + { + $group = $this->getGroupName($value); + $d = $this->driver; + $d->findElement(By::xPath("//input[@id='jform_title']"))->click(); + $d->findElement(By::xPath("//a[contains(@onclick, 'option=com_menus&view=menutypes')]"))->click(); + $el = $d->waitForElementUntilIsPresent(By::xPath("//iframe[contains(@src, 'option=com_menus&view=menutypes')]")); + $el = $d->switchTo()->getFrameByWebElement($el); + $d->waitForElementUntilIsPresent(By::xPath("//a[contains(@class, 'accordion-toggle')][contains(., '" . $group . "')]"), 10); + $el->findElement(By::xPath("//a[contains(@class, 'accordion-toggle')][contains(., '" . $group . "')]"))->click(); + $d->waitForElementUntilIsPresent(By::xPath("//div[contains(@class, 'accordion-body in')]/div/ul/li/a")); + $el->findElement(By::xPath("//div[contains(@class, 'accordion-body in')]//a[contains(text(), '" . $value . "')]"))->click(); + $d->waitForElementUntilIsNotPresent(By::xPath("//iframe[contains(@src, 'option=com_menus&view=menutypes')]")); + $d->waitForElementUntilIsPresent(By::id('jform_title')); + $d->switchTo()->getDefaultFrame(); + + return $this; + } + + /** + * function to set request variable + * + * @param string $value stores value + * + * @return void + */ + public function setRequestVariable($value) + { + $this->selectTab('Details'); + $d = $this->driver; + $d->findElement(By::xPath("//a[contains(@class, 'modal btn')][contains(@rel, 'iframe')]"))->click(); + $frameElement = $d->waitForElementUntilIsPresent(By::xPath("//iframe[contains(@src, 'layout=modal')]")); + $d->switchTo()->getFrameByWebElement($frameElement); + $filter = $d->waitForElementUntilIsPresent(By::id('filter_search')); + $filter->clear(); + $filter->sendKeys($value); + $d->findElement(By::xPath("//button[@data-original-title = 'Search']"))->click(); + $d->waitForElementUntilIsPresent(By::xPath("//button[@data-original-title = 'Search']")); + $d->findElement(By::xPath("//a[contains(text(), '" . $value . "')]"))->click(); + $d->waitForElementUntilIsNotPresent(By::xPath("//iframe[contains(@src, 'layout=modal')]")); + $d->switchTo()->getDefaultFrame(); + } +} diff --git a/tests/system/webdriver/Pages/Menus/MenuItemsManagerPage.php b/tests/system/webdriver/Pages/Menus/MenuItemsManagerPage.php new file mode 100644 index 0000000000000..c46afe0d29c96 --- /dev/null +++ b/tests/system/webdriver/Pages/Menus/MenuItemsManagerPage.php @@ -0,0 +1,184 @@ + 'menutype', + 'Max Levels' => 'filter_level', + 'Status' => 'filter_published', + 'Access' => 'filter_access', + 'Language' => 'filter_language', + ); + + /** + * Array of toolbar id values for this page + * + * @var array + * @since 3.0 + */ + public $toolbar = array ( + 'New' => 'toolbar-new', + 'Edit' => 'toolbar-edit', + 'Publish' => 'toolbar-publish', + 'Unpublish' => 'toolbar-unpublish', + 'Check In' => 'toolbar-checkin', + 'Empty trash' => 'toolbar-delete', + 'Trash' => 'toolbar-trash', + 'Home' => 'toolbar-star', + 'Rebuild' => 'toolbar-refresh', + 'Batch' => 'toolbar-batch', + 'Help' => 'toolbar-help', + ); + + /** + * Array of submenu links used for this page + * + * @var array + * @since 3.0 + */ + public $submenu = array ( + 'option=com_menus&view=menus', + ); + + /** + * Add a new menu item in the Menu Manager: Menu Items screen. + * + * @param string $title Menu Title field + * @param string $menuItemType One of the allowed Menu Item Types (Single Article, Featured Contacts, etc.) + * @param string $menuLocation Menu Location field + * @param array $otherFields associative array of other fields in the form label => value. + * + * Note that there a special field types for the request variable (e.g., article name or category name) which is required by some menu types. + * This can be designated in the $otherFields with any of the following labels: 'request', 'category', 'article', 'contact', 'newsfeed', 'weblink'. + * For example: array('article' => 'Australian Parks'). + * + * @return MenuItemsManagerPage + */ + public function addMenuItem($title='Test Menu Item', $menuItemType='List All Categories', $menuLocation = 'Main Menu', array $otherFields = array()) + { + /* @var $menuItemEditPage MenuItemEditPage */ + $this->setFilter('Menu', $menuLocation); + $this->clickButton('toolbar-new'); + $menuItemEditPage = $this->test->getPageObject('MenuItemEditPage'); + $menuItemEditPage->setMenuItemType($menuItemType); + + $fields = array('Menu title' => $title, 'Menu Location' => $menuLocation); + + if (count($otherFields) > 0) + { + $fields = array_merge($fields, $otherFields); + } + + $menuItemEditPage->setFieldValues($fields); + + $menuItemEditPage->clickButton('toolbar-save'); + + return $this->test->getPageObject('MenuItemsManagerPage'); + } + + /** + * Edit a menu item in the Menu Manager: Menu Items screen. + * + * @param string $title Menu Title field + * @param array $fields associative array of fields in the form label => value. + * + * @return void + */ + public function editMenuItem($title, $fields) + { + $this->clickItem($title); + + /* @var $menuItemEditPage MenuItemEditPage */ + $menuItemEditPage = $this->test->getPageObject('MenuItemEditPage'); + $menuItemEditPage->setFieldValues($fields); + $menuItemEditPage->clickButton('toolbar-save'); + $this->test->getPageObject('MenuItemsManagerPage'); + $this->searchFor(); + } + + /** + * function to get current value + * + * @return String + */ + public function getCurrentMenu() + { + $el = $this->driver->findElement(By::xPath("//div[@id='menutype_chzn']/a/span")); + + return $el->getText(); + } + + /** + * function to delete menu Item + * + * @param String $name stores the name + * + * @return void + */ + public function trashAndDelete($name) + { + $currentMenu = $this->getCurrentMenu(); + $this->searchFor($name); + $this->checkAll(); + $this->driver->findElement(By::id('filter_search'))->click(); + $this->clickButton('toolbar-trash'); + $this->test->getPageObject('MenuItemsManagerPage'); + $this->setFilter('Status', 'Trashed'); + $this->checkAll(); + $this->driver->findElement(By::id('filter_search'))->click(); + $this->clickButton('toolbar-delete'); + $this->test->getPageObject('MenuItemsManagerPage'); + $this->setFilter('Status', 'Select Status'); + $this->test->getPageObject('MenuItemsManagerPage'); + } +} diff --git a/tests/system/webdriver/Pages/Menus/MenuManagerPage.php b/tests/system/webdriver/Pages/Menus/MenuManagerPage.php new file mode 100644 index 0000000000000..bbdb50f567d54 --- /dev/null +++ b/tests/system/webdriver/Pages/Menus/MenuManagerPage.php @@ -0,0 +1,141 @@ + 'toolbar-new', + 'Edit' => 'toolbar-edit', + 'Delete' => 'toolbar-delete', + 'Rebuild' => 'toolbar-refresh', + 'Options' => 'toolbar-options', + 'Help' => 'toolbar-help', + ); + + public $submenu = array ( + 'option=com_menus&view=items', + ); + + + /** + * function to add a menu + * + * @param string $title stores value of title + * @param string $type stores value of menu type + * @param string $description stores value of description + * + * @return AdminPage + */ + public function addMenu($title='Test Menu', $type='testMenu', $description='This is a test menu.') + { + $this->clickButton('toolbar-new'); + $menuEditPage = $this->test->getPageObject('MenuEditPage'); + $menuEditPage->setFieldValues(array('Title' => $title, 'Menu type' => $type, 'Description' => $description)); + $menuEditPage->clickButton('toolbar-save'); + + return $this->test->getPageObject('MenuManagerPage'); + } + + /** + * function to delete menu + * + * @param string $title stores value of title + * + * @return void + */ + public function deleteMenu($title) + { + if ($this->getRowText($title)) + { + $this->checkBox($title); + $this->clickButton('toolbar-delete'); + $this->driver->acceptAlert(); + $this->driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath)); + } + } + + /** + * function to edit page + * + * @param string $title stores value of title + * @param array $fields stores value of input fields + * + * @return AdminPage + */ + public function editMenu($title, $fields) + { + $this->checkBox($title); + $this->clickButton('Edit'); + + /* @var $menuEditPage MenuEditPage*/ + + $menuEditPage = $this->test->getPageObject('MenuEditPage'); + $menuEditPage->setFieldValues($fields); + $menuEditPage->clickButton('toolbar-save'); + + return $this->test->getPageObject('MenuManagerPage'); + } + + /** + * function to check box + * + * @param string $title stores value of title + * + * @return void + */ + public function checkBox($title) + { + $this->driver->findElement(By::xPath("//td[contains(., '" . $title . "')]/../td/input"))->click(); + } + + /** + * Returns an array of field values from an edit screen. + * + * @param string $itemName Name of item (user name, article title, and so on) + * @param array $fieldNames Array of field labels to get values of. + * + * @return string + */ + public function getFieldValues($className, $itemName, $fieldNames) + { + $this->checkBox($itemName); + $this->clickButton('Edit'); + $this->editItem = $this->test->getPageObject($className); + $result = array(); + + if (is_array($fieldNames)) + { + foreach ($fieldNames as $name) + { + $result[] = $this->editItem->getFieldValue($name); + } + } + + $this->editItem->saveAndClose(); + + return $result; + } +} diff --git a/tests/system/webdriver/Pages/SiteContent/SiteArchivedArticlesPage.php b/tests/system/webdriver/Pages/SiteContent/SiteArchivedArticlesPage.php new file mode 100644 index 0000000000000..e20a8ce809b99 --- /dev/null +++ b/tests/system/webdriver/Pages/SiteContent/SiteArchivedArticlesPage.php @@ -0,0 +1,67 @@ +driver->findElements(By::xPath("//h2//a[contains(text(), '')]")); + $arrayTitles = array(); + + for ($i = 0; $i < count($arrayElement); $i++) + { + $arrayTitles[$i] = $arrayElement[$i]->getText(); + } + + return $arrayTitles; + } +} diff --git a/tests/system/webdriver/Pages/SiteContent/SiteConfigurationConfigPage.php b/tests/system/webdriver/Pages/SiteContent/SiteConfigurationConfigPage.php new file mode 100644 index 0000000000000..ecd8b47a478a5 --- /dev/null +++ b/tests/system/webdriver/Pages/SiteContent/SiteConfigurationConfigPage.php @@ -0,0 +1,110 @@ +driver; + + $d->findElement(By::xPath("//input[@id='jform_sitename']"))->clear(); + $d->findElement(By::xPath("//input[@id='jform_sitename']"))->sendKeys($siteName); + $d->findElement(By::xPath("//button[@type='button'][@class='btn btn-primary']"))->click(); + $this->test->getPageObject('SiteConfigurationConfigPage'); + } + + /** + * Function which returns site name + * + * @return string site name + */ + public function getSiteName() + { + $d = $this->driver; + + return $d->findElement(By::xPath("//span[@class='site-title']"))->getText(); + + } + + /** + * Function which changes the meta description saving the changes + * + * @param string $metaDescription store the value of metadescription + * + * @return null + */ + public function changeMetaDescription($metaDescription) + { + $d = $this->driver; + + $d->findElement(By::xPath("//textarea[@id='jform_MetaDesc']"))->clear(); + $d->findElement(By::xPath("//textarea[@id='jform_MetaDesc']"))->sendKeys($metaDescription); + $d->findElement(By::xPath("//button[@type='button'][@class='btn btn-primary']"))->click(); + $this->test->getPageObject('SiteConfigurationConfigPage'); + + } + + /** + * Function which returns the meta description + * + * @return string Meta description + */ + public function getMetaDescription() + { + $d = $this->driver; + + return $d->findElement(By::xPath("//textarea[@id='jform_MetaDesc']"))->getText(); + + } +} diff --git a/tests/system/webdriver/Pages/SiteContent/SiteConfigurationTemplatePage.php b/tests/system/webdriver/Pages/SiteContent/SiteConfigurationTemplatePage.php new file mode 100644 index 0000000000000..9eaece0e7abc5 --- /dev/null +++ b/tests/system/webdriver/Pages/SiteContent/SiteConfigurationTemplatePage.php @@ -0,0 +1,106 @@ +driver; + + $d->findElement(By::xPath("//input[@id='params_templateColor']"))->clear(); + $d->findElement(By::xPath("//input[@id='params_templateColor']"))->sendKeys($templateColor); + $d->findElement(By::xPath("//button[@type='button'][@class='btn btn-primary']"))->click(); + } + + /** + * Function which returns Template Color + * + * @return string template color + */ + public function getTemplateColor() + { + $d = $this->driver; + + return $d->findElement(By::xPath("//input[@id='params_templateColor']"))->getAttribute("value"); + } + + /** + * Function which changes the Background Color saving the changes + * + * @param string $backgroundColor stores the background color + * + * @return null + */ + public function changeBackgroundColor($backgroundColor) + { + $d = $this->driver; + + $d->findElement(By::xPath("//input[@id='params_templateBackgroundColor']"))->clear(); + $d->findElement(By::xPath("//input[@id='params_templateBackgroundColor']"))->sendKeys($backgroundColor); + $d->findElement(By::xPath("//button[@type='button'][@class='btn btn-primary']"))->click(); + $this->test->getPageObject('SiteConfigurationTemplatePage'); + } + + /** + * Function which returns the Background Color + * + * @return string background color + */ + public function getBackgroundColor() + { + $d = $this->driver; + + return $d->findElement(By::xPath("//input[@id='params_templateBackgroundColor']"))->getAttribute("value"); + } +} diff --git a/tests/system/webdriver/Pages/SiteContent/SiteContentCategoriesPage.php b/tests/system/webdriver/Pages/SiteContent/SiteContentCategoriesPage.php new file mode 100644 index 0000000000000..e3c23f25b462b --- /dev/null +++ b/tests/system/webdriver/Pages/SiteContent/SiteContentCategoriesPage.php @@ -0,0 +1,68 @@ +driver->findElements(By::xPath("//h3//a[contains(text(), '')]")); + $arrayTitles = array(); + + for ($i = 0;$i < count($arrayElement);$i++) + { + $arrayTitles[$i] = $arrayElement[$i]->getText(); + } + + return $arrayTitles; + } +} diff --git a/tests/system/webdriver/Pages/SiteContent/SiteContentEditPage.php b/tests/system/webdriver/Pages/SiteContent/SiteContentEditPage.php new file mode 100644 index 0000000000000..5d6a5811e568a --- /dev/null +++ b/tests/system/webdriver/Pages/SiteContent/SiteContentEditPage.php @@ -0,0 +1,66 @@ +driver; + $guiEditor = $this->driver->findElement(By::xPath("//a[contains(@onclick, 'mceToggleEditor')]")); + $guiEditor->click(); + $d->findElement(By::xPath("//textarea[@id='jform_articletext']"))->clear(); + $d->findElement(By::xPath("//textarea[@id='jform_articletext']"))->sendKeys($articleText); + $d->findElement(By::xPath("//button[@type='button'][@class='btn btn-primary']"))->click(); + } +} diff --git a/tests/system/webdriver/Pages/SiteContent/SiteContentFeaturedPage.php b/tests/system/webdriver/Pages/SiteContent/SiteContentFeaturedPage.php new file mode 100644 index 0000000000000..ca48512fa2b9c --- /dev/null +++ b/tests/system/webdriver/Pages/SiteContent/SiteContentFeaturedPage.php @@ -0,0 +1,207 @@ +driver->findElements(By::xPath("//h2//a[contains(text(), '')]")); + $arrayTitles = array(); + + for ($i = 0;$i < count($arrayElement);$i++) + { + $arrayTitles[$i] = $arrayElement[$i]->getText(); + } + + return $arrayTitles; + } + + /** + * Function which returns Title array of Contacts on the Home page of Front End + * + * @return Array of Contacts Titles Visible + */ + public function getContactTitles() + { + $arrayElement = $this->driver->findElements(By::xPath("//a[contains(text(), '')]")); + $arrayTitles = array(); + + for ($i = 0;$i < count($arrayElement);$i++) + { + $arrayTitles[$i] = $arrayElement[$i]->getText(); + } + + return $arrayTitles; + } + + /** + * Function which returns Text array of Article content on the Home page of Front End + * + * @return Array of Article Content Visible + */ + public function getArticleText() + { + $arrayElement = $this->driver->findElements(By::xPath("//p[contains(text(),'')]")); + $arrayText = array(); + + for ($i = 0;$i < count($arrayElement);$i++) + { + $arrayText[$i] = $arrayElement[$i]->getText(); + } + + return $arrayText; + } + + /** + * Function which opens the article in editing mode at the front end + * + * @param string $articleTitle Title of the article which we are going to edit + * + * @return null + */ + public function clickEditArticle($articleTitle) + { + $d = $this->driver; + $d->findElement(By::xPath("//a[contains(text(),'" . $articleTitle . "')]/../../div//a/span[contains(@class, 'icon-cog')]"))->click(); + $d->waitForElementUntilIsPresent(By::xPath("//a[contains(text(),'" . $articleTitle . "')]/../../div//a/span[contains(@class, 'icon-edit')]"), 10); + $d->findElement(By::xPath("//a[contains(text(),'" . $articleTitle . "')]/../../div//a/span[contains(@class, 'icon-edit')]"))->click(); + } + + /** + * Function to check if the edit icon is present on the page or not + * + * @return boolean + */ + public function isEditPresent() + { + $arrayElement = $this->driver->findElements(By::xPath("//a[contains(text(), 'Edit')]")); + + if (count($arrayElement) > 0) + { + return true; + } + else + { + return false; + } + } + + /** + * Function to check if the unpublished tag is present for an article or not + * + * @param string $articleTitle stores the name of the article + * + * @return boolean + */ + public function isUnpublishedPresent($articleTitle) + { + $arrayElement = $this->driver->findElements(By::xPath("//div[@class='system-unpublished']/h2[contains(., '" . $articleTitle . "')]")); + + if (count($arrayElement) > 0) + { + return true; + } + else + { + return false; + } + } + + /** + * check whether the item is present on the site or not given the xpath variable. + * + * @param string $itemName stores the name of the item to be searched + * @param string $arg xpath variable + * + * @return boolean + */ + public function itemExist($itemName, $arg) + { + $driver = $this->driver; + $path = "//" . $arg . "[contains(text(),'" . $itemName . "')]"; + $driver->waitForElementUntilIsPresent(By::xPath($path), 60); + $element = $driver->findElement(By::xPath($path)); + + if ($element != null) + { + return true; + } + + return false; + } + + /** + * function to click an item + * + * @param string $itemName stores the item name to be clicked + * + * @return void + */ + public function itemClick($itemName) + { + $driver = $this->driver; + $path = "//a[contains(text(),'" . $itemName . "')]"; + $driver->waitForElementUntilIsPresent(By::xPath($path), 60); + $driver->findElement(By::xPath($path))->click(); + } + + /** + * check if the voting option is available on the front end + * + * @return boolean + */ + public function checkVote() + { + $driver = $this->driver; + $element = $driver->findElement(By::xPath("//input[@name='submit_vote']")); + + if ($element != null) + { + return true; + } + + return false; + } +} diff --git a/tests/system/webdriver/Pages/SiteContent/SiteLoginPage.php b/tests/system/webdriver/Pages/SiteContent/SiteLoginPage.php new file mode 100644 index 0000000000000..d92cb63ac2e7e --- /dev/null +++ b/tests/system/webdriver/Pages/SiteContent/SiteLoginPage.php @@ -0,0 +1,77 @@ +driver; + $d->findElement(By::xPath("//button[contains(text(), 'Log out')]"))->click(); + $d->clearCurrentCookies(); + } + + /** + * Function to enter Username Password + * + * @param string $username Username of the user + * @param string $password Password of the user + * + * @return void + */ + public function SiteLoginUser($username, $password) + { + $d = $this->driver; + $d->findElement(By::xPath("//input[@id='username']"))->sendKeys($username); + $d->findElement(By::xPath("//input[@id='password']"))->sendKeys($password); + $d->findElement(By::xPath("//button[contains(text(), 'Log in')]"))->click(); + } +} diff --git a/tests/system/webdriver/Pages/SiteContent/SitePage.php b/tests/system/webdriver/Pages/SiteContent/SitePage.php new file mode 100644 index 0000000000000..aade82243e46f --- /dev/null +++ b/tests/system/webdriver/Pages/SiteContent/SitePage.php @@ -0,0 +1,115 @@ + id for the toolbar buttons + */ + public $toolbar = array(); + + /** + * @var string This is the URL for this page. We check this when a new page class is loaded. + */ + protected $url = null; + + /** + * + * @var array of top menu text that is visible in all frontend pages + */ + public $visibleMenuText = array ('Home','Sample Sites','Joomla.org'); + + /** + * constructor function + * + * @param Webdriver $driver Driver for this test. + * @param JoomlaWebdriverTestClass $test Test class object (needed to create page class objects) + * @param string $url Optional URL to load when object is created. Only use for initial page load. + */ + public function __construct(Webdriver $driver, $test, $url = null) + { + $this->driver = $driver; + /* @var $test JoomlaWebdriverTestCase */ + $this->test = $test; + $cfg = new SeleniumConfig; + + // Save current configuration + $this->cfg = $cfg; + + if ($url) + { + $this->driver->get($url); + } + + $element = $driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath), 5); + + if (isset($this->url)) + { + $test->assertContains($this->url, $driver->getCurrentPageUrl(), 'URL for page does not match expected value.'); + } + } + + /** + * @return String + */ + public function __toString() + { + return $this->driver->getCurrentPageUrl(); + } + + /** + * Checks for notices on a page. + * + * @return bool true if notices or warnings present on page + */ + public function checkForNotices() + { + $haystack = strip_tags($this->driver->pageSource()); + + return (bool) (stripos($haystack, "( ! ) Notice") || stripos($haystack, "( ! ) Warning")); + } +} diff --git a/tests/system/webdriver/Pages/SiteContent/SiteSingleArticlePage.php b/tests/system/webdriver/Pages/SiteContent/SiteSingleArticlePage.php new file mode 100644 index 0000000000000..4255f7c196eaf --- /dev/null +++ b/tests/system/webdriver/Pages/SiteContent/SiteSingleArticlePage.php @@ -0,0 +1,91 @@ +driver->findElements(By::xPath("//h2[contains(., '" . $articleTitle . "')]")); + + if (count($arrayElement) > 0) + { + return true; + } + + else + { + return false; + } + } + + /** + * Function which checks of edit icon is ppresent on the page or not + * + * @return True or Flase + */ + public function isEditPresent() + { + $arrayElement = $this->driver->findElements(By::xPath("//a[contains(text(), 'Edit')]")); + + if (count($arrayElement > 0)) + { + return true; + } + + else + { + return false; + } + } +} diff --git a/tests/system/webdriver/Pages/System/AdminEditPage.php b/tests/system/webdriver/Pages/System/AdminEditPage.php new file mode 100644 index 0000000000000..49e3f69fae6a9 --- /dev/null +++ b/tests/system/webdriver/Pages/System/AdminEditPage.php @@ -0,0 +1,539 @@ + => . + * Note that each menu item type has its own options and its own groups. + * These are the common ones for almost all core menu item types. + * + * @var array + * @since 3.2 + */ + public $groups = array(); + + /** + * Array of expected id values for toolbar div elements + * @var array + */ + public $toolbar = array ( + 'Save' => 'toolbar-apply', + 'Save & Close' => 'toolbar-save', + 'Save & New' => 'toolbar-save-new', + 'Cancel' => 'toolbar-cancel', + 'Help' => 'toolbar-help', + ); + + public $inputFields = array(); + + public function __construct(Webdriver $driver, $test, $url = null) + { + $this->driver = $driver; + $this->test = $test; + $cfg = new SeleniumConfig(); + $this->cfg = $cfg; // save current configuration + if ($url) + { + $this->driver->get($url); + } + $element = $driver->waitForElementUntilIsPresent(By::xPath($this->waitForXpath), 5); + if (isset($this->url)) + { + $test->assertTrue(strpos($driver->getCurrentPageUrl(), $this->url) >= 0, 'URL for page does not match expected value.'); + } + } + + public function getAllInputFields($tabIds = array()) + { + $return = array(); + if (count($tabIds) > 0) + { + // Get header fields + $return = $this->getInputFieldsForHeader(); + foreach ($tabIds as $tabId) + { + + $tabLink = $this->driver->findElement(By::xPath("//ul[@class='nav nav-tabs']//a[contains(@href, '" . $tabId . "')]")); + $tabLink->click(); + + // If there are accordian groups inside this tab, loop through each group + if (isset($this->groups[$tabId])) + { + foreach ($this->groups[$tabId] as $groupLabel) + { + $this->expandAccordionGroup($groupLabel); + $return = array_merge($return, $this->getInputFieldsForTab($tabId, $groupLabel)); + } + } + else + { + $return = array_merge($return, $this->getInputFieldsForTab($tabId)); + } + + } + } + else + { + $labels = $this->driver->findElements(By::xPath("//fieldset/div[@class='control-group']/div/label")); + $tabId = 'header'; + foreach ($labels as $label) + { + $return[] = $this->getInputField($tabId, $label); + } + } + return $return; + } + + protected function getInputFieldsForTab($tabId, $groupLabel = null) + { + $labels = $this->driver->findElements(By::xPath("//div[@id='" . $tabId . "']//div/label")); + return $this->getInputFieldObjects($labels, $tabId, $groupLabel); + } + + protected function getInputFieldsForHeader() + { + $labels = $this->driver->findElements(By::xPath("//div[contains(@class, 'form-inline')]//div/label")); + return $this->getInputFieldObjects($labels, 'header'); + } + + protected function getInputFieldObjects($labels, $tabId, $groupLabel = null) + { + $return = array(); + foreach ($labels as $label) + { + if ($object = $this->getInputField($tabId, $label)) + { + if ($groupLabel) + { + $object->group = $groupLabel; + } + $return[] = $object; + } + } + return $return; + } + + protected function expandAccordionGroup($groupLabel) + { + $toggleSelector = "//a[@class='accordion-toggle'][contains(text(),'" . $groupLabel . "')]"; + $containerSelector = $toggleSelector . "/../../..//div[contains(@class, 'accordion-body')]"; + $toggleElement = $this->driver->findElement(By::xPath($toggleSelector)); + $containerElement = $this->driver->findElement(By::xPath($containerSelector)); + if ($containerElement->getAttribute('class') == 'accordion-body collapse') + { + try + { + $toggleElement->click(); + } + catch (Exception $e) + { + $this->driver->executeScript("window.scrollBy(0,400)"); + $toggleElement->click(); + $this->driver->executeScript("window.scrollTo(0,0)"); + } + + } + sleep(1); + + } + + protected function getInputField($tabId, $label) + { + $object = new stdClass(); + $object->tab = $tabId; + $object->labelText = $label->getText(); + + // Skip non-visible fields (affects permissions) + if ($object->labelText == '') + { + return false; + } + $inputId = $label->getAttribute('for'); + $testInput = $this->driver->findElements(By::id($inputId)); + // If not found, check for user name field + if (count($testInput) == 0) + { + // Check for user name + $testInput = $this->driver->findElements(By::id($inputId . '_name')); + if (count($testInput) == 1) + { + $inputId = $inputId . '_name'; + } + } + if (count($testInput) == 1) + { + $input = $testInput[0]; + $object->tag = $input->getTagName(); + $object->id = $inputId; + $object->labelId = $label->getAttribute('id'); + $object->type = $input->getAttribute('type'); + $object->element = $input; + return $object; + } + else + { + return false; + } + } + + public function getFieldValue($label) + { + if (($i = $this->getRowNumber($label)) !== false) + { + $fieldArray = $this->inputFields[$i]; + $fieldType = $fieldArray['type']; + switch ($fieldType) + { + case 'select' : + return $this->getSelectValues($fieldArray); + break; + + case 'fieldset' : + return $this->getRadioValues($fieldArray); + break; + + case 'input' : + case 'textarea' : + return $this->getTextValues($fieldArray); + break; + + } + } + + } + + public function getOptionText(WebElement $el) + { + $optionText = array(); + $options = $el->findElements(By::tagName('li')); + $i = 0; + foreach ($options as $option) + { + $optionText[] = $option->getText(); + if ($i++ > 5) { + $optionText[] = '...'; + break; + } + } + return $optionText; + } + + protected function getRadioValues(array $values) + { + $this->selectTab($values['tab']); + return $this->driver->findElement(By::xPath("//" . $values['type'] . "[@id='" . $values['id'] . "']/label[contains(@class, 'active')]"))->getText(); + } + + protected function getRowNumber($label) + { + $count = count($this->inputFields); + for ($i = 0; $i < $count; $i++) + { + if (strtolower($this->inputFields[$i]['label']) == strtolower($label)) return $i; + } + return false; + } + + protected function getSelectValues (array $values) + { + $this->selectTab($values['tab']); + // Need to determine whether we are using Chosen JS for this select field + $checkArray = $this->driver->findElements(By::xPath("//div[@id='" . $values['id'] . "_chzn']")); + if (count($checkArray) == 1) + { + $container = $checkArray[0]; + return $this->driver->findElement(By::xPath("//div[@id='" . $values['id'] . "_chzn']/a/span"))->getText(); + } + else + { + return $this->driver->findElement(By::xPath("//select[@id='jform_parent_id']/option[@selected='selected']"))->getText(); + } + } + + public function getTabIds() + { + $tabs = $this->driver->findElements(By::xPath("//div[@class='tab-content']/div")); + $return = array(); + foreach ($tabs as $tab) + { + $return[] = $tab->getAttribute('id'); + } + return $return; + } + + protected function getTextValues(array $values) + { + $this->selectTab($values['tab']); + return $this->driver->findElement(By::id($values['id']))->getAttribute('value'); + } + + public function getToolbarElements() + { + return $this->driver->findElements(By::xPath("//div[@id='toolbar']/ul/li")); + } + + public function getToolTip($tabText, $id) + { + $this->selectTab($tabText); + $el = $this->driver->findElement(By::id($id)); + $test = $this->driver->executeScript("document.getElementById(arguments[0]).fireEvent('mouseenter');", array($id)); + sleep(1); + $tip = $el->findElement(By::xPath("//div[@class='tip-text']")); + $tipText = $tip->getText(); + return str_replace("\n", " ", $tipText); + } + + public function printFieldArray($actualFields) + { + foreach ($actualFields as $field) + { + $field->labelText = (substr($field->labelText, -2) == ' *') ? substr($field->labelText, 0, -2) : $field->labelText; + echo "array('label' => '" . $field->labelText . "', 'id' => '" . $field->id . "', 'type' => '" . $field->tag . "', 'tab' => '" + . $field->tab . "'),\n"; + } + } + + public function selectTab($label, $group = null) + { + if ($label == 'header') + { + return; + } + $this->driver->executeScript("window.scrollTo(0,0)"); + $el = $this->driver->findElement(By::xPath("//ul[@class='nav nav-tabs']//a[contains(@href, '" . strtolower($label) . "')]")); + $el->click(); + sleep(1); + $el->click(); + if ($group) + { + $this->expandAccordionGroup($group); + } + } + + public function setFieldValue($label, $value) + { + if (($i = $this->getRowNumber($label)) !== false) + { + $fieldArray = $this->inputFields[$i]; + $fieldArray['value'] = $value; + $fieldType = $fieldArray['type']; + $group = isset($fieldArray['group']) ? $fieldArray['group'] : null; + $this->selectTab($fieldArray['tab'], $group); + switch ($fieldType) + { + case 'select' : + $this->setSelectValues($fieldArray); + break; + + case 'fieldset' : + $this->setRadioValues($fieldArray); + break; + + case 'input' : + $this->setTextValues($fieldArray); + break; + + case 'textarea' : + $this->setTextAreaValues($fieldArray); + break; + } + } + } + + public function setFieldValues(array $array) + { + foreach ($array as $label => $value) + { + $this->setFieldValue($label, $value); + } + return $this; + } + + protected function setRadioValues(array $values) + { + $this->driver->findElement(By::xPath("//" . $values['type'] . "[@id='" . $values['id'] . "']/label[contains(text(), '" . $values['value'] . "')]"))->click(); + } + + protected function setSelectValues (array $values) + { + // Need to determine whether we are using Chosen JS for this select field + $checkArray = $this->driver->findElements(By::xPath("//div[@id='" . $values['id'] . "_chzn']")); + if (count($checkArray) == 1) + { + // Process a Chosen select field + $container = $checkArray[0]; + + $type = $container->getAttribute('class'); + if (strpos($type, 'chzn-container-single-nosearch') > 0) + { + $selectElement = $this->driver->findElement(By::xPath("//div[@id='" . $values['id'] . "_chzn']/a")); + if (!$selectElement->isDisplayed()) + { + $selectElement->getLocationOnScreenOnceScrolledIntoView(); + } + $selectElement->click(); + + // Click the last element in the list to make sure they are all in view + $lastElement = $this->driver->findElement(By::xPath("//div[@id='" . $values['id'] . "_chzn']//ul[@class='chzn-results']/li[last()]")); + if (!$lastElement->isDisplayed()) + { + $lastElement->getLocationOnScreenOnceScrolledIntoView(); + } + $this->driver->findElement(By::xPath("//div[@id='" . $values['id'] . "_chzn']//ul[@class='chzn-results']/li[contains(.,'" . $values['value'] . "')]"))->click(); + } + elseif (strpos($type, 'chzn-container-single') > 0) + { + $this->driver->findElement(By::xPath("//div[@id='" . $values['id'] . "_chzn']/a"))->click(); + $el = $this->driver->findElement(By::xPath("//div[@id='" . $values['id'] . "_chzn']//input")); + $el->clear(); + $el->sendKeys($values['value']); + $el->sendKeys(chr(9)); + } + } + else + { + // Process a standard Select field + $this->driver->findElement(By::xPath("//select[@id='jform_parent_id']/option[contains(., '" . $values['value'] . "')]"))->click(); + } + } + + protected function setTextValues(array $values) + { + $inputElement = $this->driver->findElement(By::id($values['id'])); + $inputElement->clear(); + $inputElement->sendKeys($values['value']); + } + + protected function setTextAreaValues(array $values) + { + // Check whether this field uses a GUI editor + // First see if we are inside a tab + $tab = $this->driver->findElements(By::xPath("//div[@class='tab-pane active']")); + if ((isset($tab) && is_array($tab) && count($tab) == 1)) + { + $guiEditor = $tab[0]->findElements(By::xPath("//div[@class='tab-pane active']//a[contains(@onclick, 'mceToggleEditor')]")); + } + else + { + $guiEditor = $this->driver->findElements(By::xPath("//a[contains(@onclick, 'mceToggleEditor')]")); + } + if (isset($guiEditor) && is_array($guiEditor) && count($guiEditor) == 1 && $guiEditor[0]->isDisplayed()) + { + $this->driver->executeScript("window.scrollBy(0,400)"); + $guiEditor[0]->click(); + } + + $inputElement = $this->driver->findElement(By::id($values['id'])); + $inputElement->clear(); + $inputElement->sendKeys($values['value']); + + if (isset($guiEditor) && is_array($guiEditor) && count($guiEditor) == 1 && $guiEditor[0]->isDisplayed()) + { + $this->driver->executeScript("window.scrollBy(0,400)"); + $guiEditor[0]->click(); + } + $this->driver->executeScript("window.scrollTo(0,0)"); + } + + /** + * Output help screen for the page. + */ + public function toWikiHelp() + { + $inputFields = $this->getAllInputFields($this->getTabIds()); + $tabs = $this->tabs; + $helpText = array(); + foreach ($inputFields as $el) + { + $this->selectTab($el->tab); + $el->labelText = (substr($el->labelText, -2) == ' *') ? substr($el->labelText, 0, -2) : $el->labelText; + if ($el->tag == 'fieldset') + { + $helpText[$el->tab][] = $this->toWikiHelpRadio($el); + } + elseif ($el->tag == 'select') + { + $helpText[$el->tab][] = $this->toWikiHelpSelect($el); + } + else + { + $helpText[$el->tab][] = "*'''" . $el->labelText . ":''' " . $this->getToolTip($el->tab, $el->id . '-lbl') . "\n"; + } + } + + foreach ($tabs as $tab) + { + $tabText = $this->driver->findElement(By::xPath("//a[@href='#" . $tab . "']"))->getText(); + $result[] = '===' . $tabText . "===\n"; + if (isset($helpText[$tabText])) + { + $result = array_merge($result, $helpText[$tabText]); + } + } + return implode("", $result); + + } + + /** + * Prepare wiki text for a radio button group + * Format is: *'''