Skip to content

fix(e2e): use URL filter parameter for App Catalog search (#102) #99

fix(e2e): use URL filter parameter for App Catalog search (#102)

fix(e2e): use URL filter parameter for App Catalog search (#102) #99

Workflow file for this run

name: Collections Toolkit E2E Tests
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Serialize E2E tests to prevent deployment and UI collisions
concurrency:
group: e2e-tests-${{ github.repository }}
cancel-in-progress: false # Let running tests finish before starting new ones
permissions:
contents: read
jobs:
e2e:
runs-on: ubuntu-latest
timeout-minutes: 15
if: github.actor != 'dependabot[bot]'
env:
FOUNDRY_API_CLIENT_ID: ${{ secrets.FOUNDRY_API_CLIENT_ID }}
FOUNDRY_API_CLIENT_SECRET: ${{ secrets.FOUNDRY_API_CLIENT_SECRET }}
FOUNDRY_CID: ${{ secrets.FOUNDRY_CID }}
FOUNDRY_CLOUD_REGION: ${{ secrets.FOUNDRY_CLOUD_REGION }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@1ccc07ccd8b9519f44d3e5eaa1b41dd90310adf0 # master
- name: Install required tools
run: |
brew tap crowdstrike/foundry-cli
brew install crowdstrike/foundry-cli/foundry yq
- name: Create directory for Foundry CLI
run: mkdir -p ~/.config/foundry
- name: Prepare app manifest
run: |
# Remove IDs from manifest
yq -i 'del(.. | select(has("id")).id) | del(.. | select(has("app_id")).app_id)' manifest.yml
# Generate unique app name with length safety
REPO_NAME="${{ github.event.repository.name }}"
ACTOR="${{ github.actor }}"
SHORT_ACTOR="${ACTOR/dependabot\[bot\]/deps}"
UNIQUE_NAME="${REPO_NAME}-${SHORT_ACTOR}-$(date +"%m%d%H%M")"
# Truncate if too long by removing foundry- prefix
if [ ${#UNIQUE_NAME} -gt 50 ]; then
REPO_BASE="${REPO_NAME#foundry-}"
UNIQUE_NAME="${REPO_BASE}-${SHORT_ACTOR}-$(date +"%m%d%H%M")"
fi
# Export for yq and set the manifest name
export UNIQUE_NAME
yq -i '.name = env(UNIQUE_NAME)' manifest.yml
# Set app name as environment variable
APP_NAME=$(yq '.name' manifest.yml)
echo "APP_NAME=$APP_NAME" >> $GITHUB_ENV
echo "Prepared manifest with app name: $APP_NAME"
- name: Deploy app to Falcon
run: |
foundry apps deploy --change-type=major --change-log="e2e deploy"
echo "App deployment initiated"
- name: Wait for deployment and release app
run: |
echo "Waiting for deployment to complete..."
timeout=300 # 5 minute timeout
elapsed=0
while [ $elapsed -lt $timeout ]; do
if foundry apps list-deployments | grep -i "successful"; then
echo "Deployment successful, releasing app..."
foundry apps release --change-type=major --notes="e2e release"
echo "App released successfully"
# Brief wait for release to complete - E2E tests handle app discovery with retries
echo "Allowing brief time for release to complete..."
sleep 15
# Verify deployment status and get app details
echo "Verifying final deployment status..."
foundry apps list-deployments
echo "Final deployed app name: $APP_NAME"
exit 0
fi
if foundry apps list-deployments | grep -i "failed"; then
echo "Deployment failed"
exit 1
fi
sleep 5
elapsed=$((elapsed + 5))
done
echo "Deployment timeout after ${timeout} seconds"
exit 1
# Parallelize Node setup while deployment happens
- name: Install Node LTS
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 22
cache: 'npm'
cache-dependency-path: e2e/package-lock.json
- name: Install dependencies
run: npm ci
working-directory: e2e
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
working-directory: e2e
- name: Make envfile
uses: SpicyPizza/create-envfile@6da099c0b655bd3abd8273c4e2fe7c59e63fa88a # v2
with:
envkey_FALCON_USERNAME: ${{ secrets.FALCON_USERNAME }}
envkey_FALCON_PASSWORD: ${{ secrets.FALCON_PASSWORD }}
envkey_FALCON_AUTH_SECRET: ${{ secrets.FALCON_AUTH_SECRET }}
envkey_APP_NAME: $APP_NAME
directory: e2e
- name: Run Playwright tests
run: npx dotenvx run --quiet -- npx playwright test
working-directory: e2e
env:
CI: true
- name: Upload Playwright report
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
if: ${{ !cancelled() }}
with:
name: playwright-report-${{ env.APP_NAME }}
path: e2e/playwright-report/
retention-days: 7
- name: Upload test results and screenshots
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
if: ${{ !cancelled() }}
with:
name: playwright-test-results-${{ env.APP_NAME }}
path: e2e/test-results/
retention-days: 7
- name: Delete app from Falcon
if: always()
run: |
echo "Deleting app: $APP_NAME"
foundry apps delete -f || echo "App deletion failed, may already be deleted"