Last active
February 17, 2020 12:46
-
-
Save polevaultweb/e66b717b1c1937f31bd95e8d5f877722 to your computer and use it in GitHub Desktop.
Using Codeception to login to Google and approve permissions during oAuth2 login flow.
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 characters
<?php | |
$I->waitForText( 'Sign in with Google' ); | |
$I->fillField('#identifierId', $_ENV['GOOGLE_EMAIL']); | |
$I->wait(1); | |
$I->click('#identifierNext'); | |
$I->wait(1); | |
$I->fillField('password', $_ENV['GOOGLE_PASSWORD']); | |
$I->wait(1); | |
$I->click('#passwordNext'); | |
$I->wait(2); | |
if ( $I->seeOnPage( 'Grant' ) ) { | |
$this->executeJS('return document.querySelectorAll("[data-custom-id=\"oauthScopeDialog-allow\"]")[0].click()'); | |
$I->wait(1); | |
} | |
$I->click('#submit_approve_access'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Google account being used must allow less secure apps to sign in https://myaccount.google.com/u/3/lesssecureapps?pageId=none