diff --git a/Makefile.local b/Makefile.local --- a/Makefile.local +++ b/Makefile.local @@ -92,7 +92,7 @@ bash -c "trap 'trap - SIGINT SIGTERM ERR EXIT && \ jobs -p | xargs -r kill' SIGINT SIGTERM ERR EXIT; \ python3 swh/web/manage.py runserver --nostatic --settings=$(SETTINGS_TEST) & \ - sleep 10 && $(YARN) run cypress run --config numTestsKeptInMemory=0 && \ + sleep 10 && $(YARN) run cypress run -b chromium --config numTestsKeptInMemory=0 && \ $(YARN) mochawesome && $(YARN) nyc-report" test-frontend: export CYPRESS_SKIP_SLOW_TESTS=1 diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -42,6 +42,7 @@ function getDatabase() { const db = new sqlite3.Database(`./swh-web-test${buildId}.sqlite3`); // to prevent "database is locked" error when running tests + db.configure('busyTimeout', 20000); db.run('PRAGMA journal_mode = WAL;'); return db; } diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,39 @@ +FROM cypress/base:18.12.0 +LABEL maintainer="SoftwareHeritage" +USER root + +ARG user=jenkins +ARG group=jenkins +ARG uid=115 +ARG gid=120 +ARG docker_gid=999 + +RUN groupadd -g ${gid} ${group} +RUN groupadd -g ${docker_gid} docker +RUN useradd -c "Jenkins user" -d /home/${user} -u ${uid} -g ${gid} -m ${user} +RUN gpasswd -a jenkins docker + +ENV LANG C.UTF-8 + +ENV PATH "${PATH}:/home/${user}/.local/bin" + +RUN export DEBIAN_FRONTEND=noninteractive && \ + apt-get update && \ + apt-get install -y \ + python3-pip \ + wait-for-it \ + git \ + postgresql \ + postgresql-client \ + libpq-dev \ + libcmph-dev \ + libmagic-dev \ + chromium + +USER jenkins + +RUN mkdir -p /home/jenkins/.cache/pip + +RUN python3 -m pip install --user --upgrade --no-warn-script-location \ + pip setuptools wheel + diff --git a/package.json b/package.json --- a/package.json +++ b/package.json @@ -109,7 +109,7 @@ "copy-webpack-plugin": "^11.0.0", "css-loader": "^6.7.2", "cy2": "^3.2.0", - "cypress": "11.0.1", + "cypress": "^11.1.0", "cypress-hmr-restarter": "^2.0.4", "cypress-multi-reporters": "^1.6.1", "ejs": "^3.1.8", diff --git a/yarn.lock b/yarn.lock --- a/yarn.lock +++ b/yarn.lock @@ -3134,10 +3134,10 @@ debug "^4.1.1" lodash "^4.17.15" -cypress@11.0.1: - version "11.0.1" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-11.0.1.tgz#5332a1825b37ab3f4f81d74389930c55cc7cf31d" - integrity sha512-NuEfd0Vim492RJ3m/+bbTZ3OZrqXgfAfuLaZfIQ9D5lKocS3EDr2tyAarZdAhKwLyoh7OJ33jwMeMFIDbzYqog== +cypress@^11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-11.1.0.tgz#b8f16495a8a5d8f9a7dd3374ae7b2cef45e9c779" + integrity sha512-kzizbG9s3p3ahWqxUwG/21NqLWEGtScMevMyUPeYlcmMX9RzVxWM18MkA3B4Cb3jKx72hSyIE2mHgHymfCM1bg== dependencies: "@cypress/request" "^2.88.10" "@cypress/xvfb" "^1.2.4"