Skip to content

Commit

Permalink
Merge pull request #368 from catenax-ng/main
Browse files Browse the repository at this point in the history
Added cucumber tests for quality investigations
  • Loading branch information
ds-mwesener authored Nov 28, 2023
2 parents 37c86ff + 9547135 commit 8da8db7
Show file tree
Hide file tree
Showing 19 changed files with 535 additions and 114 deletions.
120 changes: 60 additions & 60 deletions .github/workflows/argo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,32 @@ on:
type: choice
description: Which Environment
required: true
options:
options:
- Dev/Test
- E2E-A/E2E-B
- int-a/int-b
testdata_version:
testdata_version:
description: Which Testdata Version CX_Testdata_MessagingTest_v<X.X.X>.json
required: true
argo_token:
description: Argo Token
required: true
api-token:
description: Api Token
required: true

api_token:
description: Api Token
required: true

env:
ARGO_TEST_REGISTRY: "https://argo.dev.demo.catena-x.net/api/v1/applications/tracex-dt-registry-test"
ARGO_TEST_EDC_PROVIDER: "https://argo.dev.demo.catena-x.net/api/v1/applications/tracex-test-edc-provider"
ARGO_TEST_TRACE_X_INSTANCE: "https://argo.dev.demo.catena-x.net/api/v1/applications/traceability-foss-test"
ARGO_TEST_RegistryReload: "https://traceability-test.dev.demo.catena-x.net/api/registry/reload"

ARGO_DEV_REGISTRY: "https://argo.dev.demo.catena-x.net/api/v1/applications/tracex-dt-registry-dev"
ARGO_DEV_EDC_PROVIDER: "https://argo.dev.demo.catena-x.net/api/v1/applications/tracex-edc-provider"
ARGO_DEV_TRACE_X_INSTANCE: "https://argo.dev.demo.catena-x.net/api/v1/applications/traceability-foss-dev"
ARGO_DEV_RegistryReload: "https://traceability.dev.demo.catena-x.net/api/registry/reload"
ARGO_E2E_A_REGISTRY: "https://argo.dev.demo.catena-x.net/api/v1/applications/tracex-dt-registry-e2e-a"

ARGO_E2E_A_REGISTRY: "https://argo.dev.demo.catena-x.net/api/v1/applications/tracex-dt-registry-e2e-a"
ARGO_E2E_A_EDC_PROVIDER: "https://argo.dev.demo.catena-x.net/api/v1/applications/tracex-edc-provider-e2e-a"
ARGO_E2E_A_TRACE_X_INSTANCE: "https://argo.dev.demo.catena-x.net/api/v1/applications/traceability-foss-e2e-a"
ARGO_E2E_A_RegistryReload: "https://traceability-e2e-a.dev.demo.catena-x.net/api/registry/reload"
Expand All @@ -64,8 +64,8 @@ env:
ARGO_E2E_B_EDC_PROVIDER: "https://argo.dev.demo.catena-x.net/api/v1/applications/tracex-edc-provider-e2e-b"
ARGO_E2E_B_TRACE_X_INSTANCE: "https://argo.dev.demo.catena-x.net/api/v1/applications/traceability-foss-e2e-b"
ARGO_E2E_B_RegistryReload: "https://traceability-e2e-b.dev.demo.catena-x.net/api/registry/reload"
ARGO_INT_A_REGISTRY: "https://argo.int.demo.catena-x.net/api/v1/applications/tx-registry-int-a"

ARGO_INT_A_REGISTRY: "https://argo.int.demo.catena-x.net/api/v1/applications/tx-registry-int-a"
ARGO_INT_A_EDC_PROVIDER: "https://argo.int.demo.catena-x.net/api/v1/applications/tx-edc-provider-int-a"
ARGO_INT_A_TRACE_X_INSTANCE: "https://argo.int.demo.catena-x.net/api/v1/applications/traceability-foss-int-a"
ARGO_INT_A_RegistryReload: "https://traceability-int-a.int.demo.catena-x.net/api/registry/reload"
Expand All @@ -74,8 +74,8 @@ env:
ARGO_INT_B_EDC_PROVIDER: "https://argo.int.demo.catena-x.net/api/v1/applications/tx-edc-provider-int-b"
ARGO_INT_B_TRACE_X_INSTANCE: "https://argo.int.demo.catena-x.net/api/v1/applications/traceability-foss-int-b"
ARGO_INT_B_RegistryReload: "https://traceability-int-b.int.demo.catena-x.net/api/registry/reload"
jobs:

jobs:

print_environment:
runs-on: ubuntu-latest
Expand All @@ -84,33 +84,33 @@ jobs:
run: |
echo "### inputs" >> $GITHUB_STEP_SUMMARY
echo "- environment: ${{ github.event.inputs.environment }}" >> $GITHUB_STEP_SUMMARY
hard_refresh_environment:
needs: print_environment
runs-on: ubuntu-latest
steps:

- name: Checkout-Repository
uses: actions/checkout@v4

