Merge pull request #1319 from eclipse-tractusx/chore/prepare-helm-rel… #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 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 | ||
# Require to set secrets: | ||
# - ASSOCIATION_SUPERVISOR_CLIENT_ID | ||
# - ASSOCIATION_SUPERVISOR_PASSWORD | ||
name: "[FE][TEST][E2E]- Cypress" | ||
on: | ||
# triggered manually by Test Manager | ||
workflow_dispatch: | ||
# or automatically by merge to main | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'frontend/**' | ||
jobs: | ||
install: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: frontend | ||
# Install YARN dependencies, cache them correctly | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Use Node.js 20.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
- name: Run yarn install | ||
uses: Borales/actions-yarn@v5 | ||
with: | ||
cmd: install # will run `yarn install` command | ||
# Fetch feature files | ||
- name: Fetch .feature files from Jira Xray | ||
env: | ||
JIRA_USERNAME: ${{ secrets.ASSOCIATION_TX_JIRA_USERNAME }} | ||
JIRA_PASSWORD: ${{ secrets.ASSOCIATION_TX_JIRA_PASSWORD }} | ||
working-directory: frontend | ||
run: | | ||
token=$(curl -H "Content-Type: application/json" -X POST \ | ||
--data "{ \"client_id\": \"$JIRA_USERNAME\",\"client_secret\": \"$JIRA_PASSWORD\" }" \ | ||
https://xray.cloud.getxray.app/api/v2/authenticate | tr -d '"') | ||
export HTTP_RESULT=$(curl -s --show-error -w "%{http_code}" --header "Authorization: Bearer $token" \ | ||
"https://xray.cloud.getxray.app/api/v2/export/cucumber?filter=10007&fz=true" -o features.zip) | ||
[[ $HTTP_RESULT == 200 || $HTTP_RESULT == 400 ]] | ||
echo "::set-output name=http_response::$HTTP_RESULT" | ||
- name: Unzip feature files | ||
if: ${{ steps.download.outputs.http_response == '200' }} | ||
working-directory: frontend | ||
run: | | ||
unzip -o features.zip -d cypress/e2e | ||
rm -f features.zip | ||
- name: Save cypress/e2e folder | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cypress - e2e | ||
if-no-files-found: error | ||
path: frontend/cypress/e2e | ||
overwrite: true | ||
cypress-run-chrome: | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
if: ${{ steps.download.outputs.http_response == '200' }} | ||
Check failure on line 89 in .github/workflows/e2e-tests-xray_frontend.yml GitHub Actions / [FE][TEST][E2E]- CypressInvalid workflow file
|
||
defaults: | ||
run: | ||
working-directory: frontend | ||
container: | ||
# if you need to change image please make sure use the same version in all places | ||
# (here and in cypress/Dockerfile) | ||
image: cypress/browsers:node16.16.0-chrome107-ff107-edge | ||
options: --user 1001 | ||
needs: install | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Download the cypress/e2e folder | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: cypress - e2e | ||
path: frontend/cypress/e2e | ||
- name: Use Node.js 20.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
- name: Install Angular CLI | ||
run: npm install -g @angular/cli | ||
- name: Run yarn install | ||
uses: Borales/actions-yarn@v5 | ||
with: | ||
cmd: install # will run `yarn install` command | ||
dir: frontend | ||
- name: Start Frontend Application | ||
working-directory: frontend | ||
run: | | ||
npm run start:auth:e2ea & | ||
sleep 60 && | ||
curl http://localhost:4200 -I | ||
- name: Cypress run all tests | ||
uses: cypress-io/[email protected] # use the explicit version number | ||
with: | ||
browser: chrome | ||
working-directory: frontend | ||
# using wait-on parameter causes "Error: connect ECONNREFUSED 127.0.0.1:4200" | ||
env: | ||
CYPRESS_SUPERVISOR_LOGIN: ${{ secrets.ASSOCIATION_SUPERVISOR_CLIENT_ID }} | ||
CYPRESS_SUPERVISOR_PW: ${{ secrets.ASSOCIATION_SUPERVISOR_PASSWORD }} | ||
CYPRESS_ADMIN_LOGIN: ${{ secrets.TRACE_X_ADMIN_LOGIN }} | ||
CYPRESS_ADMIN_PW: ${{ secrets.TRACE_X_ADMIN_PW }} | ||
CYPRESS_USER_LOGIN: ${{ secrets.TRACE_X_USER_LOGIN }} | ||
CYPRESS_USER_PW: ${{ secrets.TRACE_X_USER_PW }} | ||
CYPRESS_REDIRECT_URI: https://traceability-portal-int-a.int.catena-x.net/dashboard | ||
- name: Submit results to Xray | ||
# we don't want to submit results to xray when it was run by PR | ||
if: github.event_name != 'pull_request' && (success() || failure()) | ||
env: | ||
JIRA_USERNAME: ${{ secrets.ASSOCIATION_TX_JIRA_USERNAME }} | ||
JIRA_PASSWORD: ${{ secrets.ASSOCIATION_TX_JIRA_PASSWORD }} | ||
run: | | ||
token=$(curl -H "Content-Type: application/json" -X POST \ | ||
--data "{ \"client_id\": \"$JIRA_USERNAME\",\"client_secret\": \"$JIRA_PASSWORD\" }" \ | ||
https://xray.cloud.getxray.app/api/v2/authenticate | tr -d '"') | ||
curl --request POST \ | ||
--header 'Content-Type: application/json' \ | ||
--header "Authorization: Bearer $token" \ | ||
--data-binary '@cypress/reports/cucumber-report.json' \ | ||
"https://xray.cloud.getxray.app/api/v2/import/execution/cucumber" | ||
- name: Archive cypress artifacts | ||
if: success() || failure() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cypress generated files - chrome | ||
path: | | ||
frontend/cypress/videos/ | ||
frontend/cypress/screenshots/ |