github-action icon indicating copy to clipboard operation
github-action copied to clipboard

gh action fails on before each hook

Open idbd1 opened this issue 3 years ago • 0 comments

Before each hook fails skipping the execution of the test completely. I have no error in the console, when I run cypress locally, everything works.

1) Short Offer Form
       "before each" hook for "successfully create a short offer form":
     AxiosError: The following error originated from your application code, not from Cypress. It was caused by an unhandled promise rejection.

  > Request failed with status code 404

When Cypress detects uncaught errors originating from your application it will automatically fail the current test.

This behavior is configurable, and you can choose to turn this off by listening to the `uncaught:exception` event.

https://on.cypress.io/uncaught-exception-from-application

Because this error occurred during a `before each` hook we are skipping the remaining tests in the current suite: `Short Offer Form`

Another file, that specifies a full url to visit, works without any problem.

This is the content of beforeEach in the file:

  beforeEach(() => {
    cy.visit("/");
  });

in mfe>cypress.config.ts I have:

export default defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      // implement node event listeners here
    },
    baseUrl: "http://localhost:3501",
  },
});

here's the code for the gh action

      - name: Run cypress e2e
        uses: cypress-io/github-action@v4
        with:
          config: baseUrl=http://localhost:3501
          working-directory: mfe
          start: npm start
          wait-on: 'http://localhost:3501'

cypress folder is located within mfe directory.

Not sure what else to do.

idbd1 avatar Aug 01 '22 14:08 idbd1