Cypress visiting an URL is not loading content of the site

496 Views Asked by At

When I set baseUrl and try to visit URL, the content of the URL is not getting loaded.

Here is config file.

const { defineConfig } = require("cypress");

module.exports = defineConfig({
  projectId: 'qu3jox',
  e2e: {
    baseUrl : 'https://dxplus.mom.gov.sg',
    pageLoadTimeout : 60000,
    // modifyObstructiveCode: false,
    chromeWebSecurity: false,
    defaultCommandTimeout: 20000  
  }
});

Here is the spec file :

describe("Verify identify header",() => {
  before(() => {
    cy.visit("/")
  })

  it("verify that How to identify",() => {
    cy.get(elementSelector.masterHeadLink).should('be.visible').contains(' How to identify ').click()
  })
})

Here is the Output: Content of the site is not getting loaded

Cypress screenshot

Console log:

Browser console log

Network status:

Browser Network tab

1

There are 1 best solutions below

3
pr96 On

If the above method doesn't work try to use:

cy.visit(Cypress.config().baseUrl)

OR

cy.visit(Cypress.config('baseUrl'))

To eliminate the "integrity" SHA edit the config below:

{
    "experimentalSourceRewriting": true
}