File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
src/Magento/FunctionalTestingFramework Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -379,6 +379,21 @@ public function waitForPageLoad($timeout = null)
379
379
$ this ->waitForLoadingMaskToDisappear ($ timeout );
380
380
}
381
381
382
+ /**
383
+ * Wait for all React JavaScript to finish executing.
384
+ *
385
+ * @param integer $timeout
386
+ * @throws \Exception
387
+ * @return void
388
+ */
389
+ public function waitForReactPageLoad ($ timeout = null )
390
+ {
391
+ $ timeout = $ timeout ?? $ this ->_getConfig ()['pageload_timeout ' ];
392
+
393
+ $ this ->waitForJS ('return (!!Object.keys(document).filter(prop => /^_reactListenersID/.test(prop)).length) || (document.querySelector("[data-reactroot]") && Object.keys(rootEl).some(prop => /^__reactInternalInstance/.test(prop))); ' , $ timeout );
394
+ $ this ->waitForJS ("return document.readyState == 'complete'; " , $ timeout );
395
+ }
396
+
382
397
/**
383
398
* Wait for all visible loading masks to disappear. Gets all elements by mask selector, then loops over them.
384
399
*
Original file line number Diff line number Diff line change 20
20
<xs : element type =" waitForJSType" name =" waitForJS" minOccurs =" 0" maxOccurs =" unbounded" />
21
21
<xs : element type =" waitForLoadingMaskToDisappearType" name =" waitForLoadingMaskToDisappear" minOccurs =" 0" maxOccurs =" unbounded" />
22
22
<xs : element type =" waitForPageLoadType" name =" waitForPageLoad" minOccurs =" 0" maxOccurs =" unbounded" />
23
+ <xs : element type =" waitForReactPageLoadType" name =" waitForReactPageLoad" minOccurs =" 0" maxOccurs =" unbounded" />
23
24
<xs : element type =" waitForTextType" name =" waitForText" minOccurs =" 0" maxOccurs =" unbounded" />
24
25
</xs : choice >
25
26
</xs : group >
176
177
</xs : simpleContent >
177
178
</xs : complexType >
178
179
180
+ <xs : complexType name =" waitForReactPageLoadType" >
181
+ <xs : annotation >
182
+ <xs : documentation >
183
+ Waits up to given time for React page to have finished loading..
184
+ </xs : documentation >
185
+ </xs : annotation >
186
+ <xs : simpleContent >
187
+ <xs : extension base =" xs:string" >
188
+ <xs : attribute ref =" time" />
189
+ <xs : attributeGroup ref =" commonActionAttributes" />
190
+ </xs : extension >
191
+ </xs : simpleContent >
192
+ </xs : complexType >
193
+
179
194
<xs : complexType name =" waitForTextType" >
180
195
<xs : annotation >
181
196
<xs : documentation >
You can’t perform that action at this time.
0 commit comments