From 84b3bf70349171e44f283085f1d89ccd9deed40e Mon Sep 17 00:00:00 2001
From: Thibaud Colas <thibaudcolas@gmail.com>
Date: Mon, 9 Sep 2024 10:20:26 +0100
Subject: [PATCH] Add new Puppeteer cache location to fix CircleCI ui_tests
 (#12293)

---
 .circleci/config.yml | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index d6d9073c98..8a4845a693 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -83,16 +83,19 @@ jobs:
           paths:
             - .venv
       - restore_cache:
-          key: ui_tests-npm_integration-v1-{{ checksum "client/tests/integration/package-lock.json" }}
+          key: ui_tests-npm_integration-v2-{{ checksum "client/tests/integration/package-lock.json" }}
       # Only install if node_modules wasn’t cached.
       - run: |
           if [[ ! -e "client/tests/integration/node_modules" ]]; then
               npm --prefix ./client/tests/integration ci
           fi
       - save_cache:
-          key: ui_tests-npm_integration-v1-{{ checksum "client/tests/integration/package-lock.json" }}
+          key: ui_tests-npm_integration-v2-{{ checksum "client/tests/integration/package-lock.json" }}
           paths:
             - client/tests/integration/node_modules
+            # Also cache the global location where Puppeteer stores browsers.
+            # https://pptr.dev/guides/configuration/#changing-the-default-cache-directory
+            - ~/.cache/puppeteer
       - run: pipenv run ./wagtail/test/manage.py migrate
       - run:
           command: pipenv run ./wagtail/test/manage.py runserver 0:8000