diff --git a/.dockerignore b/.dockerignore index 7386798..116cfa4 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,4 @@ -node_modules .gitignore -README.md -build \ No newline at end of file +node_modules +.env.example +docker-compose.yml diff --git a/.drone.yml b/.drone.yml index 35557bd..b68b526 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,50 +1,47 @@ -kind: pipeline #to generate pipeline -type: docker # means it uses docker -name: webUIDroneTest #name of pipleline +kind: pipeline +type: docker +name: DroneCITest steps: - name: waveentry-server image: owncloudci/nodejs:14 + detach: true environment: - DB_HOST: database - DB_NAME: wavedb + DB_HOST: mongodatabase + DB_PORT: 27017 + DB_NAME: waveentrydatabase SERVER_PORT: 3001 JWT_SECRET: abcd1234 - DB_PORT: 27017 - detach: true commands: - - git clone https://github.com/SagarGi/wave-entry-server.git /waveentry-server - - cd /waveentry-server - - npm ci # same as npm install used in CI + - git clone https://github.com/SagarGi/wave-entry-server.git /waveentryserver + - cd /waveentryserver + - npm ci - npm start - - name: waveentry-forntend + - name: waveentryUI image: owncloudci/nodejs:14 + detach: true environment: - REACT_APP_SERVER_URL: http://waveentry-server:3001 + REACT_APP_SERVER_URI: http://waveentry-server:3001 commands: - npm ci - - npm start - detach: true - + - BROWSER=none npm start - name: wait image: owncloudci/wait-for:latest commands: - wait-for -it waveentry-server:3001 -t 300 - - wait-for -it waveentry:3000 -t 300 + - wait-for -it waveentryUI:3000 -t 300 - - name: e2eTest + - name: acceptanceTest image: owncloudci/nodejs:14 environment: SERVER_URL: http://waveentry-server:3001 - WEB_URL: http://waveentry:3000 - + WEB_URL: http://waveentryUI:3000 commands: - - npm run test:e2e tests/acceptance/features + - npm run test:e2e ./tests/acceptance/features/ -# services runs before the steps starts executing services: - - name: database + - name: mongodatabase image: mongo trigger: diff --git a/Dockerfile b/Dockerfile index 8f16134..a9485c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,6 @@ FROM node:14 -ENV REACT_APP_SERVER_URI=http://localhost:3001 - -WORKDIR /app/waveentry +WORKDIR /srv/app COPY . . @@ -10,4 +8,5 @@ EXPOSE 3000 RUN npm i -CMD ["npm" , "start"] \ No newline at end of file +CMD ["npm", "start"] + diff --git a/cucumber.config.js b/cucumber.config.js index 83c4548..3591935 100644 --- a/cucumber.config.js +++ b/cucumber.config.js @@ -20,8 +20,7 @@ setDefaultTimeout(60 * 1000); BeforeAll(async function () { global.browser = await chromium.launch({ - slowMo: config.slowMo, - headless: config.headless, + // headless: false, channel: "chrome", }); diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f349d7b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,29 @@ +services: + db: + image: mongo + # container_name: mongodb + ports: + - "2700:27017" + + server: + image: waveentryserver2 + environment: + DB_HOST: db + DB_PORT: 27017 + SERVER_PORT: 3002 + JWT_SECRET: abcd1234 + # command: npm run db:seed + ports: + - "3030:3002" + depends_on: + - db + + web: + image: wave-entry-web + ports: + - "3000:3000" + environment: + - REACT_APP_SERVER_URI=http://localhost:3005 + depends_on: + - server + - db diff --git a/package.json b/package.json index a944e90..5ca3c29 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", - "test:e2e": "cucumber-js --require cucumber.config.js --require tests/acceptance/stepDefinitions/**/*.js --format @cucumber/pretty-formatter" + "test:e2e": "cucumber-js --require cucumber.config.js --require tests/acceptance/stepDefinitions/**/*.js --format @cucumber/pretty-formatter", + "setup:browsers": "npx playwright install-deps && npx playwright install chromium" }, "eslintConfig": { "extends": [