Skip to content

Commit 1f77f37

Browse files
Merge pull request #1312 from eclipse-tractusx/chore/xxx-execution-e2e-test-frontend
Chore/xxx execution e2e test frontend
2 parents 664b9ec + 366bf74 commit 1f77f37

File tree

7 files changed

+48
-185
lines changed

7 files changed

+48
-185
lines changed

.github/workflows/e2e-tests-xray_frontend.yml

Lines changed: 40 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,17 @@
1616
# SPDX-License-Identifier: Apache-2.0
1717

1818
# Require to set secrets:
19-
# - ORG_IRS_JIRA_USERNAME
20-
# - ORG_IRS_JIRA_PASSWORD
19+
# - ASSOCIATION_SUPERVISOR_CLIENT_ID
20+
# - ASSOCIATION_SUPERVISOR_PASSWORD
2121
name: "[FE][TEST][E2E]- Cypress"
2222

2323
on:
2424
# triggered manually by Test Manager
2525
workflow_dispatch:
26-
inputs:
27-
jira_filter_id:
28-
description: 'Jira filter ID to fetch test scenarios'
29-
required: false
30-
# by default, we use this filter: https://jira.catena-x.net/issues/?filter=11645
31-
default: 11645
3226
# or automatically by merge to main
33-
#push:
34-
branches: main
27+
push:
28+
branches:
29+
- main
3530
paths:
3631
- 'frontend/**'
3732

@@ -56,14 +51,29 @@ jobs:
5651
with:
5752
cmd: install # will run `yarn install` command
5853

