Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

259
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!