Skip to content

Prepare code to remove GA from Web and AMP #44

Prepare code to remove GA from Web and AMP

Prepare code to remove GA from Web and AMP #44

name: Test ad load time
on:
push:
branches:
- main
workflow_dispatch:
pull_request:
jobs:
test:
name: Test time to load top-above-nav
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
# Commercial
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: ./.github/actions/setup-node-env
# We always run our commercial code against the latest main of DCR
# This does make our tests sensitive to changes in DCR
# (e.g. imagine someone removes the top-above-nav slot from DCR)
# This is something we accept in order to easily test our own code
#
# Note we use the containerised version of DCR, published from:
# https://github.com/guardian/dotcom-rendering/blob/6a6df272/.github/workflows/container.yml
#
# The argument `--network host` is crucial here, as it means the container shares the networking stack of the host
# This makes the commercial dev server available from inside the container
# Note that GHA provides a service container feature, but it does not support this argument
- name: Start DCR in a container
run: |
/usr/bin/docker run -d \
--network host \
-p 3030:3030 \
-e "PORT=3030" \
-e "COMMERCIAL_BUNDLE_URL=http://localhost:3031/graun.standalone.commercial.js" \
ghcr.io/guardian/dotcom-rendering:main
- name: Install Playwright Browsers
run: pnpm playwright install --with-deps chromium
- name: Start Commercial server
run: pnpm serve & npx wait-on -v -i 1000 http://localhost:3031/graun.standalone.commercial.js
- name: Run Playwright
run: pnpm playwright test test-ad-load-time.spec.ts
- uses: actions/upload-artifact@v4
if: always()
with:
name: ad-load-time-report
path: ./commercial/playwright-report
retention-days: 5