From d05583590415257748ef189dd67d6cd42241840e Mon Sep 17 00:00:00 2001 From: Joel Davies Date: Mon, 15 Apr 2024 15:46:02 +0000 Subject: [PATCH] Test #499 --- .github/workflows/ci-build.yml | 48 +++++++++++++++++-------------- package.json | 4 +-- server/e2e-settings-with-api.json | 2 +- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 3e4205b47..c0f3e795b 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -72,28 +72,6 @@ jobs: name: End-to-End (with api) Tests runs-on: ubuntu-latest - services: - ims-api: - image: harbor.stfc.ac.uk/inventory-management-system/ims-api:develop - ports: - - 8000:8000 - env: - AUTHENTICATION__ENABLED: false - API__TITLE: Inventory Management System API - API__DESCRIPTION: This is the API for the Inventory Management System - API__ROOT_PATH: /inventory-management-system-api - DATABASE__PROTOCOL: mongodb - DATABASE__USERNAME: root - DATABASE__PASSWORD: example - DATABASE__HOSTNAME: mongodb - DATABASE__PORT: 27017 - DATABASE__NAME: ims - API__ALLOWED_CORS_HEADERS: '["*"]' - API__ALLOWED_CORS_ORIGINS: '["*"]' - API__ALLOWED_CORS_METHODS: '["*"]' - - options: --name inventory-management-system-api - steps: - name: Clone api repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 @@ -125,6 +103,24 @@ jobs: python ./scripts/dev_cli.py db-init --replicaSetMemberHost localhost python ./scripts/dev_cli.py db-import + - name: Start inventory-management-system-api + run: | + docker run -d -p 8000:8000 --name inventory_management_system_api \ + --env AUTHENTICATION__ENABLED=false \ + --env API__TITLE="Inventory Management System API" \ + --env API__DESCRIPTION="This is the API for the Inventory Management System" \ + --env API__ROOT_PATH="/inventory-management-system-api" \ + --env DATABASE__PROTOCOL="mongodb" \ + --env DATABASE__USERNAME="root" \ + --env DATABASE__PASSWORD="example" \ + --env DATABASE__HOSTNAME="mongodb" \ + --env DATABASE__PORT=27017 \ + --env DATABASE__NAME="ims" \ + --env API__ALLOWED_CORS_HEADERS='["*"]' \ + --env API__ALLOWED_CORS_ORIGINS='["*"]' \ + --env API__ALLOWED_CORS_METHODS='["*"]' \ + harbor.stfc.ac.uk/inventory-management-system/ims-api:develop + - name: Checkout repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 @@ -142,6 +138,14 @@ jobs: - name: Run e2e tests run: yarn e2e:api + - name: Output logs (mongodb) + if: [always] + run: docker logs mongodb_container + + - name: Output logs (api) + if: [always] + run: docker logs inventory_management_system_api + - name: Upload Cypress screenshots if: failure() uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4 diff --git a/package.json b/package.json index 3a77e4c45..eedc8fcc8 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "e2e:api": "cross-env USE_API_SETTINGS=true start-server-and-test e2e:serve:api http://localhost:3000 cy:run:api", "cy:open": "cross-env TZ=UTC cypress open", "cy:run": "cross-env TZ=UTC cypress run --spec \"./cypress/e2e/with_mock_data/*.cy.ts\"", - "cy:run:api": "cross-env TZ=UTC cypress run --spec \"./cypress/e2e/with_api/**/*.cy.ts\"" + "cy:run:api": "cross-env TZ=UTC cypress run --spec \"./cypress/e2e/with_api/**/systems.cy.ts\"" }, "browserslist": [ ">0.2%", @@ -93,4 +93,4 @@ "msw": { "workerDirectory": "public" } -} +} \ No newline at end of file diff --git a/server/e2e-settings-with-api.json b/server/e2e-settings-with-api.json index 779ccb6e4..794043c0a 100644 --- a/server/e2e-settings-with-api.json +++ b/server/e2e-settings-with-api.json @@ -1,5 +1,5 @@ { - "apiUrl": "http://localhost:8000", + "apiUrl": "http://127.0.0.1:8000", "routes": [ { "section": "Inventory Management System",