diff --git a/.github/workflows/system-testing.yml b/.github/workflows/system-testing.yml new file mode 100644 index 00000000..cc41ccac --- /dev/null +++ b/.github/workflows/system-testing.yml @@ -0,0 +1,113 @@ +name: Trigger E2E Testing Workflow + +on: + pull_request: + types: [opened, reopened, synchronize] + branches: + - main + - slu/e2eExternal + +jobs: + trigger-system-tests: + runs-on: ubuntu-latest + steps: + - name: Check if system testing is activated + id: check_activation + run: | + ACTIVATE=$(echo '${{ github.event.pull_request.body }}' | grep '^SYSTEM_TESTING:' | sed 's/SYSTEM_TESTING: *//' | tr -d '[:space:]') + echo "System testing activation: '$ACTIVATE'" + if [[ "$ACTIVATE" == "ACTIVATE" ]]; then + echo "activated=true" >> $GITHUB_OUTPUT + echo "System testing is ACTIVATED" + else + echo "activated=false" >> $GITHUB_OUTPUT + echo "System testing NOT activated (add 'SYSTEM_TESTING: ACTIVATE' to PR body to enable)" + fi + + - name: Trigger Repository Dispatch + if: steps.check_activation.outputs.activated == 'true' + run: | + echo "Parsing PR body for dependencies..." + + # Parse PROXY dependency + PROXY_LOCATION=$(echo '${{ github.event.pull_request.body }}' | grep '^PROXY:' | sed 's/PROXY: *//' | xargs) + echo "Proxy location: $PROXY_LOCATION" + + # Parse CHARGING dependency + CHARGING_LOCATION=$(echo '${{ github.event.pull_request.body }}' | grep '^CHARGING:' | sed 's/CHARGING: *//' | xargs) + echo "Charging location: $CHARGING_LOCATION" + + # Parse TM_VERSION + TM_VERSION=$(echo '${{ github.event.pull_request.body }}' | grep '^TM_VERSION:' | sed 's/TM_VERSION: *//' | xargs) + echo "TMForum API version: $TM_VERSION" + + # Default values (using upstream FIWARE-TMForum repos) + PROXY_REPO="FIWARE-TMForum/business-ecosystem-logic-proxy" + PROXY_BRANCH="master" + CHARGING_REPO="FIWARE-TMForum/business-ecosystem-charging-backend" + CHARGING_BRANCH="master" + TM_VERSION="${TM_VERSION:-1.3.18}" + + # Process PROXY location if specified + if [[ -n "$PROXY_LOCATION" ]]; then + echo "Validating proxy repository..." + STATUS=$(curl -o /dev/null -s -w "%{http_code}" "$PROXY_LOCATION") + if [[ "$STATUS" -eq 200 ]]; then + echo "Proxy repository found" + PROXY_REPO=$(echo "$PROXY_LOCATION" | awk -F "/" '{print $4 "/" $5}') + PROXY_BRANCH=$(echo "$PROXY_LOCATION" | awk -F "/tree/" '{print $2}') + PROXY_BRANCH="${PROXY_BRANCH:-master}" + echo "Extracted - Repo: $PROXY_REPO, Branch: $PROXY_BRANCH" + else + echo "Proxy repository not found: $PROXY_LOCATION (HTTP $STATUS)" + exit 1 + fi + fi + + # Process CHARGING location if specified + if [[ -n "$CHARGING_LOCATION" ]]; then + echo "Validating charging repository..." + STATUS=$(curl -o /dev/null -s -w "%{http_code}" "$CHARGING_LOCATION") + if [[ "$STATUS" -eq 200 ]]; then + echo "Charging repository found" + CHARGING_REPO=$(echo "$CHARGING_LOCATION" | awk -F "/" '{print $4 "/" $5}') + CHARGING_BRANCH=$(echo "$CHARGING_LOCATION" | awk -F "/tree/" '{print $2}') + CHARGING_BRANCH="${CHARGING_BRANCH:-master}" + echo "Extracted - Repo: $CHARGING_REPO, Branch: $CHARGING_BRANCH" + else + echo "Charging repository not found: $CHARGING_LOCATION (HTTP $STATUS)" + exit 1 + fi + fi + + echo "" + echo "E2E Test Configuration:" + echo " Proxy: $PROXY_REPO @ $PROXY_BRANCH" + echo " Charging: $CHARGING_REPO @ $CHARGING_BRANCH" + echo " Frontend: ${{ github.repository }} @ ${{ github.event.pull_request.head.ref }}" + echo " TM Version: $TM_VERSION" + echo " PR URL: ${{ github.event.pull_request.html_url }}" + echo "" + + # Trigger E2E tests in DOME-testing repository + echo "Triggering E2E tests..." + curl -X POST \ + -H "Authorization: token ${{ secrets.ADMIN }}" \ + -H "Accept: application/vnd.github.everest-preview+json" \ + -H "Content-Type: application/json" \ + -d "{ + \"event_type\": \"cross-repo-test\", + \"client_payload\": { + \"repository_A\": \"$PROXY_REPO\", + \"branch_A\": \"$PROXY_BRANCH\", + \"repository_B\": \"$CHARGING_REPO\", + \"branch_B\": \"$CHARGING_BRANCH\", + \"repository_frontend\": \"${{ github.repository }}\", + \"branch_frontend\": \"${{ github.event.pull_request.head.ref }}\", + \"tm_version\": \"$TM_VERSION\", + \"pull_request_url\": \"${{ github.event.pull_request.html_url }}\" + } + }" \ + https://api.github.com/repos/sluFicodes/DOME-testing/dispatches + + echo "E2E tests triggered successfully!" diff --git a/src/app/offerings/gallery/gallery.component.html b/src/app/offerings/gallery/gallery.component.html index 256cd214..c467de39 100644 --- a/src/app/offerings/gallery/gallery.component.html +++ b/src/app/offerings/gallery/gallery.component.html @@ -5,7 +5,7 @@

