dojo
dojo

Reputation: 25

How to run testcafe tests in teamcity CI?

I want to run Testcafe E2E tests in teacity CI/CD server. Can someone please help me to understand how can we use testcafe/testcafe docker image in teamcity to run the tests?

Upvotes: 1

Views: 470

Answers (1)

wentwrong
wentwrong

Reputation: 711

I recommend that you refer to the following topics where you can find information on how to make it work:

Here is an article that describes how to integrate TestCafe with TeamCity. Please also take a look at the following article: Use TestCafe Docker Image.

Feel free to contact us if you need assistance with combining these tools.

UPDATED:

TeamCity goes along with the Docker Wrapper extension for Command Line Build Step. It provides an easy way to run a custom script inside a docker container.

However, you need to take into account the following specifics:

  • The TestCafe Docker image comes with a special script that prepares the container environment by starting services like Xvfb and DBus. It is located in /opt/testcafe/bin/testcafe-docker.sh. The TeamCity wrapper overrides the entrypoint of the docker images and prevents execution of this script. It means that /opt/testcafe/bin/testcafe-docker.sh should be used instead of testcafe to run your test with Docker and TeamCity:
/opt/testcafe/docker/testcafe-docker.sh chromium test/e2e/**/* -r teamcity
  • It's better to use headless mode when testing in Docker containers, since this mode is specially designed for such environments.
  • If you don't use the headless mode in Chrome for some reason, you can encounter the following error: ERROR: Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure. Likely, it is caused by the following Chrome's bug: TMPDIR too long. In order to solve this problem, you need to manually set an environment variable before starting TestCafe:
export TMPDIR=/tmp

Configured Build Step may look like:

This configuration implies that you are using TestCafe with TeamCity TestCafe reporter installed as local packages. Ensure that the node_modules directory with TestCafe and plugins is a subdirectory of the test project root directory. TeamCity Docker Wrapper will mount the working directory inside the container.

Upvotes: 3

Related Questions