Skip to content

Commit 34d080e

Browse files
sluFicodesSHENGXING LU
andauthored
Slu/e2e external (#133)
* e2e workflow starting point * e2e testing * bug fixed * more bugs fixed * tags for e2e testings * fix null response in /stats bug * addToCart tag * country input tag * more cypress tags --------- Co-authored-by: SHENGXING LU <slu@SHENGXINGs-MacBook-Air.local>
1 parent 8301a90 commit 34d080e

25 files changed

Lines changed: 198 additions & 78 deletions

File tree

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Trigger E2E Testing Workflow
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
branches:
7+
- main
8+
- slu/e2eExternal
9+
10+
jobs:
11+
trigger-system-tests:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check if system testing is activated
15+
id: check_activation
16+
run: |
17+
ACTIVATE=$(echo '${{ github.event.pull_request.body }}' | grep '^SYSTEM_TESTING:' | sed 's/SYSTEM_TESTING: *//' | tr -d '[:space:]')
18+
echo "System testing activation: '$ACTIVATE'"
19+
if [[ "$ACTIVATE" == "ACTIVATE" ]]; then
20+
echo "activated=true" >> $GITHUB_OUTPUT
21+
echo "System testing is ACTIVATED"
22+
else
23+
echo "activated=false" >> $GITHUB_OUTPUT
24+
echo "System testing NOT activated (add 'SYSTEM_TESTING: ACTIVATE' to PR body to enable)"
25+
fi
26+
27+
- name: Trigger Repository Dispatch
28+
if: steps.check_activation.outputs.activated == 'true'
29+
run: |
30+
echo "Parsing PR body for dependencies..."
31+
32+
# Parse PROXY dependency
33+
PROXY_LOCATION=$(echo '${{ github.event.pull_request.body }}' | grep '^PROXY:' | sed 's/PROXY: *//' | xargs)
34+
echo "Proxy location: $PROXY_LOCATION"
35+
36+
# Parse CHARGING dependency
37+
CHARGING_LOCATION=$(echo '${{ github.event.pull_request.body }}' | grep '^CHARGING:' | sed 's/CHARGING: *//' | xargs)
38+
echo "Charging location: $CHARGING_LOCATION"
39+
40+
# Parse TM_VERSION
41+
TM_VERSION=$(echo '${{ github.event.pull_request.body }}' | grep '^TM_VERSION:' | sed 's/TM_VERSION: *//' | xargs)
42+
echo "TMForum API version: $TM_VERSION"
43+
44+
# Default values (using upstream FIWARE-TMForum repos)
45+
PROXY_REPO="FIWARE-TMForum/business-ecosystem-logic-proxy"
46+
PROXY_BRANCH="master"
47+
CHARGING_REPO="FIWARE-TMForum/business-ecosystem-charging-backend"
48+
CHARGING_BRANCH="master"
49+
TM_VERSION="${TM_VERSION:-1.3.18}"
50+
51+
# Process PROXY location if specified
52+
if [[ -n "$PROXY_LOCATION" ]]; then
53+
echo "Validating proxy repository..."
54+
STATUS=$(curl -o /dev/null -s -w "%{http_code}" "$PROXY_LOCATION")
55+
if [[ "$STATUS" -eq 200 ]]; then
56+
echo "Proxy repository found"
57+
PROXY_REPO=$(echo "$PROXY_LOCATION" | awk -F "/" '{print $4 "/" $5}')
58+
PROXY_BRANCH=$(echo "$PROXY_LOCATION" | awk -F "/tree/" '{print $2}')
59+
PROXY_BRANCH="${PROXY_BRANCH:-master}"
60+
echo "Extracted - Repo: $PROXY_REPO, Branch: $PROXY_BRANCH"
61+
else
62+
echo "Proxy repository not found: $PROXY_LOCATION (HTTP $STATUS)"
63+
exit 1
64+
fi
65+
fi
66+
67+
# Process CHARGING location if specified
68+
if [[ -n "$CHARGING_LOCATION" ]]; then
69+
echo "Validating charging repository..."
70+
STATUS=$(curl -o /dev/null -s -w "%{http_code}" "$CHARGING_LOCATION")
71+
if [[ "$STATUS" -eq 200 ]]; then
72+
echo "Charging repository found"
73+
CHARGING_REPO=$(echo "$CHARGING_LOCATION" | awk -F "/" '{print $4 "/" $5}')
74+
CHARGING_BRANCH=$(echo "$CHARGING_LOCATION" | awk -F "/tree/" '{print $2}')
75+
CHARGING_BRANCH="${CHARGING_BRANCH:-master}"
76+
echo "Extracted - Repo: $CHARGING_REPO, Branch: $CHARGING_BRANCH"
77+
else
78+
echo "Charging repository not found: $CHARGING_LOCATION (HTTP $STATUS)"
79+
exit 1
80+
fi
81+
fi
82+
83+
echo ""
84+
echo "E2E Test Configuration:"
85+
echo " Proxy: $PROXY_REPO @ $PROXY_BRANCH"
86+
echo " Charging: $CHARGING_REPO @ $CHARGING_BRANCH"
87+
echo " Frontend: ${{ github.repository }} @ ${{ github.event.pull_request.head.ref }}"
88+
echo " TM Version: $TM_VERSION"
89+
echo " PR URL: ${{ github.event.pull_request.html_url }}"
90+
echo ""
91+
92+
# Trigger E2E tests in DOME-testing repository
93+
echo "Triggering E2E tests..."
94+
curl -X POST \
95+
-H "Authorization: token ${{ secrets.ADMIN }}" \
96+
-H "Accept: application/vnd.github.everest-preview+json" \
97+
-H "Content-Type: application/json" \
98+
-d "{
99+
\"event_type\": \"cross-repo-test\",
100+
\"client_payload\": {
101+
\"repository_A\": \"$PROXY_REPO\",
102+
\"branch_A\": \"$PROXY_BRANCH\",
103+
\"repository_B\": \"$CHARGING_REPO\",
104+
\"branch_B\": \"$CHARGING_BRANCH\",
105+
\"repository_frontend\": \"${{ github.repository }}\",
106+
\"branch_frontend\": \"${{ github.event.pull_request.head.ref }}\",
107+
\"tm_version\": \"$TM_VERSION\",
108+
\"pull_request_url\": \"${{ github.event.pull_request.html_url }}\"
109+
}
110+
}" \
111+
https://api.github.com/repos/sluFicodes/DOME-testing/dispatches
112+
113+
echo "E2E tests triggered successfully!"

