Created
August 9, 2019 11:54
-
-
Save filiphric/fedd7ff55a2ff2bd52242494fa059a20 to your computer and use it in GitHub Desktop.
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
| describe('Logging to Google SSO protected event', () => { | |
| it('Receive token and successfully open app', () => { | |
| const socialLoginOptions = { | |
| username: // google name here | |
| password: // google password here | |
| loginUrl: // your login page (in your app), where you would click on a „login with google“ button, this is url which puppeteer will open | |
| resolveUrl: // the page where you land after you come back from google | |
| headless: // set to tru | |
| loginSelector: // this would be the selector of „login with google“ button where your puppeteer script would click | |
| postLoginSelector: // selector on a page where you land after you come back from google login, basicaly to tell you that your page was loaded | |
| }; | |
| // google login done via puppeteer, passing socialLoginOptions as arguments to GoogleSocialLogin task | |
| cy | |
| .task('GoogleSocialLogin', socialLoginOptions) | |
| .then( authorization => { | |
| let token = authorization.myCookie; | |
| cy | |
| .setCookie(token); // set the authorization to browser | |
| }); | |
| // open browser | |
| cy | |
| .visit(); // visit the app you should now be authorized in | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment