Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress not able to call http xhr on different localhost port #30761

Open
hboumedane opened this issue Dec 13, 2024 · 0 comments
Open

Cypress not able to call http xhr on different localhost port #30761

hboumedane opened this issue Dec 13, 2024 · 0 comments

Comments

@hboumedane
Copy link

Current behavior

I'm running and angular app (angular 18) in dev mode (npm run start), the app runs on http://localhost:4200/.
I have a simple Cypress test to visit the home page and check the title of the app.
When running the test: (cypress open --browser chrome), my app is not able to call public API of the backend that is running on http://localhost:16105/.
If I use curl to call the endpoint directly, the endpoint works correctly.
The angular app is calling multiple public API when loading and the problem occur on each.

cypress.config.ts

import { defineConfig } from 'cypress';

export default defineConfig({
  projectId: "XXXXX",
  defaultCommandTimeout: 10000,
  requestTimeout: 10000,
  chromeWebSecurity: false,

  retries: {
    runMode: 3,
    openMode: 0,
  },

  e2e: {
    baseUrl: 'http://localhost:4200',
    experimentalStudio: true,
    excludeSpecPattern: "*.js",
    specPattern: ["cypress/e2e/**/+(all.ts|*.cy.ts)", "cypress/e2e/**/**/*.cy.ts)"],
  },
});

Screenshot from 2024-12-12 14-44-07

Desired behavior

No response

Test code to reproduce

here the cypress e2e test :

describe("Home Page", () => {

 it("check the title", () => {
    cy.visit("/home");
    cy.wait(100);
    cy.title().should("eq", "DLCM");
  });
});

Cypress Version

13.15.0

Node version

v20.18.0

Operating System

Ubuntu 22

Debug Logs

No response

Other

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant