cypress-social-logins
cypress-social-logins copied to clipboard
WebSocket is not open: readyState 3 (CLOSED)*
I tried to use this plugin, but what I observed (running headless = false) is when I am navigated to my test page, then element corresponding to postLoginSelector is clicked and google login window appears. At this point login window is closed and test fails with error WebSocket is not open: readyState 3 (CLOSED) Looking at the Stack Trace I can see this error is being fired by puppeteer on line 210 const pages = await browser.pages() Any idea what the issue could be and how to rectify this please?
"cypress-social-logins": "^1.11.2",
describe('Login page', () => {
before(() => {
cy.visit('/')
})
it('Login through Google', () => {
const username = 'my test name'
const password = 'and password'
const loginUrl = Cypress.config().baseUrl
const cookieName = 'authCookie'
const socialLoginOptions = {
username: username,
password: password,
loginUrl: loginUrl,
headless: false,
loginSelectorDelay : 2000,
otpSecret: 'otpSecretValueInHere',
loginSelector: 'button[type="button"]',
postLoginSelector: '[data="header-logo"]',
isPopup: true,
popupDelay: 10000
}
return cy.task('GoogleSocialLogin', socialLoginOptions).then(({cookies}) => {
cy.clearCookies()
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
})
}
})
})
})
Any comments would be highly appreciated.
@mcopjan i'm having the same error, have you managed to get this fixed somehow?
@mcopjan i'm having the same error, have you managed to get this fixed somehow?
@ErezT I have spent a lot of time on this and ultimately could not figure it out. I ended up login into SUT bypassing Google auth (our app was storing refresh token in local storage of Web app, so I injected this token before starting any tests, app was then able to exchange refresh token for access one and log me in)