59-
# Fetch feature files
54+
# Fetch feature files
6055
- name: Fetch .feature files from Jira Xray
6156
env:
62-
JIRA_USERNAME: ${{ secrets.ORG_IRS_JIRA_USERNAME }}
63-
JIRA_PASSWORD: ${{ secrets.ORG_IRS_JIRA_PASSWORD }}
64-
JIRA_FILTER_ID: ${{ github.event.inputs.jira_filter_id }}
57+
JIRA_USERNAME: ${{ secrets.ASSOCIATION_TX_JIRA_USERNAME }}
58+
JIRA_PASSWORD: ${{ secrets.ASSOCIATION_TX_JIRA_PASSWORD }}
6559
working-directory: frontend
66-
run: ./scripts/xray-download-feature-files.sh
60+
run: |
61+
token=$(curl -H "Content-Type: application/json" -X POST \
62+
--data "{ \"client_id\": \"$JIRA_USERNAME\",\"client_secret\": \"$JIRA_PASSWORD\" }" \
63+
https://xray.cloud.getxray.app/api/v2/authenticate | tr -d '"')
64+
65+
export HTTP_RESULT=$(curl -s --show-error -w "%{http_code}" --header "Authorization: Bearer $token" \
66+
"https://xray.cloud.getxray.app/api/v2/export/cucumber?filter=10007&fz=true" -o features.zip)
67+
68+
[[ $HTTP_RESULT == 200 || $HTTP_RESULT == 400 ]]
69+
echo "::set-output name=http_response::$HTTP_RESULT"
70+
71+
- name: Unzip feature files
72+
if: ${{ steps.download.outputs.http_response == '200' }}
73+
working-directory: frontend
74+
run: |
75+
unzip -o features.zip -d cypress/e2e
76+
rm -f features.zip
6777
6878
- name: Save cypress/e2e folder
6979
uses: actions/upload-artifact@v4
@@ -76,6 +86,7 @@ jobs:
7686
cypress-run-chrome:
7787
timeout-minutes: 15
7888
runs-on: ubuntu-latest
89+
if: ${{ steps.download.outputs.http_response == '200' }}
7990
defaults:
8091
run:
8192
working-directory: frontend
@@ -125,22 +136,30 @@ jobs:
125136
working-directory: frontend
126137
# using wait-on parameter causes "Error: connect ECONNREFUSED 127.0.0.1:4200"
127138
env:
128-
CYPRESS_SUPERVISOR_LOGIN: ${{ secrets.TRACE_X_SUPERVISOR_LOGIN }}
129-
CYPRESS_SUPERVISOR_PW: ${{ secrets.TRACE_X_SUPERVISOR_PW }}
139+
CYPRESS_SUPERVISOR_LOGIN: ${{ secrets.ASSOCIATION_SUPERVISOR_CLIENT_ID }}
140+
CYPRESS_SUPERVISOR_PW: ${{ secrets.ASSOCIATION_SUPERVISOR_PASSWORD }}
130141
CYPRESS_ADMIN_LOGIN: ${{ secrets.TRACE_X_ADMIN_LOGIN }}
131142
CYPRESS_ADMIN_PW: ${{ secrets.TRACE_X_ADMIN_PW }}
132143
CYPRESS_USER_LOGIN: ${{ secrets.TRACE_X_USER_LOGIN }}
133144
CYPRESS_USER_PW: ${{ secrets.TRACE_X_USER_PW }}
134-
CYPRESS_REDIRECT_URI: https://traceability-portal-e2e-a.dev.demo.catena-x.net/dashboard
145+
CYPRESS_REDIRECT_URI: https://traceability-portal-int-a.int.catena-x.net/dashboard
135146

136147
- name: Submit results to Xray
137148
# we don't want to submit results to xray when it was run by PR
138149
if: github.event_name != 'pull_request' && (success() || failure())
139150
env:
140-
JIRA_USERNAME: ${{ secrets.ORG_IRS_JIRA_USERNAME }}
141-
JIRA_PASSWORD: ${{ secrets.ORG_IRS_JIRA_PASSWORD }}
151+
JIRA_USERNAME: ${{ secrets.ASSOCIATION_TX_JIRA_USERNAME }}
152+
JIRA_PASSWORD: ${{ secrets.ASSOCIATION_TX_JIRA_PASSWORD }}
142153
run: |
143-
./scripts/xray-push-test-results.sh
154+
token=$(curl -H "Content-Type: application/json" -X POST \
155+
--data "{ \"client_id\": \"$JIRA_USERNAME\",\"client_secret\": \"$JIRA_PASSWORD\" }" \
156+
https://xray.cloud.getxray.app/api/v2/authenticate | tr -d '"')
157+
158+
curl --request POST \
159+
--header 'Content-Type: application/json' \
160+
--header "Authorization: Bearer $token" \
161+
--data-binary '@cypress/reports/cucumber-report.json' \
162+
"https://xray.cloud.getxray.app/api/v2/import/execution/cucumber"
144163
145164
- name: Archive cypress artifacts
146165
if: success() || failure()
@@ -150,121 +169,3 @@ jobs:
150169
path: |
151170
frontend/cypress/videos/
152171
frontend/cypress/screenshots/
153-
154-
# cypress-run-firefox:
155-
# timeout-minutes: 15
156-
# runs-on: ubuntu-latest
157-
# defaults:
158-
# run:
159-
# working-directory: frontend
160-
# container:
161-
# # if you need to change image please make sure use the same version in all places
162-
# # (here and in cypress/Dockerfile)
163-
# image: cypress/browsers:node16.16.0-chrome107-ff107-edge
164-
# options: --user 1001
165-
# needs: install
166-
#
167-
# steps:
168-
# - name: Checkout
169-
# uses: actions/checkout@v4
170-
#
171-
# - name: Download the cypress/e2e folder
172-
# uses: actions/download-artifact@v4
173-
# with:
174-
# name: cypress - e2e
175-
# path: frontend/cypress/e2e
176-
#
177-
# - name: Use Node.js 18.x
178-
# uses: actions/setup-node@v4
179-
# with:
180-
# node-version: 18.x
181-
#
182-
# - name: Cypress run all tests
183-
# uses: cypress-io/[email protected] # use the explicit version number
184-
# with:
185-
# start: npm start
186-
# wait-on: "http://localhost:4200"
187-
# wait-on-timeout: 120
188-
# browser: firefox
189-
# working-directory: frontend
190-
#
191-
# - name: Submit results to Xray
192-
# # we don't want to submit results to xray when it was run by PR
193-
# if: github.event_name != 'pull_request' && (success() || failure())
194-
# env:
195-
# JIRA_USERNAME: ${{ secrets.ORG_IRS_JIRA_USERNAME }}
196-
# JIRA_PASSWORD: ${{ secrets.ORG_IRS_JIRA_PASSWORD }}
197-
# run: |
198-
# ./scripts/xray-push-test-results.sh
199-
#
200-
# - name: Archive cypress artifacts
201-
# if: success() || failure()
202-
# uses: actions/upload-artifact@v4
203-
# with:
204-
# name: cypress generated files - firefox
205-
# path: |
206-
# frontend/cypress/videos/
207-
# frontend/cypress/screenshots/
208-
#
209-
# cypress-run-webkit:
210-
# timeout-minutes: 15
211-
# runs-on: ubuntu-latest
212-
# defaults:
213-
# run:
214-
# working-directory: frontend
215-
# needs: install
216-
#
217-
# steps:
218-
# - name: Checkout
219-
# uses: actions/checkout@v4
220-
#
221-
# - name: Download the cypress/e2e folder
222-
# uses: actions/download-artifact@v4
223-
# with:
224-
# name: cypress - e2e
225-
# path: frontend/cypress/e2e
226-
227-
# commented because if we use it here, we face with that problem:
228-
# "http://localhost:4200 timed out on retry 151 of 5, elapsed 150449ms, limit 150000ms
229-
# Error: connect ECONNREFUSED 127.0.0.1:4200"
230-
231-
# - name: Use Node.js 18.x
232-
# uses: actions/setup-node@v4
233-
# with:
234-
# node-version: 18.x
235-
236-
# - name: Use Node.js 16.x
237-
# uses: actions/setup-node@v4
238-
# with:
239-
# node-version: 16.x
240-
#
241-
# # https://docs.cypress.io/guides/guides/launching-browsers#Linux-Dependencies
242-
# - name: Install additional dependencies
243-
# run: npx playwright install --with-deps webkit
244-
#
245-
# - name: Cypress run all tests
246-
# uses: cypress-io/[email protected] # use the explicit version number
247-
# with:
248-
# start: npm start:auth:e2ea
249-
# wait-on: "http://localhost:4200"
250-
# wait-on-timeout: 120
251-
# browser: webkit
252-
# working-directory: frontend
253-
#
254-
# - name: Submit results to Xray
255-
# # we don't want to submit results to xray when it was run by PR
256-
# if: github.event_name != 'pull_request' && (success() || failure())
257-
# env:
258-
# JIRA_USERNAME: ${{ secrets.ORG_IRS_JIRA_USERNAME }}
259-
# JIRA_PASSWORD: ${{ secrets.ORG_IRS_JIRA_PASSWORD }}
260-
# run: |
261-
# ./scripts/xray-push-test-results.sh
262-
#
263-
# - name: Archive cypress artifacts
264-
# if: success() || failure()
265-
# uses: actions/upload-artifact@v4
266-
# with:
267-
# name: cypress generated files - webkit
268-
# path: |
269-
# frontend/cypress/videos/
270-
# frontend/cypress/screenshots/

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ _**For better traceability add the corresponding GitHub issue number in each cha
1818
- #XXX update springboot to 3.2.8 from 3.2.5
1919
- #XXX define uid and gid of backend Dockerfile directly in user, instead of variables
2020
- #1244 upgraded registry from 0.4.1 to 0.5.0
21+
- #XXX update e2e-tests-xray_frontend.yml to support association int environment
2122

2223
## [13.0.0 - 19.07.2024]
2324

frontend/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,5 @@ yarn-error.log
6666

6767
scripts/download/*
6868
/cypress.local.config.ts
69+
/cypress.local.config-original.ts
70+
/cypress/downloads/Exported_Contracts.csv

frontend/cypress/support/step_definitions/login.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ Given('user logged in as {string}', function(userType) {
2525

2626
let redirectUri = encodeURIComponent(Cypress.env('REDIRECT_URI'));
2727

28-
cy.visit('https://centralidp.dev.demo.catena-x.net/auth/realms/CX-Central/protocol/openid-connect/auth?client_id=Cl17-CX-Part&redirect_uri=' + redirectUri + '&state=0aaee615-388e-400c-8b0c-81ac443a2cf3&response_mode=fragment&response_type=code&scope=openid&nonce=4104d5ab-b2bd-43a1-b6c2-7adf30543579&code_challenge=uXHR3gDRnSyjPEu8yWNdzm6Izsd7cKzEryfvRAtJTjU&code_challenge_method=S256');
28+
cy.visit('https://centralidp.int.catena-x.net/auth/realms/CX-Central/protocol/openid-connect/auth?client_id=app12&redirect_uri=' + redirectUri);
2929
cy.get('.search').click();
30-
cy.get('.search').type('CX-Test-Access');
31-
cy.get('.CX_Test_Access').click();
30+
cy.get('.search').type('BMW Trace-X');
31+
cy.get('.idp-card').contains('BMW Trace-X').click();
3232
cy.get('input[name="username"]').type(loginMail);
3333
cy.get('input[name="password"]').click().focus().type(loginPW, {log:false});
3434
cy.get('input[type="submit"]').click();

frontend/cypress/support/step_definitions/quality-investigations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Then('select part with id {string}', function(id: string) {
3939
Then('start notification creation with description {string}', function(notificationType: string, description: string) {
4040
const date = new Date().getTime();
4141
notificationDescription = description + '_' + date;
42-
cy.get('[data-testid="create-notification-button"]').click();
42+
cy.get('[data-testid="create-notification-button"]').click({force: true});
4343
cy.get('mat-label').contains(/^Description$/i).click().type(notificationDescription);
4444
});
4545

@@ -65,7 +65,7 @@ When('{string} deadline', function(deadline: string) {
6565

6666

6767
When('request the {string}', function(notificationType: string) {
68-
cy.get('[data-testid="save-button"]').click();
68+
cy.get('[data-testid="save-button"]').click({force: true});
6969
});
7070

7171

frontend/scripts/xray-download-feature-files.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

frontend/scripts/xray-push-test-results.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)