Created
March 8, 2024 16:28
Revisions
-
jerclarke renamed this gist
Mar 8, 2024 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
jerclarke created this gist
Mar 8, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ <?php # Helper methods to add to the acceptance tester class ($I) /** * Run this before submitting a form/clicking link when we want to check the page reloaded later * * Sets a JS var that we can check later to know that the page * has reloaded * * @param AcceptanceTester $I * @return void */ public function gvAmOnPageBeforeReload(\AcceptanceTester $I) { $I->waitForJS('return document.oldPage = "yes"'); } /** * Run this after submitting form/clicking link to confirm page has reloaded * * @param AcceptanceTester $I * @return void */ public function gvAmOnPageAfterReload(\AcceptanceTester $I) { $I->waitForJS('return document.oldPage !== "yes"'); } # Example usage in a test helper method: public function _gvUserProfileUpdateEmail(AcceptanceTester $I, string $email) { $I->fillField(['name' => 'email'], $email); $I->scrollTo("#wpfooter"); $I->gvAmOnPageBeforeReload($I); $I->click('Update User'); $I->gvAmOnPageAfterReload($I); $I->seeInField('email', $email); }