Skip to content

Commit

Permalink
Test #499
Browse files Browse the repository at this point in the history
  • Loading branch information
joelvdavies committed Apr 15, 2024
1 parent c2b0f1e commit d055835
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
48 changes: 26 additions & 22 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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%",
Expand Down Expand Up @@ -93,4 +93,4 @@
"msw": {
"workerDirectory": "public"
}
}
}
2 changes: 1 addition & 1 deletion server/e2e-settings-with-api.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"apiUrl": "http://localhost:8000",
"apiUrl": "http://127.0.0.1:8000",
"routes": [
{
"section": "Inventory Management System",
Expand Down

0 comments on commit d055835

Please sign in to comment.