- name: mask token
run: |
ARGO_TOKEN=$(jq -r '.inputs.argo_token' $GITHUB_EVENT_PATH)
echo ::add-mask::$ARGO_TOKEN
echo ARGO_TOKEN=$ARGO_TOKEN >> $GITHUB_ENV
- name: Hard refresh environment ${{ github.event.inputs.environment }}
run: |
source ./.github/argo/argo_config.sh
if [ "${{ github.event.inputs.environment }}" == "Dev/Test" ]; then
resources=("${DEV_TEST_RESOURCES[@]}")
elif [ "${{ github.event.inputs.environment }}" == "E2E-A/E2E-B" ]; then
resources=("${E2E_RESOURCES[@]}")
elif [ "${{ github.event.inputs.environment }}" == "int-a/int-b" ]; then
resources=("${INT_RESOURCES[@]}")
fi
for resource in "${resources[@]}"; do
curl -X GET -H "Authorization: Bearer ${{ env.ARGO_TOKEN }}" "$resource?refresh=hard&appNamespace=argocd"
done
Expand All @@ -120,51 +120,51 @@ jobs:
needs: hard_refresh_environment
runs-on: ubuntu-latest
steps:

- name: Checkout-Repository
uses: actions/checkout@v4

- name: mask token
run: |
ARGO_TOKEN=$(jq -r '.inputs.argo_token' $GITHUB_EVENT_PATH)
echo ::add-mask::$ARGO_TOKEN
echo ARGO_TOKEN=$ARGO_TOKEN >> $GITHUB_ENV
- name: Delete Argo Environment
run: |
source ./.github/argo/argo_config.sh
if [ "${{ github.event.inputs.environment }}" == "Dev/Test" ]; then
resources=("${DELETE_DEV_TEST_RESOURCES[@]}")
elif [ "${{ github.event.inputs.environment }}" == "E2E-A/E2E-B" ]; then
resources=("${DELETE_E2E_RESOURCES[@]}")
elif [ "${{ github.event.inputs.environment }}" == "int-a/int-b" ]; then
resources=("${DELETE_INT_RESOURCES[@]}")
fi
for resource in "${resources[@]}"; do
curl -X DELETE -H "Authorization: Bearer ${{ env.ARGO_TOKEN }}" "$resource"
sleep 2
done
sleep 10
change_target_revision:
needs: delete_environment
runs-on: ubuntu-latest
steps:

- name: mask token
run: |
ARGO_TOKEN=$(jq -r '.inputs.argo_token' $GITHUB_EVENT_PATH)
echo ::add-mask::$ARGO_TOKEN
echo ARGO_TOKEN=$ARGO_TOKEN >> $GITHUB_ENV
- name: Change TargetRevison
run: |
- name: Change TargetRevison
run: |
new_target_revision=${{ github.ref_name }}
if [ "${{ github.event.inputs.environment }}" == "Dev/Test" ]; then
json_data1=$(curl -X GET -H "Authorization: Bearer ${{ env.ARGO_TOKEN }}" "$ARGO_TEST_TRACE_X_INSTANCE")
old_TargetRevision1=$(echo "$json_data1" | jq -r '.spec.source.targetRevision')
json_data2=$(curl -X GET -H "Authorization: Bearer ${{ env.ARGO_TOKEN }}" "$ARGO_DEV_TRACE_X_INSTANCE")
Expand All @@ -175,16 +175,16 @@ jobs:
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer ${{ env.ARGO_TOKEN }}" -d "$updated_json" "$ARGO_TEST_TRACE_X_INSTANCE"
echo "Target Revision for Test overwritten"
fi
if [ "$old_TargetRevision2" != "$new_target_revision" ]; then
updated_json=$(echo "$json_data2" | jq ".spec.source.targetRevision = \"$new_target_revision\"")
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer ${{ env.ARGO_TOKEN }}" -d "$updated_json" "$ARGO_DEV_TRACE_X_INSTANCE"
echo "Target Revision for Dev overwritten"
fi
elif [ "${{ github.event.inputs.environment }}" == "E2E-A/E2E-B" ]; then
json_data1=$(curl -X GET -H "Authorization: Bearer ${{ env.ARGO_TOKEN }}" "$ARGO_E2E_A_TRACE_X_INSTANCE")
old_TargetRevision1=$(echo "$json_data1" | jq -r '.spec.source.targetRevision')
json_data2=$(curl -X GET -H "Authorization: Bearer ${{ env.ARGO_TOKEN }}" "$ARGO_E2E_B_TRACE_X_INSTANCE")
Expand All @@ -195,62 +195,62 @@ jobs:
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer ${{ env.ARGO_TOKEN }}" -d "$updated_json" "$ARGO_E2E_A_TRACE_X_INSTANCE"
echo "Target Revision for e2e-a overwritten"
fi
if [ "$old_TargetRevision2" != "$new_target_revision" ]; then
updated_json=$(echo "$json_data2" | jq ".spec.source.targetRevision = \"$new_target_revision\"")
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer ${{ env.ARGO_TOKEN }}" -d "$updated_json" "$ARGO_E2E_B_TRACE_X_INSTANCE"
echo "Target Revision for e2e-b overwritten"
fi
fi
sync_environment:
sync_environment:
needs: change_target_revision
runs-on: ubuntu-latest
steps:

- name: Checkout-Repository
uses: actions/checkout@v4

- name: mask token
run: |
ARGO_TOKEN=$(jq -r '.inputs.argo_token' $GITHUB_EVENT_PATH)
echo ::add-mask::$ARGO_TOKEN
echo ARGO_TOKEN=$ARGO_TOKEN >> $GITHUB_ENV
- name: Sync Argo Environment
run: |
source ./.github/argo/argo_config.sh
if [ "${{ github.event.inputs.environment }}" == "Dev/Test" ]; then
resources=("${SYNC_DEV_TEST_RESOURCES[@]}")
elif [ "${{ github.event.inputs.environment }}" == "E2E-A/E2E-B" ]; then
resources=("${SYNC_E2E_RESOURCES[@]}")
elif [ "${{ github.event.inputs.environment }}" == "int-a/int-b" ]; then
resources=("${SYNC_INT_RESOURCES[@]}")
fi
fi
for resource in "${resources[@]}"; do
curl -X POST -H "Authorization: Bearer ${{ env.ARGO_TOKEN }}" "$resource"
done
done
sleep 20
test_state:
needs: sync_environment
runs-on: ubuntu-latest
timeout-minutes: 15
steps:

- name: Checkout code
uses: actions/checkout@v4

- name: mask token
run: |
ARGO_TOKEN=$(jq -r '.inputs.argo_token' $GITHUB_EVENT_PATH)
echo ::add-mask::$ARGO_TOKEN
echo ARGO_TOKEN=$ARGO_TOKEN >> $GITHUB_ENV
- name: test apps state
run: |
source ./.github/argo/argo_config.sh
Expand All @@ -260,8 +260,8 @@ jobs:
resources=("${E2E_RESOURCES[@]}")
elif [ "${{ github.event.inputs.environment }}" == "int-a/int-b" ]; then
resources=("${INT_RESOURCES[@]}")
fi
fi
for resource in "${resources[@]}"; do
while true; do
json_data=$(curl -X GET -H "Authorization: Bearer ${{ env.ARGO_TOKEN }}" "$resource")
Expand All @@ -286,28 +286,28 @@ jobs:
sleep 10
fi
done
done
sleep 120
done
sleep 120
upload_testdata:
needs: test_state
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: mask token
run: |
API_TOKEN=$(jq -r '.inputs.api-token' $GITHUB_EVENT_PATH)
API_TOKEN=$(jq -r '.inputs.api_token' $GITHUB_EVENT_PATH)
echo ::add-mask::$API_TOKEN
echo API_TOKEN=$API_TOKEN >> $GITHUB_ENV
- name: Upload testdata
run: |
python -m pip install requests
Expand All @@ -329,13 +329,13 @@ jobs:
sleep 10
fi
registry_reload:
needs:
needs:
- upload_testdata
runs-on: ubuntu-latest
steps:
steps:
- name: reload the registry
run: |
if [ "${{ github.event.inputs.environment }}" == "Dev/Test" ]; then
curl -X GET "$ARGO_TEST_RegistryReload"
curl -X GET "$ARGO_DEV_RegistryReload"
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- new filtering capabilities ( receivedQualityAlertIdsInStatusActive, sentQualityAlertIdsInStatusActive, receivedQualityInvestigationIdsInStatusActive, sentQualityInvestigationIdsInStatusActive )
- Validation check if table-settings correct and reset on invalid state
- Added Api-Input in Argo Workflow to fix bugs
- Added implementation for cucumber tests for quality investigations
### Changed
- Filter configuration for tables to be resuable and easy to adapt
- Realigned some mappings e.g. (manufacturer / manufacturerName) to be more clear
Expand All @@ -26,6 +27,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### Added
- Added new dashboard layout and additional widgets
- Refactored dashboard response
- Added new fields to dashboard response

## [9.0.0-rc3 - 27.11.2023]
### Added
Expand Down
24 changes: 24 additions & 0 deletions frontend/cypress/integration/pages/QualityInvestigationsPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/********************************************************************************
* Copyright (c) 2022, 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
* Copyright (c) 2022, 2023 ZF Friedrichshafen AG
* Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

export class QualityInvestigationsPage {
//TBD if necessary
}
3 changes: 2 additions & 1 deletion frontend/cypress/support/step_definitions/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import { Given, Then } from '@badeball/cypress-cucumber-preprocessor';
import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor';
import { DashboardPage } from '../../integration/pages/DashboardPage';


Expand Down Expand Up @@ -47,6 +47,7 @@ Then(/^should be visible "Dashboard" header$/, () => {
Then(/^should be visible "TOTAL OF PARTS" section$/, () => {
cy.get('section').contains('Total of parts').should('be.visible');
});

Then(/^should be visible "TOTAL OF OTHER PARTS" section$/, () => {
cy.get('section').contains('Total of other parts').should('be.visible');
});
Expand Down
Loading

0 comments on commit 8da8db7

Please sign in to comment.