src/app/offerings/gallery/gallery.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<h2 class="text-4xl mt-4 font-extrabold text-primary-100 text-center dark:text-primary-50">{{ 'GALLERY._title' | translate }}</h2>
66
<div id="featuredOfferings" class="pt-8 pb-2 px-4 mx-auto max-w-screen-xl w-full grid gap-2 grid-cols-1 place-items-center sm:grid-cols-2 xl:grid-cols-4">
77
@for (prod of products; track prod.id; let index = $index) {
8-
<bae-off-card id="featuredOfferCard" [productOff]=prod [cardId]="index" class="w-full h-full"></bae-off-card>
8+
<bae-off-card data-cy="baeCard" id="featuredOfferCard" [productOff]=prod [cardId]="index" class="w-full h-full"></bae-off-card>
99
} @empty {
1010
}
1111
</div>

src/app/pages/checkout/checkout.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ <h1 class="mb-4 pb-2 mt-4 text-4xl font-extrabold leading-none tracking-tight te
114114
</span>
115115
</div>
116116
<span class="text-sm text-body"> {{ getPrice(item).text }} {{ formatter.format(getPrice(item).price) }}</span></div> -->
117-
<div class="flex justify-between w-full mt-2 mb-2 rounded-lg bg-white border-secondary-50 dark:bg-primary-100 dark:border-secondary-200 border shadow-lg">
117+
<div data-cy="checkoutOffering" class="flex justify-between w-full mt-2 mb-2 rounded-lg bg-white border-secondary-50 dark:bg-primary-100 dark:border-secondary-200 border shadow-lg">
118118
<div class="flex flex-col w-full">
119119
<div class="flex justify-between w-full">
120120
<button type="button" (click)="goToProdDetails(item)" class="flex p-2 box-decoration-clone">
@@ -186,7 +186,7 @@ <h1 class="mb-4 pb-2 mt-4 text-4xl font-extrabold leading-none tracking-tight te
186186
</div>
187187
-->
188188

