Skip to content

v1.61.5

v1.61.5 #1201

Workflow file for this run

name: E2E
on: [pull_request]
jobs:
test:
name: E2E
runs-on: ubuntu-latest
steps:
- name: Get preview url
id: get_url
run: |
CURRENT_HASH=${{ github.event.pull_request.head.sha }}
echo "Looking for deployment for commit: $CURRENT_HASH"
MAX_ATTEMPTS=60 # 5 minutes maximum wait time
ATTEMPT=0
while [ $ATTEMPT -lt $MAX_ATTEMPTS ]
do
RESULTS=$(curl -s -H 'Accept: application/json' -H "Authorization: Bearer ${{ secrets.VERCEL_TOKEN }}" "https://api.vercel.com/v6/now/deployments?teamId=tone-row&name=flowchart-fun")
CLEAN=$(echo $RESULTS | tr -d '[:cntrl:]')
# Check if there's any READY deployment for this commit
READY_URL=$(echo $CLEAN | jq --arg h "$CURRENT_HASH" -r '.deployments[] | select(.meta.githubCommitSha==$h and .state=="READY") | .url' | head -n1)
if [ ! -z "$READY_URL" ]; then
echo "Found ready deployment!"
echo "preview_url=https://$READY_URL" >> $GITHUB_OUTPUT
exit 0
fi
# If no READY deployment found, check if all deployments for this commit have errored
ALL_STATES=$(echo $CLEAN | jq --arg h "$CURRENT_HASH" -r '.deployments[] | select(.meta.githubCommitSha==$h) | .state')
if [ ! -z "$ALL_STATES" ] && [ -z "$(echo "$ALL_STATES" | grep -v "ERROR")" ]; then
echo "All deployments have failed for this commit"
exit 1
fi
echo "Waiting for deployment... (Attempt $ATTEMPT of $MAX_ATTEMPTS)"
ATTEMPT=$((ATTEMPT + 1))
sleep 5
done
echo "Timeout waiting for deployment"
exit 1
- name: Checkout Code
uses: actions/checkout@v4
- name: Add env
run: |
touch app/.env
echo RAPID_API_KEY=${{ secrets.RAPID_API_KEY }} >> app/.env
echo STRIPE_KEY_TEST_ENV=${{ secrets.STRIPE_KEY_TEST_ENV }} >> app/.env
echo TESTING_EMAIL=${{ secrets.TESTING_EMAIL }} >> app/.env
echo TESTING_PASS=${{ secrets.TESTING_PASS }} >> app/.env
echo TESTING_EMAIL_PRO=${{ secrets.TESTING_EMAIL_PRO }} >> app/.env
echo TESTING_PASS_PRO=${{ secrets.TESTING_PASS_PRO }} >> app/.env
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Install Playwright
run: |
pnpm add -g playwright@1.45.2
playwright install
- name: Install Deps
run: pnpm install
- name: Run E2E Tests on Vercel Preview URL
run: E2E_START_URL="${{ steps.get_url.outputs.preview_url }}" pnpm -F app e2e
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: test-results
path: app/test-results