lirantal / cypress-social-logins

Cypress authentication flows using social network providers
Apache License 2.0
247 stars 78 forks source link

Question About additional steps #111

Closed davidkhayutin closed 1 month ago

davidkhayutin commented 2 years ago

Hello

I have been able to successfully login with google - however on my app - after google login completes - there is an additional step to fill out within my application - and I wondering if something like this will be possible to do

I read the documentation regarding additional steps - but this does not seem to integrate with using the native GoogleSocialLogin or perhaps I am using it wrong

If so could you please supply a working example of how that would look in both the config file but also the test case

lirantal commented 2 years ago

You can do the in-app step in your own Cypress test code, that shouldn't be part of this plugin.

davidkhayutin commented 2 years ago

I dont think it will work that way given how the app is currently build

currently in my extra steps function I am trying to find an element on screen but I get an error every time

const completeRegistrationFlow = async ({ page, options } = {}) => {
  await page.waitForSelector('#schoolSelection')
}

Screen Shot 2022-01-27 at 11 37 53 AM

being called with

  on('task', {
    customizedLogin: (options) => {
      options.additionalSteps = completeRegistrationFlow
      return CustomizedLogin(options)
    },
  })
lirantal commented 2 years ago

That element is part of the login to Google screen or on your own app?

davidkhayutin commented 2 years ago

on the app - but its showing up in chromium - after google pop up closes on successful login

lirantal commented 2 years ago

The only callbacks that can help you are postLoginSelector to validate the login and postLoginClick. When the login is successful, you should do the rest of the flow of your app in your regular Cypress tests.