{{ 'GALLERY._title' | translate }}

@for (prod of products; track prod.id; let index = $index) { - + } @empty { }
diff --git a/src/app/pages/checkout/checkout.component.html b/src/app/pages/checkout/checkout.component.html index 0ab4d5ff..acc757c7 100644 --- a/src/app/pages/checkout/checkout.component.html +++ b/src/app/pages/checkout/checkout.component.html @@ -114,7 +114,7 @@

{{ getPrice(item).text }} {{ formatter.format(getPrice(item).price) }} --> -
+
diff --git a/src/app/pages/checkout/checkout.component.ts b/src/app/pages/checkout/checkout.component.ts index e82ba74b..a373171f 100644 --- a/src/app/pages/checkout/checkout.component.ts +++ b/src/app/pages/checkout/checkout.component.ts @@ -204,15 +204,18 @@ export class CheckoutComponent implements OnInit { try { const response = await firstValueFrom(this.orderService.postProductOrder(productOrder)); - const redirectUrl = response.headers.get('X-redirect-url'); + const redirectUrl = response.headers.get('X-Redirect-URL'); + console.log(response.headers) console.log(redirectUrl); console.log('PROD ORDER DONE'); if (redirectUrl) { + console.log('redirectURL') // Going to the payment gateway window.location.href = redirectUrl; } else { + console.log('non-redirectURL') // we clear the shopping cart only if no redirection is applied await this.emptyShoppingCart(); this.goToInventory(); diff --git a/src/app/pages/dashboard/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts index a0d92792..23dedbd3 100644 --- a/src/app/pages/dashboard/dashboard.component.ts +++ b/src/app/pages/dashboard/dashboard.component.ts @@ -79,8 +79,8 @@ export class DashboardComponent implements OnInit, OnDestroy { }); this.statsService.getStats().then(data=> { - this.services=data?.services; - this.publishers=data?.organizations; + this.services=data?.services || []; + this.publishers=data?.organizations || []; this.startTagTransition(); }) this.isFilterPanelShown = JSON.parse(this.localStorage.getItem('is_filter_panel_shown') as string); diff --git a/src/app/pages/product-details/product-details.component.html b/src/app/pages/product-details/product-details.component.html index a226620a..79267c05 100644 --- a/src/app/pages/product-details/product-details.component.html +++ b/src/app/pages/product-details/product-details.component.html @@ -575,6 +575,7 @@

{{rel.name}}

- +
- + @for (cat of catalogs; track cat.id) { - + @@ -169,7 +169,7 @@

{{ 'OFFERINGS._order_by' | translate }}

{{cat.relatedParty?.at(0)?.role}} @for (offer of offers; track offer.id) { - + diff --git a/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.html b/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.html index 7e5f7dde..1a7853a1 100644 --- a/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.html +++ b/src/app/pages/seller-offerings/offerings/seller-product-spec/create-product-spec/create-product-spec.component.html @@ -140,22 +140,22 @@

{{ 'CREATE_
- - - +
- -
@@ -165,7 +165,7 @@

{{ 'CREATE_ @if(BUNDLE_ENABLED){
-
}@else{
-
- --> -

- + @for (prod of prodSpecs; track prod.id) { - + @@ -180,7 +180,7 @@

{{ 'OFFERINGS._order_by' | translate }}

{{prod.lastUpdate | date:'EEEE, dd/MM/yy, HH:mm'}}
{{cat.name}} -
{{offer.name}}
{{prod.name}} - - +
-
@@ -380,7 +380,7 @@

- @@ -426,7 +426,7 @@

{{ 'PROFILE._country' | translate }} -
diff --git a/src/app/shared/billing-account-form/billing-account-form.component.html b/src/app/shared/billing-account-form/billing-account-form.component.html index a0c8cced..61fdfd96 100644 --- a/src/app/shared/billing-account-form/billing-account-form.component.html +++ b/src/app/shared/billing-account-form/billing-account-form.component.html @@ -10,7 +10,7 @@
- {{ 'BILLING._too_long' | translate }}

}--> - @@ -43,7 +43,7 @@
-
-
-
-