189-
<button class="inline-flex items-center justify-center shrink-0 font-semibold leading-none rounded outline-none transition duration-300 ease-in-out focus:outline-0 focus:shadow focus:ring-1 focus:ring-accent-700 bg-primary-50 dark:bg-primary-100 text-white border border-transparent hover:bg-secondary-100 dark:hover:bg-primary-50 px-5 py-0 h-12 mt-5 w-full"
189+
<button data-cy="checkout" class="inline-flex items-center justify-center shrink-0 font-semibold leading-none rounded outline-none transition duration-300 ease-in-out focus:outline-0 focus:shadow focus:ring-1 focus:ring-accent-700 bg-primary-50 dark:bg-primary-100 text-white border border-transparent hover:bg-secondary-100 dark:hover:bg-primary-50 px-5 py-0 h-12 mt-5 w-full"
190190
(click)="orderProduct()" [disabled]="items.length==0 || !this.validBillAddr" [ngClass]="(items.length==0 || !this.validBillAddr)? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'">
191191
{{ 'SHOPPING_CART._checkout' | translate }}
192192
</button>

src/app/pages/checkout/checkout.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,18 @@ export class CheckoutComponent implements OnInit {
204204

205205
try {
206206
const response = await firstValueFrom(this.orderService.postProductOrder(productOrder));
207-
const redirectUrl = response.headers.get('X-redirect-url');
207+
const redirectUrl = response.headers.get('X-Redirect-URL');
208208

209+
console.log(response.headers)
209210
console.log(redirectUrl);
210211
console.log('PROD ORDER DONE');
211212

212213
if (redirectUrl) {
214+
console.log('redirectURL')
213215
// Going to the payment gateway
214216
window.location.href = redirectUrl;
215217
} else {
218+
console.log('non-redirectURL')
216219
// we clear the shopping cart only if no redirection is applied
217220
await this.emptyShoppingCart();
218221
this.goToInventory();

src/app/pages/dashboard/dashboard.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ export class DashboardComponent implements OnInit, OnDestroy {
7979
});
8080

8181
this.statsService.getStats().then(data=> {
82-
this.services=data?.services;
83-
this.publishers=data?.organizations;
82+
this.services=data?.services || [];
83+
this.publishers=data?.organizations || [];
8484
this.startTagTransition();
8585
})
8686
this.isFilterPanelShown = JSON.parse(this.localStorage.getItem('is_filter_panel_shown') as string);

src/app/pages/product-details/product-details.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,7 @@ <h3 class="text-2xl font-bold mb-4 dark:text-white">{{rel.name}}</h3>
575575
<!-- Drawer Reutilizable -->
576576

577577
<app-price-plan-drawer
578+
data-cy="pricePlanDrawer"
578579
[drawerId]="'drawer-product'"
579580
[productOff]="productOff"
580581
[prodSpec]="prodSpec"

src/app/pages/product-orders/sections/order-info/order-info.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ <h6 class="mb-3 text-sm font-bold text-gray-900 dark:text-white">
141141
<!-- <h2 class="md:text-3xl lg:text-4xl font-bold text-primary-100 ml-4 dark:text-white m-4">{{ 'PROFILE._order_list' | translate }}</h2>
142142
<hr class="h-px mr-4 ml-4 bg-primary-100 dark:bg-white border-0">-->
143143
<div class="m-4 relative overflow-x-auto border border-primary-100 dark:border-secondary-50 sm:rounded-lg">
144-
<table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-200">
144+
<table data-cy="ordersTable" class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-200">
145145
<thead class="text-xs text-gray-700 uppercase bg-secondary-50 dark:bg-primary-50 dark:text-secondary-100">
146146
<tr>
147147
<th scope="col" class="hidden md:table-cell px-6 py-3 text-center align-middle">

src/app/pages/search-catalog/search-catalog.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ <h5 class="text-2xl font-bold tracking-tight line-clamp-4 text-primary-100 dark:
104104
</div>
105105
<div class="md:pl-5 grid grid-cols-1 place-items-center lg:grid-cols-2 xl:grid-cols-3">
106106
@for (prod of products; track prod.id; let index = $index) {
107-
<bae-off-card [productOff]=prod [cardId]="index" class="w-full h-full p-2"></bae-off-card>
107+
<bae-off-card data-cy="baeCard" [productOff]=prod [cardId]="index" class="w-full h-full p-2"></bae-off-card>
108108
} @empty {
109109
<div class="min-h-19 dark:text-gray-600 text-center">{{ 'DASHBOARD._not_found' | translate }}</div>
110110
}

src/app/pages/search/search.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
} @else {
5353
<div class="md:pl-5 grid grid-cols-1 place-items-center lg:grid-cols-2 xl:grid-cols-3">
5454
@for (prod of products; track prod.id; let index = $index) {
55-
<bae-off-card [productOff]=prod [cardId]="index" class="w-full h-full p-2"></bae-off-card>
55+
<bae-off-card data-cy="baeCard" [productOff]=prod [cardId]="index" class="w-full h-full p-2"></bae-off-card>
5656
} @empty {
5757
<div class="min-h-19 dark:text-gray-600 text-center">{{ 'DASHBOARD._not_found' | translate }}</div>
5858
}

src/app/pages/seller-offerings/offerings/seller-catalogs/seller-catalogs.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ <h2 class="text-base font-bold">{{ 'OFFERINGS._order_by' | translate }}</h2>
148148
</th>
149149
</tr>
150150
</thead>
151-
<tbody>
151+
<tbody data-cy="catalogTable">
152152
@for (cat of catalogs; track cat.id) {
153-
<tr class="border-b hover:bg-gray-200 dark:bg-secondary-300 dark:border-gray-700 dark:hover:bg-secondary-200">
153+
<tr data-cy="catalogRow" class="border-b hover:bg-gray-200 dark:bg-secondary-300 dark:border-gray-700 dark:hover:bg-secondary-200">
154154
<td class="px-6 py-4 text-wrap break-all">
155155
{{cat.name}}
156156
</td>
@@ -169,7 +169,7 @@ <h2 class="text-base font-bold">{{ 'OFFERINGS._order_by' | translate }}</h2>
169169
{{cat.relatedParty?.at(0)?.role}}
170170
</td>
171171
<td class="px-6 py-4">
172-
<button type="button" (click)="goToUpdate(cat)" class="text-white bg-primary-100 hover:bg-primary-50 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-full text-sm p-2.5 text-center inline-flex items-center me-2">
172+
<button data-cy="catalogEdit" type="button" (click)="goToUpdate(cat)" class="text-white bg-primary-100 hover:bg-primary-50 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-full text-sm p-2.5 text-center inline-flex items-center me-2">
173173
<svg class="w-[18px] h-[18px] text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
174174
<path fill-rule="evenodd" d="M14 4.182A4.136 4.136 0 0 1 16.9 3c1.087 0 2.13.425 2.899 1.182A4.01 4.01 0 0 1 21 7.037c0 1.068-.43 2.092-1.194 2.849L18.5 11.214l-5.8-5.71 1.287-1.31.012-.012Zm-2.717 2.763L6.186 12.13l2.175 2.141 5.063-5.218-2.141-2.108Zm-6.25 6.886-1.98 5.849a.992.992 0 0 0 .245 1.026 1.03 1.03 0 0 0 1.043.242L10.282 19l-5.25-5.168Zm6.954 4.01 5.096-5.186-2.218-2.183-5.063 5.218 2.185 2.15Z" clip-rule="evenodd"/>
175175
</svg>

0 commit comments

Comments
 (0)