Commit 9cc3fde1 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'master' into FE_Label-text-align_right

parents ab4e4c62 56a73251
......@@ -2893,7 +2893,7 @@ See also at specific *FormElement* definitions.
+------------------------+--------+ |
| messageFail | string | |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| dataSelenium | string | Optional. See `seleniumTest`_ |
| dataReference | string | Optional. See `applicationTest`_ |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
......@@ -5472,7 +5472,7 @@ Column: _link
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| | |Class |c:[n|<text>] |c:text-muted |CSS class for link. n:no class attribute, <text>: explicit named |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| | |Attribute |A:<key>="<value"> |A:data-selenium="person" |Custom attributes and a corresponding value. Might be used by Selenium tests. |
| | |Attribute |A:<key>="<value"> |A:data-reference="person" |Custom attributes and a corresponding value. Might be used by application tests. |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
| | |Target |g:<text> |g:_blank |target=_blank,_self,_parent,<custom>. Default: no target |
+---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
......@@ -7526,27 +7526,29 @@ AutoCron / website: HTTPS protocol
* All certificates are accepted, even self signed without a correct chain or hostnames, not listed in the certificate.
This is useful if there is a general 'HTTP >> HTTPS' redirection configured and the website is accessed via `https://localhost/...`
.. _seleniumTest:
.. _applicationTest:
Selenium Test
=============
Application Test
================
With https://www.seleniumhq.org/ it's possible to play and verify automate test cases. To simplify the process of automatically
identifying HTML elements, a tag might be assigned to elements which have to interact with the test framework.
With a framework like https://www.seleniumhq.org/ it's possible to play and verify unattended test cases.
To assist such frameworks and to make the tests reliable, an individual tag might be assigned to elements which have to
interact with the test framework.
Form
----
By default every FormElement contains an attribute 'data-selenium=<value>', whereas the '<value>' is either the name
of the FormElement or a custom value, defined via 'FormElement.parameter.dataSelenium=<value>'.
By default every FormElement contains an attribute 'data-reference=<value>', whereas the '<value>' is either the name
of the FormElement or a custom value, defined via 'FormElement.parameter.dataReference=<value>'.
Report
------
Any HTML output can be extended by a tag. For QFQ generated links, an attribute like 'data-selenium' might be injected
via token 'A' (attribute). ::
Any HTML output can be extended by a tag - that's done by the webmaster. For QFQ generated links, an attribute like
'data-reference' might be injected via token 'A' (attribute). ::
SELECT 'p:personedit&form=person&r=1|b|s|A:data-selenium="person-edit"|t:Edit person' AS _link
SELECT 'p:personedit&form=person&r=1|b|s|A:data-reference="person-edit"|t:Edit person' AS _link
.. _help:
......
......@@ -22,7 +22,7 @@ description = Documentation for the Typo3 Extension 'QFQ'
[notify]
about_new_builds = carsten.rose@math.uzh.ch
about_new_build = carsten.rose@math.uzh.ch
[html_theme_options]
......
......@@ -1240,7 +1240,7 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID]);
$attribute .= Support::doAttribute('name', $htmlFormElementName);
$attribute .= Support::doAttribute('class', $class);
$attribute .= Support::doAttribute(SELENIUM_ATTRIBUTE_DATA, $formElement[FE_DATA_SELENIUM]);
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE]);
if (isset($formElement[FE_RETYPE_SOURCE_NAME])) {
$htmlFormElementNamePrimary = str_replace(RETYPE_FE_NAME_EXTENSION, '', $htmlFormElementName);
......@@ -1796,7 +1796,7 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('value', $formElement[FE_CHECKBOX_CHECKED], false);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
$attribute .= Support::doAttribute(FE_INPUT_AUTOCOMPLETE, 'off');
$attribute .= Support::doAttribute(SELENIUM_ATTRIBUTE_DATA, $formElement[FE_DATA_SELENIUM]);
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE]);
$classActive = '';
if ($formElement[FE_CHECKBOX_CHECKED] === $value) {
......@@ -1856,7 +1856,7 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('name', $htmlFormElementName);
$attribute .= Support::doAttribute('value', $formElement[FE_CHECKBOX_CHECKED], false);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
$attribute .= Support::doAttribute(SELENIUM_ATTRIBUTE_DATA, $formElement[FE_DATA_SELENIUM]);
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE]);
if ($formElement[FE_CHECKBOX_CHECKED] === $value) {
$attribute .= Support::doAttribute('checked', 'checked');
......@@ -1981,7 +1981,7 @@ abstract class AbstractBuildForm {
$htmlFormElementNameUniq = HelperFormElement::prependFormElementNameCheckBoxMulti($htmlFormElementName, $ii);
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID] . '-' . $ii);
$attribute .= Support::doAttribute('name', $htmlFormElementNameUniq);
$attribute .= Support::doAttribute(SELENIUM_ATTRIBUTE_DATA, $formElement[FE_DATA_SELENIUM] . '-' . $ii);
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE] . '-' . $ii);
$attribute .= Support::doAttribute('value', $itemKey[$ii]);
......@@ -2057,7 +2057,7 @@ abstract class AbstractBuildForm {
$htmlFormElementNameUniq = HelperFormElement::prependFormElementNameCheckBoxMulti($htmlFormElementName, $ii);
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID] . '-' . $ii);
$attribute .= Support::doAttribute('name', $htmlFormElementNameUniq);
$attribute .= Support::doAttribute(SELENIUM_ATTRIBUTE_DATA, $formElement[FE_DATA_SELENIUM] . '-' . $ii);
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE] . '-' . $ii);
// Do this only the first round.
if ($flagFirst) {
......@@ -2226,7 +2226,7 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID] . '-' . $ii);
$attribute .= Support::doAttribute('value', $itemKey[$ii], false); // Always set value, even to '' - #3832
$attribute .= Support::doAttribute(SELENIUM_ATTRIBUTE_DATA, $formElement[FE_DATA_SELENIUM] . '-' . $ii);
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE] . '-' . $ii);
if ($itemKey[$ii] == $value) {
$attribute .= Support::doAttribute('checked', 'checked');
......@@ -2320,7 +2320,7 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID] . '-' . $ii);
$attribute .= Support::doAttribute('value', $itemKey[$ii], false); // Always set value, even to '' - #3832
$attribute .= Support::doAttribute(SELENIUM_ATTRIBUTE_DATA, $formElement[FE_DATA_SELENIUM] . '-' . $ii);
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE] . '-' . $ii);
if ($itemKey[$ii] == $value) {
$attribute .= Support::doAttribute('checked', 'checked');
......@@ -2396,7 +2396,7 @@ abstract class AbstractBuildForm {
$attribute .= $this->getAttributeList($formElement, ['autofocus']);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
$attribute .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
$attribute .= Support::doAttribute(SELENIUM_ATTRIBUTE_DATA, $formElement[FE_DATA_SELENIUM]);
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE]);
if (isset($formElement[FE_SIZE]) && $formElement[FE_SIZE] > 1) {
$attribute .= Support::doAttribute('size', $formElement[FE_SIZE]);
......@@ -3053,7 +3053,7 @@ abstract class AbstractBuildForm {
$attribute .= $this->getAttributeList($formElement, [FE_AUTOFOCUS, FE_FILE_MIME_TYPE_ACCEPT]);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
$attribute .= Support::doAttribute('data-sip', $sipUpload);
$attribute .= Support::doAttribute(SELENIUM_ATTRIBUTE_DATA, $formElement[FE_DATA_SELENIUM]);
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE]);
$json = $this->getFormElementForJson($htmlFormElementName, $value, $formElement); // Below, $formElement[FE_MODE]=FE_MODE_REQUIRED will be changed. Get the JSON unchanged
......@@ -3160,7 +3160,7 @@ abstract class AbstractBuildForm {
$attributeInput .= Support::doAttribute('name', $htmlFormElementName);
$attributeInput .= Support::doAttribute('type', 'hidden');
$attributeInput .= Support::doAttribute('value', htmlentities($value), false);
$attributeInput .= Support::doAttribute(SELENIUM_ATTRIBUTE_DATA, $formElement[FE_DATA_SELENIUM]);
$attributeInput .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE]);
$htmlInput = Support::wrapTag('<input ' . $attributeInput . ' >', '', false);
......@@ -3228,7 +3228,7 @@ abstract class AbstractBuildForm {
$attributeInput = Support::doAttribute('id', $htmlFabricId);
$attributeInput .= Support::doAttribute('name', $htmlFormElementName);
$attributeInput .= Support::doAttribute('type', 'hidden');
$attributeInput .= Support::doAttribute(SELENIUM_ATTRIBUTE_DATA, $formElement[FE_DATA_SELENIUM]);
$attributeInput .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE]);
$htmlInput = Support::wrapTag('<input ' . $attributeInput . ' >', '', false);
......@@ -3287,7 +3287,7 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID]);
$attribute .= Support::doAttribute('name', $htmlFormElementName);
$attribute .= Support::doAttribute('class', 'form-control');
$attribute .= Support::doAttribute(SELENIUM_ATTRIBUTE_DATA, $formElement[FE_DATA_SELENIUM]);
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE]);
$showTime = ($formElement[FE_TYPE] == 'time' || $formElement[FE_TYPE] == 'datetime') ? 1 : 0;
if ($value == 'CURRENT_TIMESTAMP') {
......@@ -3490,7 +3490,7 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID]);
$attribute .= Support::doAttribute('name', $htmlFormElementName);
// $attribute .= Support::doAttribute('id', $htmlFormElementName);
$attribute .= Support::doAttribute(SELENIUM_ATTRIBUTE_DATA, $formElement[FE_DATA_SELENIUM]);
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE]);
$attribute .= Support::doAttribute('class', 'qfq-tinymce');
$attribute .= Support::doAttribute('data-control-name', "$htmlFormElementName");
......@@ -3640,7 +3640,7 @@ abstract class AbstractBuildForm {
$json = $this->getFormElementForJson($htmlFormElementName, $value, $formElement);
$attribute = Support::doAttribute('id', $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_INPUT);
$attribute .= Support::doAttribute(SELENIUM_ATTRIBUTE_DATA, $formElement[FE_DATA_SELENIUM]);
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE]);
return Support::wrapTag("<div $attribute class='" . CLASS_NOTE . "'>", $value);
}
......@@ -3687,7 +3687,7 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID]);
$attribute .= Support::doAttribute('name', $htmlFormElementName);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
$attribute .= Support::doAttribute(SELENIUM_ATTRIBUTE_DATA, $formElement[FE_DATA_SELENIUM]);
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE]);
// <fieldset>
$html = '<fieldset ' . $attribute . '>';
......@@ -3819,7 +3819,7 @@ EOT;
$attribute .= Support::doAttribute('id', $targetName);
$attribute .= Support::doAttribute('data-qfq-line-template', '#' . $templateName);
$attribute .= Support::doAttribute('data-qfq-line-add-button', '#' . $addButtonId);
$attribute .= Support::doAttribute(SELENIUM_ATTRIBUTE_DATA, $formElement[FE_DATA_SELENIUM]);
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE]);
// Element where the effective FormElements will be copied to. The BS 'col-md-* Classes are inside the template, not here. This here should be pure data without wrapping.
$html = Support::wrapTag("<div $attribute>", $html, false);
......
......@@ -987,7 +987,7 @@ const FE_SIZE = 'size';
const FE_SUBRECORD_OPTION = 'subrecordOption';
const FE_SQL1 = 'sql1';
const FE_PLACEHOLDER = 'placeholder';
const FE_DATA_SELENIUM = 'dataSelenium';
const FE_DATA_REFERENCE = 'dataReference';
// FormElement columns: via parameter field
const FE_DATE_FORMAT = 'dateFormat'; // value: FORMAT_DATE_INTERNATIONAL | FORMAT_DATE_GERMAN
......@@ -1677,5 +1677,5 @@ const DND_SUBRECORD_ID = 'dnd-subrecord-id'; // Internal qualifier used to commu
const DND_SUBRECORD_FORM_ID = 'dnd-subrecord-form-id';
const DND_ORD_HTML_ID_PREFIX = 'qfq-dnd-ord-id-';
// SELENIUM
const SELENIUM_ATTRIBUTE_DATA = 'data-selenium';
\ No newline at end of file
// Application Test: SELENIUM
const ATTRIBUTE_DATA_REFERENCE = 'data-reference';
\ No newline at end of file
......@@ -798,7 +798,7 @@ class Support {
self::setIfNotSet($formElement, FE_HTML_BEFORE);
self::setIfNotSet($formElement, FE_HTML_AFTER);
self::setIfNotSet($formElement, FE_DATA_SELENIUM, ($formElement[FE_NAME]=='' ? $formElement[FE_ID] : $formElement[FE_NAME]) );
self::setIfNotSet($formElement, FE_DATA_REFERENCE, ($formElement[FE_NAME]=='' ? $formElement[FE_ID] : $formElement[FE_NAME]) );
self::setIfNotSet($formElement, FE_SUBRECORD_TABLE_CLASS, SUBRECORD_TABLE_CLASS_DEFAULT);
......
......@@ -1014,16 +1014,16 @@ class LinkTest extends TestCase {
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
// Standard
$result = $link->renderLink('p:editperson|A:data-selenium="editperson"');
$this->assertEquals('<a href="?id=editperson" data-selenium="editperson" >?id=editperson</a>', $result);
$result = $link->renderLink('p:editperson|A:data-reference="editperson"');
$this->assertEquals('<a href="?id=editperson" data-reference="editperson" >?id=editperson</a>', $result);
// BS Button & SIP
$result = $link->renderLink('p:editperson|A:data-selenium="editperson"|b|s');
$this->assertEquals('<a href="index.php?id=editperson&s=badcaffee1234" class="btn btn-default" data-selenium="editperson" >index.php?id=editperson&s=badcaffee1234</a>', $result);
$result = $link->renderLink('p:editperson|A:data-reference="editperson"|b|s');
$this->assertEquals('<a href="index.php?id=editperson&s=badcaffee1234" class="btn btn-default" data-reference="editperson" >index.php?id=editperson&s=badcaffee1234</a>', $result);
// Render mode 3 (disabled)
$result = $link->renderLink('p:editperson|A:data-selenium="editperson"|r:3');
$this->assertEquals('<span data-selenium="editperson" >?id=editperson</span>', $result);
$result = $link->renderLink('p:editperson|A:data-reference="editperson"|r:3');
$this->assertEquals('<span data-reference="editperson" >?id=editperson</span>', $result);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment