'How to Run & Connect to Emulators with Cypress CI on GitHub Actions?

I am trying to run e2e Cypress tests on Github actions. I build functions, run an emulator and start cypress like to: npx nx build functions | firebase emulators:start | nx e2e frontend-e2e --watch

This works well on localhost, but fails on GitHub Actions, when the first part of the code tries to connect to the emulators.

  cy.request(
    "DELETE",
    "http://localhost:9099/emulator/v1/projects/****/accounts"
  );

It can't reach the emulator on port localhost:9099, as I would normally do on localhost.

  1) Login
       runs setup:
     CypressError: `cy.request()` failed trying to load:

http://localhost:9099/emulator/v1/projects/****/accounts

We attempted to make an http request to this URL but the request failed without a response.

Is there something I need to do about connecting to localhost port on GitHub Actions?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source