Skip to content

Commit b111c4d

Browse files
KevinBKozantomreece
authored andcommitted
MQE 292: Use "selector" name consistently instead of "locator"
* MQE-292 Renamed locator to selector where applicable (schema, objects, and handlers). Also removed locatorVariables element from schema, as it was deprecated by parameterized url/selector implementation. * MQE-292 Codesniffer fixes.
1 parent 7e23df8 commit b111c4d

File tree

4 files changed

+13
-20
lines changed

4 files changed

+13
-20
lines changed

src/Magento/FunctionalTestingFramework/Page/Handlers/SectionObjectHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class SectionObjectHandler implements ObjectHandlerInterface
2020
const TYPE = 'section';
2121
const SUB_TYPE = 'element';
2222
const ELEMENT_TYPE_ATTR = 'type';
23-
const ELEMENT_LOCATOR_ATTR = 'locator';
23+
const ELEMENT_SELECTOR_ATTR = 'selector';
2424
const ELEMENT_TIMEOUT_ATTR = 'timeout';
2525
const ELEMENT_PARAMETERIZED = 'parameterized';
2626

@@ -102,14 +102,14 @@ private function initSectionObjects()
102102
$elements = [];
103103
foreach ($sectionData[SectionObjectHandler::SUB_TYPE] as $elementName => $elementData) {
104104
$elementType = $elementData[SectionObjectHandler::ELEMENT_TYPE_ATTR];
105-
$elementLocator = $elementData[SectionObjectHandler::ELEMENT_LOCATOR_ATTR];
105+
$elementSelector = $elementData[SectionObjectHandler::ELEMENT_SELECTOR_ATTR];
106106
$elementTimeout = $elementData[SectionObjectHandler::ELEMENT_TIMEOUT_ATTR] ?? null;
107107
$elementParameterized = $elementData[SectionObjectHandler::ELEMENT_PARAMETERIZED] ?? false;
108108

109109
$elements[$elementName] = new ElementObject(
110110
$elementName,
111111
$elementType,
112-
$elementLocator,
112+
$elementSelector,
113113
$elementTimeout,
114114
$elementParameterized
115115
);

src/Magento/FunctionalTestingFramework/Page/Objects/ElementObject.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ElementObject
3131
*
3232
* @var string
3333
*/
34-
private $locator;
34+
private $selector;
3535

3636
/**
3737
* Section element timeout
@@ -51,15 +51,15 @@ class ElementObject
5151
* ElementObject constructor.
5252
* @param string $name
5353
* @param string $type
54-
* @param string $locator
54+
* @param string $selector
5555
* @param string $timeout
5656
* @param bool $parameterized
5757
*/
58-
public function __construct($name, $type, $locator, $timeout, $parameterized)
58+
public function __construct($name, $type, $selector, $timeout, $parameterized)
5959
{
6060
$this->name = $name;
6161
$this->type = $type;
62-
$this->locator = $locator;
62+
$this->selector = $selector;
6363
$this->timeout = $timeout;
6464
$this->parameterized = $parameterized;
6565
}
@@ -85,13 +85,13 @@ public function getType()
8585
}
8686

8787
/**
88-
* Getter for the locator of an element
88+
* Getter for the selector of an element
8989
*
9090
* @return string
9191
*/
92-
public function getLocator()
92+
public function getSelector()
9393
{
94-
return $this->locator;
94+
return $this->selector;
9595
}
9696

9797
/**

src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,10 @@
5858
</xs:documentation>
5959
</xs:annotation>
6060
</xs:attribute>
61-
<xs:attribute type="notEmptyType" name="locator" use="required">
61+
<xs:attribute type="notEmptyType" name="selector" use="required">
6262
<xs:annotation>
6363
<xs:documentation>
64-
Locator of the element. Use %s for placeholders for variables.
65-
</xs:documentation>
66-
</xs:annotation>
67-
</xs:attribute>
68-
<xs:attribute type="notEmptyType" name="locatorVariables" use="optional">
69-
<xs:annotation>
70-
<xs:documentation>
71-
Optional variable names separated by "," which are used to substitute %s in locator attribute.
64+
Selector of the element.
7265
</xs:documentation>
7366
</xs:annotation>
7467
</xs:attribute>

src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ private function findAndReplaceReferences($objectHandler, $inputString)
323323
throw new TestReferenceException("Could not resolve entity reference " . $inputString);
324324
}
325325
$parameterized = $obj->getElement($objField)->isParameterized();
326-
$replacement = $obj->getElement($objField)->getLocator();
326+
$replacement = $obj->getElement($objField)->getSelector();
327327
$this->timeout = $obj->getElement($objField)->getTimeout();
328328
break;
329329
case (get_class($obj) == EntityDataObject::class):

0 commit comments

Comments
 (0)