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)
379379 $ this ->waitForLoadingMaskToDisappear ($ timeout );
380380 }
381381
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+
382397 /**
383398 * Wait for all visible loading masks to disappear. Gets all elements by mask selector, then loops over them.
384399 *
Original file line number Diff line number Diff line change 2020 <xs : element type =" waitForJSType" name =" waitForJS" minOccurs =" 0" maxOccurs =" unbounded" />
2121 <xs : element type =" waitForLoadingMaskToDisappearType" name =" waitForLoadingMaskToDisappear" minOccurs =" 0" maxOccurs =" unbounded" />
2222 <xs : element type =" waitForPageLoadType" name =" waitForPageLoad" minOccurs =" 0" maxOccurs =" unbounded" />
23+ <xs : element type =" waitForReactPageLoadType" name =" waitForReactPageLoad" minOccurs =" 0" maxOccurs =" unbounded" />
2324 <xs : element type =" waitForTextType" name =" waitForText" minOccurs =" 0" maxOccurs =" unbounded" />
2425 </xs : choice >
2526 </xs : group >
176177 </xs : simpleContent >
177178 </xs : complexType >
178179
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+
179194 <xs : complexType name =" waitForTextType" >
180195 <xs : annotation >
181196 <xs : documentation >
You can’t perform that action at this time.
0 commit comments