How to anbale cookies for gitlab OAuth when running cypress test

Viewed 12

I have an angular app which has to authorize to gitlab and signIn the user with userName and pass in order to fetch some data/information from gitlab and display it in the UI.

The first test case fails before the browser can redirect to the gitlab login-form (https://gitlab.com/users/sign_in):

Spec Code:

it('Visits the home page', () => {
  cy.visit('/', {
    onBeforeLoad(win) {
        cy.stub(win.navigator, 'cookieEnabled', false).as('cookieEnabled');
    },
  })
})

Error:

Checking your browser before accessing gitlab.com. Please enable Cookies and reload the page. This process is automatic. Your browser will redirect to your requested content shortly. Please allow up to 5 seconds…

I have been searching and trying couple of other options/implementation based on cypress official doc etc., but still facing the same issue. Some kind of similar questions here in SO, but none for the hints/answers provide the fix.

Also I am not 100% sure that it's really an issue related to cypress test implementation. Could it be an issue affecting gitlab itself?

Any ideas how to fix such issue?

  • Cypress: 10.7.0
  • Angular: 14.x
  • Node: v16.13.1
0 Answers
Related