From 0d6e0eafdb899d3bcc47b3c89227bc12e462bffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Sch=C3=B6neberg?= Date: Thu, 14 Mar 2019 23:43:47 +0100 Subject: [PATCH] 7-e2e get the test into a running docker container #7 --- Dockerfile | 17 +++++++++++++++-- run_cypress.sh | 22 +++++++++++----------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index af1a1bb9..671c1d6e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,14 +15,26 @@ RUN apt-get update && apt-get -y upgrade && apt-get -y autoremove WORKDIR /e2e +COPY .babelrc . + +# I think this is needed so the npm intall will get all needed dependencies +COPY package.json . + RUN npm install --save-dev cypress@3.1.5 RUN npm install --save-dev @cypress/snapshot@2.0.1 RUN npm install --save-dev @cypress/webpack-preprocessor@4.0.2 -COPY reporter-config.json /e2e +COPY reporter-config.json . # note: if we had a recent git version in here, we could follow https://stackoverflow.com/a/3489576 to check out the revision we need -COPY cypress-git-repo /e2e +#COPY cypress-git-repo /e2e +COPY cypress.json . +COPY src ./src +COPY cypress ./cypress + +# TODO see if we really need the webpack stuff +COPY webpack.config.js . +#RUN npm install --save-dev webpack@4.2.0 webpack-git-hash # The following npm install is needed; without it, running cypress would fail as follows # -------------- @@ -37,6 +49,7 @@ COPY cypress-git-repo /e2e # -------------- RUN npm install + # thx to https://docs.cypress.io/guides/tooling/reporters.html#Multiple-Reporters # mocha 6.0.0 and 6.0.1 don't work, thx to https://github.com/cypress-io/cypress/issues/3537 RUN npm install --save-dev mocha@5.2.0 mocha-multi-reporters@1.1.7 mocha-junit-reporter@1.18.0 diff --git a/run_cypress.sh b/run_cypress.sh index f091d70d..972053e3 100644 --- a/run_cypress.sh +++ b/run_cypress.sh @@ -42,17 +42,6 @@ then export DEBUG=cypress:* fi -cd /e2e - -# write the config file used by cypress to acces the rest-API etc -echo "module.exports = {" > cypress/config.js -echo " API_URL: '${api_url}'," >> cypress/config.js -echo " PLUGIN_API_URL: '${plugin_api_url}'," >> cypress/config.js -echo " WS_URL: '${ws_url}'," >> cypress/config.js -echo " username: '${username}'," >> cypress/config.js -echo " password: '${password}'," >> cypress/config.js -echo "};" >> cypress/config.js - # start printing all bash commands from here onwards, if activated if [ "$debug_print_bash_cmds" != "n" ]; then @@ -61,6 +50,17 @@ then set -x fi +# write the config file used by cypress to acces the rest-API etc +echo "module.exports = {" > /e2e/cypress/config.js +echo " API_URL: '${api_url}'," >> /e2e/cypress/config.js +echo " PLUGIN_API_URL: '${plugin_api_url}'," >> /e2e/cypress/config.js +echo " WS_URL: '${ws_url}'," >> /e2e/cypress/config.js +echo " username: '${username}'," >> /e2e/cypress/config.js +echo " password: '${password}'," >> /e2e/cypress/config.js +echo "};" >> /e2e/cypress/config.js + +cd /e2e + export CYPRESS_baseUrl=$frontend_url # Thx to https://docs.cypress.io/guides/tooling/reporters.html#Spec-to-STDOUT-save-JUnit-XML-files