End to End Cypress Test #230
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
name: End to End Cypress Test | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- "e2e-tests/**" | |
- "frontend/**" | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
branches: | |
- main | |
paths: | |
- "frontend/**" | |
- "e2e-tests/**" | |
release: | |
types: | |
- published | |
- released | |
jobs: | |
cypress-run: | |
runs-on: ubuntu-latest | |
name: E2E on Chrome | |
steps: | |
# Step 1: Checkout repo | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Step 2: Remove old build files | |
- name: Remove old build files | |
run: | | |
find backend/src/zango/assets/app_panel/js -name "build.*.min.js" -type f -delete | |
find backend/src/zango/assets/app_panel/js -name "build.*.min.js.LICENSE.txt" -type f -delete | |
# Step 3: Installing Node | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
# Step 4: Installing dependencies | |
- name: Install dependencies | |
run: | | |
cd frontend | |
yarn install | |
# Step 5: Generating Build and placing it in the folder | |
- name: Building app | |
run: | | |
cd frontend | |
CI=false yarn build | |
# Step 6: Removing license file for the new build | |
- name: Remove old build files | |
run: | | |
find backend/src/zango/assets/app_panel/js -name "build.*.min.js.LICENSE.txt" -type f -delete | |
# Step 7: Set up zango project with latest zango build | |
- name: Setup latest zango project | |
uses: ./.github/actions/zango-project-setup-action | |
with: | |
platform_username: platform_admin@zango.dev | |
platform_user_password: Zango@123 #pragma: allowlist secret | |
project_name: zango_project | |
postgres_user: zango_admin | |
postgres_password: zangopass #pragma: allowlist secret | |
postgres_db: zango | |
platform_domain_url: localhost | |
domain_config_path: ./e2e-tests/local_domains.txt | |
# Step 8: Capturing start time | |
- name: Capture Start Time | |
id: start-time | |
run: echo "START_TIME=$(date +%s)" >> $GITHUB_ENV | |
# Step 9: Install cypress dependencies | |
- name: Install cypress dependencies | |
run: npm install | |
working-directory: e2e-tests | |
# Step 10: Run Cypress tests and record results | |
- name: Run Cypress tests | |
uses: cypress-io/github-action@v6 | |
with: | |
browser: chrome | |
working-directory: e2e-tests | |
continue-on-error: true | |
# Step 11: Capturing end time | |
- name: Capture End Time | |
id: end-time | |
run: echo "END_TIME=$(date +%s)" >> $GITHUB_ENV | |
# Step 12: Calculating total duration of cypress tests | |
- name: Calculate Duration | |
id: duration | |
run: | | |
DURATION_SECONDS=$((END_TIME - START_TIME)) | |
DURATION_MINUTES=$((DURATION_SECONDS / 60)) | |
DURATION_REMAINDER_SECONDS=$((DURATION_SECONDS % 60)) | |
DURATION="${DURATION_MINUTES}m ${DURATION_REMAINDER_SECONDS}s" | |
echo "DURATION=${DURATION}" >> $GITHUB_ENV | |
#Step 13: Extracting zango version | |
- name: Extract Version | |
id: extract_version | |
run: | | |
ZANGO_VERSION=$(grep '__version__' backend/src/zango/__init__.py | sed 's/.*__version__ = "\(.*\)"/\1/' | tail -1) | |
echo "ZANGO_VERSION=${ZANGO_VERSION}" >> $GITHUB_ENV | |
# Step 14: Generate Cucumber HTML Report | |
- name: Generate Cucumber HTML Report | |
run: | | |
echo "Running cucumber-html-report.js" | |
ls -la | |
node cucumber-html-report.js | |
working-directory: e2e-tests | |
env: | |
BROWSER_NAME: chrome | |
BROWSER_VERSION: "127" | |
DEVICE_NAME: "Remote Device" | |
PLATFORM_NAME: "Ubuntu" | |
PLATFORM_VERSION: "22.04.4" | |
CI_ENVIRONMENT: "GitHub Actions" | |
# Step 15: Upload Cypress screenshots | |
- name: Upload Cypress screenshots | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cypress-screenshots | |
path: e2e-tests/cypress/screenshots | |
if-no-files-found: ignore | |
# Step 16: Upload Cypress videos | |
- name: Upload Cypress videos | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cypress-videos | |
path: e2e-tests/cypress/videos | |
if-no-files-found: ignore | |
# Step 17: Upload Cucumber HTML Report | |
- name: Upload Cucumber HTML Report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cucumber-html-report | |
path: e2e-tests/reports/cucumber-html-report.html | |
if-no-files-found: ignore |