Run backend and frontend in parallel with tests

Hey,

I have an app with a sperate backend and frontend. The backend tests are running in Travis, as a part of those tests, I’m using selenium in order to test the frontend against the backend. While running locally both apps are running on localhost (with different ports). But I’m not sure how to connect them when running in Travis that only has access to the Backend code. I already have a different server that is running my frontend in “test” mode. But I don’t know with URL should I set in order to connect it to the backend that is running in Travis.

Thanks.

You cannot, and shouldn’t connect to Travis workers as part of build logic. All core logic should be running on them.

Run Selenium on the builder, too: https://docs.travis-ci.com/user/gui-and-headless-browsers/

Thanks for the response. How should I run my front-end locally (inside Travis), while I’m running my backend tests with Selenium? can I connect both repos to the same travis?

Roughtly the same as you would do locally but using a single console prompt.

E.g. run server processes in background like https://travis-ci.community/t/running-docker-containers-in-parallel-with-tests/7046:

install:
  - /path/to/server1 args & PIDS="$!"       # a service may provide some other way to know its PID like a pidfile
  - /path/to/server2 args & PIDS="$PIDS $!"
script:
  - <run tests>
after_script:
  - kill $PIDS    # or shut down servers gracefully in some other service-specific way
  - wait $PIDS    # likewise, a service may provide some other way to wait for its shutdown

any thoughts on how can I connect the second repo (client)? should I just hard-code the git path and do a manual pull?

That, or add it as a submodule.

Imprint