End to End Cypress Test #149
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: | |
setup: | |
runs-on: windows-latest | |
name: Setup Project | |
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: [email protected] | |
platform_user_password: Zango@123 | |
project_name: zango_project | |
postgres_user: zango_admin | |
postgres_password: zangopass | |
postgres_db: zango | |
platform_domain_url: localhost | |
domain_config_path: ./e2e-tests/local_domains.txt | |
cypress-run-chrome: | |
runs-on: windows-latest | |
name: E2E on Chrome | |
needs: setup | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Capture Start Time | |
id: start-time | |
run: echo "START_TIME=$(date +%s)" >> $GITHUB_ENV | |
- name: Install cypress dependencies | |
run: npm install | |
working-directory: e2e-tests | |
- name: Run Cypress tests | |
uses: cypress-io/github-action@v6 | |
with: | |
browser: chrome | |
working-directory: e2e-tests | |
continue-on-error: true | |
- name: Capture End Time | |
id: end-time | |
run: echo "END_TIME=$(date +%s)" >> $GITHUB_ENV | |
- 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 | |
- 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 | |
- 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" # Adjust this if needed | |
DEVICE_NAME: "Remote Device" | |
PLATFORM_NAME: windows | |
PLATFORM_VERSION: "10" | |
CI_ENVIRONMENT: "GitHub Actions" | |
- name: Upload Cypress screenshots | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cypress-windows-chrome-screenshots | |
path: e2e-tests/cypress/screenshots | |
if-no-files-found: ignore | |
- name: Upload Cypress videos | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cypress-windows-chrome-videos | |
path: e2e-tests/cypress/videos | |
if-no-files-found: ignore | |
- 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 | |
cypress-run-firefox: | |
runs-on: windows-latest | |
name: E2E on Firefox | |
needs: cypress-run-chrome | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Capture Start Time | |
id: start-time | |
run: echo "START_TIME=$(date +%s)" >> $GITHUB_ENV | |
- name: Install cypress dependencies | |
run: npm install | |
working-directory: e2e-tests | |
- name: Run Cypress tests | |
uses: cypress-io/github-action@v6 | |
with: | |
browser: firefox | |
working-directory: e2e-tests | |
continue-on-error: true | |
- name: Capture End Time | |
id: end-time | |
run: echo "END_TIME=$(date +%s)" >> $GITHUB_ENV | |
- 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 | |
- 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 | |
- 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: firefox | |
BROWSER_VERSION: "127" # Adjust this if needed | |
DEVICE_NAME: "Remote Device" | |
PLATFORM_NAME: windows | |
PLATFORM_VERSION: "10" | |
CI_ENVIRONMENT: "GitHub Actions" | |
- name: Upload Cypress screenshots | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cypress-windows-firefox-screenshots | |
path: e2e-tests/cypress/screenshots | |
if-no-files-found: ignore | |
- name: Upload Cypress videos | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cypress-windows-firefox-videos | |
path: e2e-tests/cypress/videos | |
if-no-files-found: ignore | |
- 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 |