1616
1717class ActionMergeUtilTest extends TestCase
1818{
19- /**
20- * Static ActionMergeUtil for all tests.
21- *
22- * @var ActionMergeUtil
23- */
24- private static $ MERGE_UTIL ;
25-
26- /**
27- * Set up method for ActionMergeUtil tests.
28- *
29- * @return void
30- */
31- public static function setUpBeforeClass ()
32- {
33- self ::$ MERGE_UTIL = new ActionMergeUtil ("actionMergeUtilTest " , "TestCase " );
34- }
35-
3619 /**
3720 * Test to validate actions are properly ordered during a merge.
3821 *
@@ -85,7 +68,8 @@ public function testResolveActionStepOrdering()
8568 ActionObject::MERGE_ACTION_ORDER_AFTER
8669 );
8770
88- $ orderedActions = self ::$ MERGE_UTIL ->resolveActionSteps ($ actions );
71+ $ mergeUtil = new ActionMergeUtil ("actionMergeUtilTest " , "TestCase " );
72+ $ orderedActions = $ mergeUtil ->resolveActionSteps ($ actions );
8973 $ orderedActionKeys = array_keys ($ orderedActions );
9074
9175 $ this ->assertEquals ($ testObjNamePosBeforeFirst , $ orderedActionKeys [0 ]);
@@ -94,26 +78,6 @@ public function testResolveActionStepOrdering()
9478 $ this ->assertEquals ($ testObjNamePosAfterEnd , $ orderedActionKeys [$ actionsLength + 2 ]);
9579 }
9680
97- /**
98- * Test to validate action steps properly resolve section element references.
99- *
100- * @return void
101- */
102- public function testResolveActionStepSectionData ()
103- {
104- $ this ->markTestIncomplete ('TODO ' );
105- }
106-
107- /**
108- * Test to validate action steps properly resolve page references.
109- *
110- * @return void
111- */
112- public function testResolveActionStepPageData ()
113- {
114- $ this ->markTestIncomplete ('TODO ' );
115- }
116-
11781 /**
11882 * Test to validate action steps properly resolve entity data references.
11983 *
@@ -149,4 +113,54 @@ public function testResolveActionStepEntityData()
149113
150114 $ this ->assertEquals ($ dataFieldValue , $ resolvedActions [$ actionName ]->getCustomActionAttributes ()[$ userInputKey ]);
151115 }
116+
117+ /**
118+ * Verify that an XmlException is thrown when an action references a non-existant action.
119+ *
120+ * @return void
121+ */
122+ public function testNoActionException ()
123+ {
124+ $ actionObjects = [];
125+
126+ $ actionObjects [] = new ActionObject ('actionKey1 ' , 'bogusType ' , []);
127+ $ actionObjects [] = new ActionObject (
128+ 'actionKey2 ' ,
129+ 'bogusType ' ,
130+ [],
131+ 'badActionReference ' ,
132+ ActionObject::MERGE_ACTION_ORDER_BEFORE
133+ );
134+
135+ $ this ->expectException ("\Magento\FunctionalTestingFramework\Exceptions\XmlException " );
136+
137+ $ actionMergeUtil = new ActionMergeUtil ("actionMergeUtilTest " , "TestCase " );
138+ $ actionMergeUtil ->resolveActionSteps ($ actionObjects );
139+ }
140+
141+ /**
142+ * Verify that a <waitForPageLoad> action is added after actions that have a wait (timeout property).
143+ *
144+ * @return void
145+ */
146+ public function testInsertWait ()
147+ {
148+ $ actionObjectOne = new ActionObject ('actionKey1 ' , 'bogusType ' , []);
149+ $ actionObjectOne ->setTimeout (42 );
150+ $ actionObjects = [$ actionObjectOne ];
151+
152+ $ actionMergeUtil = new ActionMergeUtil ("actionMergeUtilTest " , "TestCase " );
153+ $ result = $ actionMergeUtil ->resolveActionSteps ($ actionObjects );
154+
155+ $ actual = $ result ['actionKey1WaitForPageLoad ' ];
156+ $ expected = new ActionObject (
157+ 'actionKey1WaitForPageLoad ' ,
158+ 'waitForPageLoad ' ,
159+ ['timeout ' => 42 ],
160+ 'actionKey1 ' ,
161+ 0
162+ );
163+ $ this ->assertEquals ($ expected , $ actual );
164+
165+ }
152166}
0 commit comments