Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
CristianPContreras opened this issue Mar 21, 2022 · 0 comments

Comments

@CristianPContreras
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant