Cypress Scripts - Cross-Domain - iFrame Does Not Load

Viewed 547

Hope all's well. Kindly request your help with this. We are executing a Cypress script that launches URL 1 - https://domain1.com. This website has an iFrame embedded that launches another site - https://domain2.com. Problem is, site 2 does not load within the iFrame and we keep getting the message - "domain2.com took a long time to respond". However, outside of Cypress if I launch https://domain1.com, the iFrame is opened and domain2 is launched and displayed successfully.

I have reviewed several posts and have performed the following,

cypress.json "chromewebsecurity": false AND "modifyobstructivecode": false

index.js, followed by package.json

const path = require('path');
module.exports = (on, config) => {
  on('before:browser:launch', (browser = {}, args) => {
    console.log(config, browser, args);
    if (browser.name === 'chrome') {
      const ignoreXFrameHeadersExtension = path.join(__dirname, '../extensions/ignore-x-frame-headers');
      args.push(args.push(`--load-extension=${ignoreXFrameHeadersExtension}`));
      args.push("--disable-features=CrossSiteDocumentBlockingIfIsolating,CrossSiteDocumentBlockingAlways,IsolateOrigins,site-per-process");
    }
    return args;
  });
};

{
  "name": "coral",
 "version": "1.0.0",
  "description": "Coral testing",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "cy:run": "C:\\Testing\\Cypress\\Coral\\node_modules\\.bin\\cypress run",
                "download-extension": "ced gleekbfjekiniecknbkamfmkohkpodhe extensions/ignore-x-frame-headers"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "cypress": "^4.1.0",
    "mochawesome": "^5.0.0",
    "mochawesome-merge": "^4.0.2"
  },
  "reporterEnabled": "mochawesome",
  "dependencies": {
    "file-system": "^2.2.2",
    "nodemailer": "^6.4.6",
    "chrome-ext-downloader": "^1.0.4"
  }
}

I have downloaded the .crx file for this extension and renamed it to ignore-x-frame-headers under the extensions dir.

However, every time I run the test, the page for domain2.com does not load inside the iFrame.

Can someone please explain what are the steps I'm missing/executing wrong? Really appreciate your prompt and positive response.

Thanks in advance, Karthik.

0 Answers
Related