diff --git a/docker-compose.test.yml b/docker-compose.test.yml index a1441d2d3..b3387c00b 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -23,7 +23,7 @@ services: front: image: front restart: always - command: ["npm", "run", "test:front:ci"] + command: ["npx", "jest", "--ci --maxWorkers=2"] build: context: . dockerfile: front/Dockerfile.test @@ -40,8 +40,18 @@ services: - NODE_ENV depends_on: - db + e2e: + image: e2e + restart: always + build: + context: . + dockerfile: e2e/Dockerfile + environment: + - NODE_ENV + depends_on: + - front -networks: - stack-network: - driver: host +# networks: +# stack-network: +# driver: host diff --git a/e2e/Dockerfile b/e2e/Dockerfile new file mode 100644 index 000000000..7ddfafede --- /dev/null +++ b/e2e/Dockerfile @@ -0,0 +1,6 @@ +FROM front +WORKDIR /salix +COPY e2e e2e + +CMD ["node", "e2e/helpers/tests.js"] + diff --git a/e2e/helpers/config.js b/e2e/helpers/config.js index 8e5bda96c..3ac97f063 100644 --- a/e2e/helpers/config.js +++ b/e2e/helpers/config.js @@ -1,3 +1,3 @@ module.exports = { - url: 'http://localhost:5000' + url: 'http://back:5000' }; diff --git a/e2e/helpers/tests.js b/e2e/helpers/tests.js index 992ec051f..007164f1a 100644 --- a/e2e/helpers/tests.js +++ b/e2e/helpers/tests.js @@ -4,7 +4,7 @@ require('regenerator-runtime/runtime'); require('vn-loopback/server/boot/date')(); const axios = require('axios'); -const Docker = require('../../db/docker.js'); +// const Docker = require('../../db/docker.js'); const e2eConfig = require('./config.js'); const log = require('fancy-log'); @@ -18,9 +18,9 @@ async function test() { if (process.argv[2] === 'show') process.env.E2E_SHOW = true; - const container = new Docker('salix-db'); + // const container = new Docker('salix-db'); - await container.run(); + // await container.run(); const Jasmine = require('jasmine'); const jasmine = new Jasmine(); @@ -56,7 +56,7 @@ async function test() { } async function backendStatus() { - log('Awaiting backend connection...'); + log('Awaiting backend connection2...'); const milliseconds = 1000; const maxAttempts = 10; diff --git a/front/Dockerfile.test b/front/Dockerfile.test index 59ccd4112..40067c846 100644 --- a/front/Dockerfile.test +++ b/front/Dockerfile.test @@ -1,5 +1,6 @@ FROM back EXPOSE 5000 +WORKDIR /salix COPY front front RUN npm i -g jest @@ -13,6 +14,7 @@ COPY fileMock.js ./ COPY /front/gulpfile.js ./ COPY /front/webpack.config.js ./ - +COPY /front/salix ./front/salix +COPY /front/core ./front/core CMD ["npx", "gulp", "front"] diff --git a/runTestE2E.sh b/runTestE2E.sh new file mode 100644 index 000000000..832443575 --- /dev/null +++ b/runTestE2E.sh @@ -0,0 +1,7 @@ +docker-compose -p salix-test -f docker-compose.test.yml build --force-rm db +docker-compose -p salix-test -f docker-compose.test.yml build --force-rm back +docker-compose -p salix-test -f docker-compose.test.yml build --force-rm front +docker-compose -p salix-test -f docker-compose.test.yml build --force-rm e2e +docker-compose -p salix-test -f docker-compose.test.yml run e2e #--rm +# docker-compose -p salix-test -f docker-compose.test.yml down +# docker-compose -p salix-test -f docker-compose.test.yml rm diff --git a/front/runTestFront.sh b/runTestFront.sh similarity index 70% rename from front/runTestFront.sh rename to runTestFront.sh index 881e6e079..7dad37a78 100644 --- a/front/runTestFront.sh +++ b/runTestFront.sh @@ -1,3 +1,4 @@ +docker-compose -p salix-test -f docker-compose.test.yml build --force-rm front docker-compose -p salix-test -f docker-compose.test.yml run --rm front docker-compose -p salix-test -f docker-compose.test.yml down docker-compose -p salix-test -f docker-compose.test.yml rm