diff --git a/.github/workflows/Build_and_Publish_Images.yaml b/.github/workflows/Build_and_Publish_Images.yaml new file mode 100644 index 000000000..3f1b563d5 --- /dev/null +++ b/.github/workflows/Build_and_Publish_Images.yaml @@ -0,0 +1,53 @@ +name: Build and Publish Docker Image + +on: + push: + tags: + - 'Seed-Test_v*' + +jobs: + build-and-publish: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Get Tag Name + id: get_tag_name + run: | + version=$(echo $GITHUB_REF | sed 's/refs\/tags\///' | sed 's/.*_//') + echo "version=${version}" >> ${GITHUB_OUTPUT} + + # BACKEND + - name: Build Docker Image + run: docker build -t seed-test-backend:${{ steps.get_tag_name.outputs.version }} ./backend + + - name: Tag Docker Image as Latest + run: | + docker tag seed-test-backend:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:${{ steps.get_tag_name.outputs.version }} + docker tag seed-test-backend:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:latest + + - name: Push Docker Image to Docker Hub + run: | + docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:${{ steps.get_tag_name.outputs.version }} + docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:latest + + # FRONTEND + - name: Build Docker Image + run: docker build -t seed-test-frontend:${{ steps.get_tag_name.outputs.version }} ./frontend + + - name: Tag Docker Image as Latest + run: | + docker tag seed-test-frontend:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:${{ steps.get_tag_name.outputs.version }} + docker tag seed-test-frontend:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:latest + + - name: Push Docker Image to Docker Hub + run: | + docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:${{ steps.get_tag_name.outputs.version }} + docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:latest \ No newline at end of file diff --git a/.github/workflows/CI_Tests_and_Report.yaml b/.github/workflows/CI_Tests_and_Report.yaml index 0b4222529..a295a3d03 100644 --- a/.github/workflows/CI_Tests_and_Report.yaml +++ b/.github/workflows/CI_Tests_and_Report.yaml @@ -42,8 +42,7 @@ jobs: - name: Build and start Docker stack run: | - chmod +x runDocker.sh - ./runDocker.sh + docker compose -f docker-test.yml up -d - name: Send failure notification if: ${{ failure() }} @@ -89,7 +88,8 @@ jobs: id: passed-total-backend - name: Upload Artifact Backend - uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + uses: actions/upload-artifact@v3 with: name: test-results-backend path: | @@ -122,7 +122,8 @@ jobs: id: passed-total-frontend - name: Upload Artifact Frontend - uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + uses: actions/upload-artifact@v3 with: name: test-results-frontend path: | @@ -157,7 +158,8 @@ jobs: id: passed-total-sanity - name: Upload Artifact Sanity - uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + uses: actions/upload-artifact@v3 with: name: sanity-report path: | @@ -191,4 +193,4 @@ jobs: sanityStepsFailed: ${{ steps.passed-total-sanity.outputs.failedSteps }} sanityStepsSkipped: ${{ steps.passed-total-sanity.outputs.skippedSteps }} workflowLink: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - webhook: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} + webhook: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} \ No newline at end of file diff --git a/.github/workflows/SonarCloud-PR.yaml b/.github/workflows/SonarCloud-PR.yaml index 4cb093f4d..fd89f9608 100644 --- a/.github/workflows/SonarCloud-PR.yaml +++ b/.github/workflows/SonarCloud-PR.yaml @@ -1,10 +1,7 @@ on: # Trigger analysis when pushing in master or pull requests, and when creating # a pull request. - pull_request: - types: [opened, synchronize, reopened] - branches: - - "nie" + gollum name: SonarCloud jobs: sonarcloud: diff --git a/.gitignore b/.gitignore index 655251c21..5e70ec474 100644 --- a/.gitignore +++ b/.gitignore @@ -68,8 +68,6 @@ backend/features/reporting_html*.html *.bat *.sh *.ps1 -!runDocker.bat -!runDocker.sh # Website Deployment with IIS **/web.config @@ -79,4 +77,6 @@ backend/features/reporting_html*.html backend/logs/ # local testing for step-definition development -backend/features/step_definitions/testing.js \ No newline at end of file +backend/features/step_definitions/testing.js + +/act \ No newline at end of file diff --git a/README.md b/README.md index 3e8828607..da91c4d52 100644 --- a/README.md +++ b/README.md @@ -27,23 +27,27 @@ It will download NodeJs and the browsers with their correct driver on it's own. For this [docker](https://www.docker.com/products/docker-desktop/) needs to be installed. -#### Installing Seed +#### Installation of Seed -After installing docker you just simply need to clone the repository and launch the runDocker script matching your OS: +Once you have Docker installed, the process of setting up Seed is straightforward. Follow these steps: -Windows: +1. **Download the Release:** -``` -runDocker.bat -``` + - Go to the [releases page](https://github.com/adessoSE/Seed-Test/releases) of Seed on GitHub. + - Download the `docker-compose.yml` file from the assets for the specific release you want. +2. **Navigate and Execute:** -Linux: + - Open a terminal. + - Navigate to the directory where you placed the `docker-compose.yml` file using the `cd` command. For instance: + ``` + cd C:/seed-test + ``` + - Execute the following command to start the Seed application in the background: + ``` + docker compose up -d + ``` -``` -runDocker.sh -``` - -And that's it! +With these steps, you'll have Seed up and running using Docker with the downloaded `docker-compose.yml` file. This will initiate the necessary services, volumes and configurations for the application (mongoDB, seed-test-frontend, seed-test-backend). Seed-Test can now be accessed via `http://localhost:4200/login` @@ -56,25 +60,51 @@ Seed-Test now runs within docker with default values which means the following: - GitHub functionalities don't work: To get GitHub functionalities to work you need to create and link a [GitHub OAuth App](https://docs.github.com/de/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app). - Salt and secrets are defaults:They should be changed for generating secure passwords! -- The mongoDB used has a default username and password. This should be changed for a secure database:To change this change the values in the docker-compose.yml +- The mongoDB used has a default username and password: + This should be changed for a secure database. To know how to change this look at the configure section below. #### ⚙️ Configuration: -Seed-Test's front- and backend can be configured sepreratly. +To configure anything when running seed via docker, you can simply adjust the environment variables for each container in the docker-compose.yml file and rerun the command: -##### Backend: +##### Backend -To configure the backend create a file with the name ".env" in the /backend directory. -Now you can configure the backend by adding parameters shown in the .env.example file. +| Variable | Description | +| :----------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| DATABASE_URI* | The mongoDB Connection String URI. This can be replaced with your own mongoDB.
If you are using the MongoDB provided by docker-compose, this needs to match the values set for the mongoDB in the docker compose. | +| REPORT_DELETION_TIME | Time (in minutes) after which the report is deleted. | +| SESSION_SECRET | Session secret to establish a secure connection and prevent session hijacking (used in /backend/src/server.js).
See https://www.npmjs.com/package/express-session | +| JIRA_SECRET | Jira Integration : values used for the encryption of sensible data.
Choose a strong Secret like for example generated by RandomKeygen. | +| JIRA_SALT | The salt should be a random string of at least 16 bytes length. | +| EMAIL_AUTH | Mail adress to send password reset mails (used in /backend/src/nodemailer.js) | +| EMAIL_PW | Mail password credentials to send password reset mails (used in /backend/src/nodemailer.js) | +| EMAIL_PORT | Mail server port to send password reset mails (used in /backend/src/nodemailer.js) | +| EMAIL_HOST | Mail server adress to send password reset mails (used in /backend/src/nodemailer.js) | +| GITHUB_CLIENT_SECRET | GitHub integration. Check out GitHub´s Guide on Autorizing OAuth Apps. | +| GITHUB_CLIENT_ID | GitHub integration. Check out GitHub´s Guide on Autorizing OAuth Apps. | +| PASSPORT_GITHUB_LOCAL_PW_FIELD | GitHub integration. Check out GitHub´s Guide on Autorizing OAuth Apps. | +| MAX_SAVED_REPORTS | The amount of maximum saved reports. | -##### Frontend: +*If you are not using the mongoDB provided by this docker-compose you can completely delete the seedmongodb section from the docker-compose.yml and remove the depends on part of the backend service. -To configure the frontend create a file with the name ".env" in the /frontend directory. -Now you can configure the frontend by adding parameters shown in the .env.example file. +##### Frontend -The dockerRun script needs to be run after any changes to the ".env" files. +| Variable | Meaning | +| :--------------- | :--------------------------------------------------------------------------------- | +| GITHUB_CLIENT_ID | GitHub integration. Check out GitHub´s Guide on Autorizing OAuth Apps. | +| VERSION | This controls if the demo warning is shown. Set this to "set" to make it disapear. | + +##### Database + +| Variable | Meaning | +| :-------------------------- | :-------------------------------------------------- | +| MONGO_INITDB_ROOT_USERNAME* | The username which should be used for the database. | +| MONGO_INITDB_ROOT_PASSWORD* | The password which should be used for the database. | +| MONGO_INITDB_DATABASE* | The name which should be used for the database. | + +*By modifying any of these variables, remember to adjust the corresponding database URI in the backend configuration as well. ### 🤙 By hand: @@ -165,7 +195,7 @@ Now you can configure the backend by adding parameters shown in the .env.example ##### Frontend: To configure the frontend create a file with the name ".env" in the /frontend directory. -Now you can configure the frontendby adding parameters shown in the .env.example file. +Now you can configure the frontend by adding parameters shown in the .env.example file. ## Database @@ -190,4 +220,4 @@ Copyright (c) 2018 adesso SE Permission is hereby granted, free of charge, to an The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/actions/fullReport/indexReport.js b/actions/fullReport/indexReport.js index 07dc6abc0..82bda3d03 100644 --- a/actions/fullReport/indexReport.js +++ b/actions/fullReport/indexReport.js @@ -13,7 +13,7 @@ async function postMessage() { // Helper function to parse environment variables or fallback to "-" const parseValueOrDefault = (value) => { - return value ? parseInt(value) : "-"; + return value ? parseInt(value) : 0; }; function calculatePercentage(num1, num2) { @@ -34,12 +34,14 @@ async function postMessage() { } function getStatus(passed, total) { + if (passed === 0) return "⚠️"; return passed === total ? "✅" : "⚠️"; } function calcTotal(dockerStatus, num1, num2) { if (!dockerStatus) return "-"; - if (isNaN(num1) || isNaN(num2)) return "-"; + if (isNaN(num1)) num1 = 0; + if (isNaN(num2)) num1 = 0; return num1+num2; } @@ -246,4 +248,4 @@ async function postMessage() { } } -postMessage(); +postMessage(); \ No newline at end of file diff --git a/backend/package.json b/backend/package.json index 57906cbfe..f185e42a5 100644 --- a/backend/package.json +++ b/backend/package.json @@ -68,6 +68,7 @@ "/spec/server.spec.js", "/spec/serverHelper.spec.js", "/node_modules/" - ] + ], + "setupFiles": ["./spec/setupTest.js"] } } diff --git a/backend/spec/setupTest.js b/backend/spec/setupTest.js new file mode 100644 index 000000000..921ad01ff --- /dev/null +++ b/backend/spec/setupTest.js @@ -0,0 +1 @@ +require('dotenv').config(); \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 01894ccc6..5f8909519 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,6 @@ version: "2.12" services: - seedmongodb: container_name: "Seed-MongoDB" image: mongo @@ -15,36 +14,44 @@ services: - MONGO_INITDB_ROOT_PASSWORD=SeedTest - MONGO_INITDB_DATABASE=Seed restart: always + backend: - build: - context: ./backend - dockerfile: Dockerfile - args: - - BUILD_DATE=${BUILD_DATE:-$$(date -u +"%Y-%m-%dT%H:%M:%SZ")} - - VCS_REF=${VCS_REF:-$$(git rev-parse --short HEAD)} - - IMAGE_NAME=seed-test-backend:latest - image: seed-test-backend:latest + image: seedtest/seed-test-backend:latest ports: - - "${BACKENDPORT}:${BACKENDPORT}" + - "8080:8080" container_name: "Seed-backend" depends_on: - seedmongodb restart: always - + environment: + DATABASE_URI: mongodb://SeedAdmin:SeedTest@seedmongodb:27017 + REPORT_DELETION_TIME: 5 + TESTACCOUNT_NAME: + TESTACCOUNT_REPO: + TESTACCOUNT_TOKEN: + SESSION_SECRET: 'secretSessionKey' + JIRA_SECRET: 'secretJiraKey' + JIRA_SALT: 'BJ1yJTJ7AFql' + EMAIL_AUTH: + EMAIL_PW: + EMAIL_PORT: + EMAIL_HOST: + GITHUB_CLIENT_SECRET: + GITHUB_CLIENT_ID: + PASSPORT_GITHUB_LOCAL_PW_FIELD: 'id' + MAX_SAVED_REPORTS: + frontend: - build: - context: ./frontend - dockerfile: Dockerfile - args: - - BUILD_DATE=${BUILD_DATE:-$$(date -u +"%Y-%m-%dT%H:%M:%SZ")} - - VCS_REF=${VCS_REF:-$$(git rev-parse --short HEAD)} - - IMAGE_NAME=seed-test-frontend:latest - image: seed-test-frontend:latest + image: seedtest/seed-test-frontend:latest ports: - - "${FRONTENDPORT}:${FRONTENDPORT}" + - "4200:4200" container_name: "Seed-frontend" depends_on: - backend restart: always + environment: + GITHUB_CLIENT_ID: + VERSION: + volumes: seedDB: \ No newline at end of file diff --git a/docker-test.yml b/docker-test.yml new file mode 100644 index 000000000..66c31efc9 --- /dev/null +++ b/docker-test.yml @@ -0,0 +1,23 @@ +version: "2.12" + +services: + backend: + build: + context: ./backend + dockerfile: Dockerfile + ports: + - 8080:8080 + container_name: "Seed-backend" + restart: always + + frontend: + build: + context: ./frontend + dockerfile: Dockerfile + image: seed-test-frontend:latest + ports: + - 4200:4200 + container_name: "Seed-frontend" + depends_on: + - backend + restart: always \ No newline at end of file diff --git a/frontend/package-lock.json b/frontend/package-lock.json index ab36628b5..c6eebf346 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -59,6 +59,7 @@ "eslint": "^8.28.0", "jest": "^28.1.3", "jest-canvas-mock": "^2.4.0", + "jest-environment-jsdom": "^29.6.2", "nodemon": "^3.0.1", "protractor": "^7.0.0", "tslib": "^2.3.1", @@ -6567,6 +6568,17 @@ "pretty-format": "^28.0.0" } }, + "node_modules/@types/jsdom": { + "version": "20.0.1", + "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-20.0.1.tgz", + "integrity": "sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/tough-cookie": "*", + "parse5": "^7.0.0" + } + }, "node_modules/@types/json-schema": { "version": "7.0.12", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", @@ -6681,6 +6693,12 @@ "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==" }, + "node_modules/@types/tough-cookie": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.2.tgz", + "integrity": "sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw==", + "dev": true + }, "node_modules/@types/ws": { "version": "8.5.5", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.5.tgz", @@ -7201,6 +7219,25 @@ "node": ">=0.4.0" } }, + "node_modules/acorn-globals": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz", + "integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==", + "dev": true, + "dependencies": { + "acorn": "^8.1.0", + "acorn-walk": "^8.0.2" + } + }, + "node_modules/acorn-globals/node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/acorn-import-assertions": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz", @@ -9417,6 +9454,12 @@ "integrity": "sha512-6tun4LoZnj7VN6YeegOVb67KBX/7JJsqvj+pv3ZA7F878/eN33AbGa5b/S/wXxS/tcp8nc40xRUrsPlxIyNUPg==", "dev": true }, + "node_modules/cssom": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", + "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", + "dev": true + }, "node_modules/cssstyle": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", @@ -9946,6 +9989,27 @@ } ] }, + "node_modules/domexception": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", + "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", + "dev": true, + "dependencies": { + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/domexception/node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/domhandler": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", @@ -11320,6 +11384,20 @@ "node": "*" } }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -11877,6 +11955,18 @@ "safe-buffer": "~5.1.0" } }, + "node_modules/html-encoding-sniffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", + "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "dev": true, + "dependencies": { + "whatwg-encoding": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/html-entities": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.4.0.tgz", @@ -13621,6 +13711,265 @@ "node": ">=8" } }, + "node_modules/jest-environment-jsdom": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-29.6.4.tgz", + "integrity": "sha512-K6wfgUJ16DoMs02JYFid9lOsqfpoVtyJxpRlnTxUHzvZWBnnh2VNGRB9EC1Cro96TQdq5TtSjb3qUjNaJP9IyA==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.6.4", + "@jest/fake-timers": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/jsdom": "^20.0.0", + "@types/node": "*", + "jest-mock": "^29.6.3", + "jest-util": "^29.6.3", + "jsdom": "^20.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jest-environment-jsdom/node_modules/@jest/environment": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.6.4.tgz", + "integrity": "sha512-sQ0SULEjA1XUTHmkBRl7A1dyITM9yb1yb3ZNKPX3KlTd6IG7mWUe3e2yfExtC2Zz1Q+mMckOLHmL/qLiuQJrBQ==", + "dev": true, + "dependencies": { + "@jest/fake-timers": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/@jest/fake-timers": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.6.4.tgz", + "integrity": "sha512-6UkCwzoBK60edXIIWb0/KWkuj7R7Qq91vVInOe3De6DSpaEiqjKcJw4F7XUet24Wupahj9J6PlR09JqJ5ySDHw==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.6.3", + "jest-mock": "^29.6.3", + "jest-util": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/@jest/types": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, + "node_modules/jest-environment-jsdom/node_modules/@sinonjs/commons": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", + "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/jest-environment-jsdom/node_modules/@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-environment-jsdom/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-environment-jsdom/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/jest-environment-jsdom/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-environment-jsdom/node_modules/jest-message-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.6.3.tgz", + "integrity": "sha512-FtzaEEHzjDpQp51HX4UMkPZjy46ati4T5pEMyM6Ik48ztu4T9LQplZ6OsimHx7EuM9dfEh5HJa6D3trEftu3dA==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.6.3", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/jest-mock": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.6.3.tgz", + "integrity": "sha512-Z7Gs/mOyTSR4yPsaZ72a/MtuK6RnC3JYqWONe48oLaoEcYwEDxqvbXz85G4SJrm2Z5Ar9zp6MiHF4AlFlRM4Pg==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/jest-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.6.3.tgz", + "integrity": "sha512-QUjna/xSy4B32fzcKTSz1w7YYzgiHrjjJjevdRf61HYk998R5vVMMNmrHESYZVDS5DSWs+1srPLPKxXPkeSDOA==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/pretty-format": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.6.3.tgz", + "integrity": "sha512-ZsBgjVhFAj5KeK+nHfF1305/By3lechHQSMWCTl8iHSbfOm2TN5nHEtFc/+W7fAyUeCs2n5iow72gld4gW0xDw==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-environment-jsdom/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/jest-environment-node": { "version": "28.1.3", "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-28.1.3.tgz", @@ -16735,6 +17084,108 @@ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" }, + "node_modules/jsdom": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", + "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", + "dev": true, + "dependencies": { + "abab": "^2.0.6", + "acorn": "^8.8.1", + "acorn-globals": "^7.0.0", + "cssom": "^0.5.0", + "cssstyle": "^2.3.0", + "data-urls": "^3.0.2", + "decimal.js": "^10.4.2", + "domexception": "^4.0.0", + "escodegen": "^2.0.0", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.1", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.2", + "parse5": "^7.1.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.2", + "w3c-xmlserializer": "^4.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^2.0.0", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0", + "ws": "^8.11.0", + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/data-urls": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", + "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", + "dev": true, + "dependencies": { + "abab": "^2.0.6", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jsdom/node_modules/tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dev": true, + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jsdom/node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/jsdom/node_modules/whatwg-mimetype": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", + "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/jsdom/node_modules/whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dev": true, + "dependencies": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -20311,6 +20762,18 @@ "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, "node_modules/schema-utils": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", @@ -22231,6 +22694,18 @@ "browser-process-hrtime": "^1.0.0" } }, + "node_modules/w3c-xmlserializer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", + "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==", + "dev": true, + "dependencies": { + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -22713,6 +23188,30 @@ "node": ">=0.8.0" } }, + "node_modules/whatwg-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", + "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "dev": true, + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-encoding/node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/whatwg-mimetype": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", @@ -23019,6 +23518,15 @@ } } }, + "node_modules/xml-name-validator": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", + "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/xml2js": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz", diff --git a/frontend/package.json b/frontend/package.json index a0cf3d842..8085ec660 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -72,6 +72,7 @@ "eslint": "^8.28.0", "jest": "^28.1.3", "jest-canvas-mock": "^2.4.0", + "jest-environment-jsdom": "^29.6.2", "nodemon": "^3.0.1", "protractor": "^7.0.0", "tslib": "^2.3.1", diff --git a/runDocker.bat b/runDocker.bat deleted file mode 100644 index 31587056e..000000000 --- a/runDocker.bat +++ /dev/null @@ -1,25 +0,0 @@ -del .env -@echo off -for /f "tokens=*" %%s in (./backend/.env) do ( - set %%s -) -IF "%PORT%"=="" ( - SET "PORT=8080" -) -echo BACKENDPORT=%PORT%>.env - -SET "PORT=" -@echo off -for /f "tokens=*" %%s in (./frontend/.env) do ( - set %%s -) -IF "%PORT%"=="" ( - SET "PORT=4200" -) -echo FRONTENDPORT=%PORT%>>.env - -docker compose down -docker rmi seed-test-backend -docker rmi seed-test-frontend -docker compose build --no-cache -docker compose up -d \ No newline at end of file diff --git a/runDocker.sh b/runDocker.sh deleted file mode 100644 index d6e2be061..000000000 --- a/runDocker.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -rm .env || echo "" - -sed -i -e '$a\' ./backend/.env -while read line; do - export "$line" -done < <(cat ./backend/.env) - -PORT="${PORT:-8080}" - -echo "BACKENDPORT=$PORT" > .env -unset PORT - -sed -i -e '$a\' ./frontend/.env -while read line; do - export "$line" -done < <(cat ./frontend/.env) - -PORT="${PORT:-4200}" - -echo "FRONTENDPORT=$PORT" >> .env - -docker compose down -docker rmi seed-test-backend -docker rmi seed-test-frontend -docker compose build --no-cache -docker compose up -d \ No newline at end of file