Skip to content

Merge pull request #833 from peterbe/dependabot/npm_and_yarn/firebase… #1958

Merge pull request #833 from peterbe/dependabot/npm_and_yarn/firebase…

Merge pull request #833 from peterbe/dependabot/npm_and_yarn/firebase… #1958

Workflow file for this run

name: Emulated end-to-end testing
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
cache: "yarn"
- name: Cache node_modules
uses: actions/cache@v4
id: cached-node_modules
with:
path: |
node_modules
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}-${{ hashFiles('.github/workflows/e2e.yml') }}
- name: Install
if: steps.cached-node_modules.outputs.cache-hit != 'true'
env:
# This is because package.json contains `minimalcss` which depends
# on `puppeteer`.
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
run: yarn --frozen-lockfile
- name: Cache node_modules (functions)
uses: actions/cache@v4
id: cached-node_modules-functions
with:
path: |
functions/node_modules
key: ${{ runner.os }}-${{ hashFiles('functions/yarn.lock') }}-${{ hashFiles('.github/workflows/e2e.yml') }}
- name: Install (functions)
if: steps.cached-node_modules-functions.outputs.cache-hit != 'true'
working-directory: functions
run: yarn --frozen-lockfile
- name: Start emulator
working-directory: functions
run: |
yarn serve --project groce-dev > /tmp/emulator-stdout.log 2> /tmp/emulator-stderr.log &
- name: Wait for emulator
run: |
sleep 10
echo "Show emulator home"
curl --retry-connrefused --retry 6 http://localhost:4000
echo "Show emulators"
curl --fail http://localhost:4400
- name: Debug emulator's stdout and stderr if tests failed
if: failure()
run: |
echo "EMULATOR STDOUT........................................."
cat /tmp/emulator-stdout.log
echo ""
echo "EMULATOR STDERR........................................."
cat /tmp/emulator-stderr.log
- name: Build
env:
PUPPETEER_EXECUTABLE_PATH: /usr/bin/google-chrome
# These are NOT secrets. It's public stuff.
PREACT_APP_FIREBASE_APIKEY: AIzaSyBlMzrsBR_KWXDdgntBgnCThjRqr-0I8js
PREACT_APP_FIREBASE_AUTHDOMAIN: groce-dev.firebaseapp.com
PREACT_APP_FIREBASE_DATABASEURL: https://groce-dev.firebaseio.com
PREACT_APP_FIREBASE_PROJECTID: groce-dev
PREACT_APP_FIREBASE_STORAGEBUCKET: groce-dev.appspot.com
PREACT_APP_FIREBASE_MESSAGINGSENDERID: 170241343352
PREACT_APP_FIREBASE_APPID: 1:170241343352:web:5282dd555337af2a62d28d
PREACT_APP_USE_EMULATOR: true
run: |
./bin/build
- name: Serve
run: yarn serve > /tmp/stdout.log 2> /tmp/stderr.log &
- name: Wait for server
run: curl --fail --retry-connrefused --retry 4 http://localhost:8080 > /dev/null
- name: Debug server's stdout and stderr if tests failed
if: failure()
run: |
echo "STDOUT.................................................."
cat /tmp/stdout.log
echo ""
echo "STDERR.................................................."
cat /tmp/stderr.log
- name: Run end-to-end tests
run: yarn e2e
- uses: actions/upload-artifact@v4
if: failure()
with:
name: Test Screenshots
path: test-screenshots/
if-no-files-found: ignore