lirantal/cypress-social-logins

Cypress-social-logins plugin causes error: > Converting circular structure

CristianPContreras opened this issue · 1 comments

Current behavior
I am trying to use the cypress-social-logins plugin. To set up my environment, I am following these instructions: https://github.com/lirantal/cypress-social-logins

When I try to use the plugin I am getting the following error message.

cy.task('FacebookSocialLogin') failed with the following error: > Converting circular structure to JSON -->
starting at object with constructor 'Object' --- property 'window' closes the circle

The error being generated prevents any code/tests from being executed.

Note: I am only using two files to reproduce the problem

Desired behavior
The error should not be generated or the error should be more specific to the actual root cause of the problem. I cannot understand why the error is getting generated.

Test code to reproduce
integration/test.spec.js

before(() => {
const loginUrl = https://login.qa.companyname.com
const ssoURL = https://oktaServer
cy.request({
url: ssoURL,
method: 'POST',
body: {
loginName: 'username',
password: 'password',
},
}).then((response) => {
let oktaLogin = ${loginUrl}/login/idp-redirect?sessionToken=${response.body.sessionToken}
cy.visit(oktaLogin)
})
cy.visit(https://app.l1.companyname.com/pages/social/reach#/dashboard, { timeout: 1000000 });
cy.get('[data-qe-id="Button-connectAccount"]', { timeout: 60000 }).click();
})

it('Login into facebook', () => {
const url = cy.url()
const cookieName = "facebookCookie"
const socialLoginOptions = {
username: "zxcvxzcv@tfbnw.net",
password: "1321321",
loginUrl: url,
usernameField: '#email',
passwordField: '#pass',
headless: true,
logs: false,
}
cy.task('FacebookSocialLogin', socialLoginOptions).then(({cookies}) => {
const cookie = cookies.filter(cookie => cookie.name === cookieName).pop()
if (cookie) {
cy.setCookie(cookie.name, cookie.value, {
domain: cookie.domain,
expiry: cookie.expires,
httpOnly: cookie.httpOnly,
path: cookie.path,
secure: cookie.secure
})
Cypress.Cookies.defaults({
preserve: cookieName
})
}
})
})
plugins/index.js

const {GoogleSocialLogin} = require('cypress-social-logins').plugins

module.exports = (on, config) => {
on('task', {
GoogleSocialLogin: GoogleSocialLogin
})
}

Cypress Version
9.5.2

Cypress-social-logins Version
1.13.1

Going to close this for being stale but if any issues remain or more context to be shared, please comment and will re-open.