'Cypress tests giving 404 failure on github workflow

I am using cypress to test my react app. I have a CI using github workflow. When I add cypress to my workflow it gets to the test phase and all of the tests fail with a 404 error. I have two questions

  1. github seems to be hosting the react app on at a random URL each time. For example, something like 1.0.1.123 or 1.0.1.43, so how do I grab this value and set it as the base URL?

  2. When I do not define a baseURL, I just get 404 errors and that the tests fail.

Here is my workflow code:

jobs: test: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2

  - name: Cache node modules
    uses: actions/cache@v2
    env:
      cache-name: cache-node-modules
    with:
      # npm cache files are stored in `~/.npm` on Linux/macOS
      path: ~/.npm
      key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
      restore-keys: |
        ${{ runner.os }}-build-${{ env.cache-name }}-
        ${{ runner.os }}-build-
        ${{ runner.os }}-
  - name: Use Node.js ${{ matrix.node-version }}
    uses: actions/setup-node@v2
    with:
      node-version: ${{ matrix.node-version }}

  - name: Cypress run
    uses: cypress-io/github-action@v2
    with:
      working-directory: ./portal-ui
      start: npm run dev


Sources

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

Source: Stack Overflow

Solution Source