Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

253
Vistas
How to handle sign on with security restrictions in Cypress

I am a beginner in working with Cypress.

I am trying to build one test scenario for login.

  1. I have this first url defined in cypress.json which is the page for signing in: "cozone_url": "https://idp-develop-devdb.staging.cozone.com/"

  2. After successfully logging in, I am taken to the second page with URL: https://portal-develop-devdb.staging.cozone.com/ui/#/. In this page, I have one element which by clicking on it takes me to the actual application that I need to automate:

If I do not remove target attribute for the app element, the application opens correctly on a new child tab. I know that this is not handled with cypress so I tried to remove it:

 And ('I Click on Azets Invoice icon', ()=> {
 //this should open url https://invoice.test.azets.com/en
 cy.get("a[data-test-application-identifier='EFLOW_INVOICES_V2']").invoke('removeAttr','target').click() })   

A new tab is not opened, but the https://invoice.test.azets.com/en is not loaded in the original tab and I have this error: Refused to frame '' because it violates the following Content Security Policy directive: "frame-src

Also, when trying to go directly to the url with visit method I have this error:

The new URL is considered a different origin because the following parts of the URL are different

I know that this happens because of the security restrictions, that Cypress does not allow to change the domain within the same test, but how can I automate this scenario?

I login from url 1, then a page is opened where I have the link to my app and have to click on it and go to url2, which I am not allowed.

I tried to split this into 2 tests and use Cypress.Cookies.preserveOnce() method, but I don't know which cookie name I should preserve for the second test.

Do you have any idea on how should I automate the scenario using Cypress?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try turning off web security to remove CORS restrictions.

In cypress.json add

{ 
  "chromeWebSecurity": false
}

Ref: Web Security

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda