16
16
17
17
class ActionMergeUtilTest extends TestCase
18
18
{
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
-
36
19
/**
37
20
* Test to validate actions are properly ordered during a merge.
38
21
*
@@ -85,7 +68,8 @@ public function testResolveActionStepOrdering()
85
68
ActionObject::MERGE_ACTION_ORDER_AFTER
86
69
);
87
70
88
- $ orderedActions = self ::$ MERGE_UTIL ->resolveActionSteps ($ actions );
71
+ $ mergeUtil = new ActionMergeUtil ("actionMergeUtilTest " , "TestCase " );
72
+ $ orderedActions = $ mergeUtil ->resolveActionSteps ($ actions );
89
73
$ orderedActionKeys = array_keys ($ orderedActions );
90
74
91
75
$ this ->assertEquals ($ testObjNamePosBeforeFirst , $ orderedActionKeys [0 ]);
@@ -94,26 +78,6 @@ public function testResolveActionStepOrdering()
94
78
$ this ->assertEquals ($ testObjNamePosAfterEnd , $ orderedActionKeys [$ actionsLength + 2 ]);
95
79
}
96
80
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
-
117
81
/**
118
82
* Test to validate action steps properly resolve entity data references.
119
83
*
@@ -149,4 +113,54 @@ public function testResolveActionStepEntityData()
149
113
150
114
$ this ->assertEquals ($ dataFieldValue , $ resolvedActions [$ actionName ]->getCustomActionAttributes ()[$ userInputKey ]);
151
115
}
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
+ }
152
166
}
0 commit comments