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

WebSocket is not open: readyState 3 (CLOSED)* #93

Open
mcopjan opened this issue Apr 12, 2021 · 3 comments
Open

WebSocket is not open: readyState 3 (CLOSED)* #93

mcopjan opened this issue Apr 12, 2021 · 3 comments

Comments

@mcopjan
Copy link

mcopjan commented Apr 12, 2021

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
          })
        }
      })
    })
  })

@mcopjan
Copy link
Author

mcopjan commented Apr 13, 2021

Any comments would be highly appreciated.

@ErezT
Copy link

ErezT commented Dec 6, 2021

@mcopjan i'm having the same error, have you managed to get this fixed somehow?

@mcopjan
Copy link
Author

mcopjan commented Dec 6, 2021

@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)

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

2 participants