Test the Store Build, Not Your Folder: Downloading and Diffing a Published Chrome Extension

Our screen recorder extension has a test suite we trust. One command launches a real browser, loads the extension, records a tab, pauses and resumes, adds a camera bubble, crops an area, writes MP4, WebM, WAV and M4A files, opens the draw overlay, checks the layout at six window sizes and watches both the page console and the service worker console for errors. It runs against Chrome for Testing and against Microsoft Edge.
And yet there is a step in our release notes that the suite cannot do: after every release, download the build the store is actually serving, compare it with the folder we meant to ship, and install it from the store in an ordinary browser. This post is about why that step exists, what the automated run genuinely cannot see, and the small amount of tooling it takes to check the published package instead of trusting it.
What the automated run tests, exactly
The runner is a shell script and a Node driver that speaks the DevTools protocol over a WebSocket, with no other dependencies. It starts a browser with a throwaway profile and the extension folder loaded unpacked:
# Scripts/extension-e2e/run.sh (header)
# Scripts/extension-e2e/run.sh chrome # Chrome for Testing (downloaded on first run)
# Scripts/extension-e2e/run.sh edge # Microsoft Edge from /Applications
#
# Google Chrome itself (137+) ignores --load-extension, which is why the
# Chrome run uses Chrome for Testing.
"$BROWSER_BIN" \
--user-data-dir="$OUT/profile" \
--load-extension="$EXT" \
--remote-debugging-port="$PORT" \
--no-first-run --no-default-browser-check --disable-sync --disable-background-networking \
...
Note the comment. Branded Google Chrome no longer honours --load-extension, so the Chrome run uses Chrome for Testing, a separate build meant for automation. Edge still accepts the flag, so the Edge run uses the installed browser.
A few test-only details are encoded in the script because they cost us time to learn. The usual flag that auto-accepts media prompts, --use-fake-ui-for-media-stream, also makes the screen-share picker return the calling tab, which overrides the flag that picks a capture target by title. So the runner leaves it out and grants microphone and camera through the DevTools Browser.grantPermissions command instead. --use-fake-device-for-media-stream supplies a test-pattern camera and a tone microphone.
All of that tests the code in a folder, loaded in a way no user ever loads it. That is exactly right for catching regressions. It is not the same as testing what people install.
Three gaps between the folder and the store

1. The package is assembled by hand
Both stores take a ZIP upload. Ours is built from the folder with a couple of shell lines, and the one rule that matters is that manifest.json has to be at the root of the archive, not inside a folder:
# Bump "version" in extension-chrome/manifest.json first, then:
Scripts/sync-extensions.sh
cd extension-chrome && zip -r ../happy-recorder-chrome.zip . -x '.DS_Store' && cd ..
cd extension-edge && zip -r ../happy-recorder-edge.zip . -x '.DS_Store' && cd ..
# manifest.json must sit at the archive root, not inside a folder:
unzip -l happy-recorder-chrome.zip | grep ' manifest.json$'
Every step there is a place for the shipped package to differ from the tested folder. Forget to bump the version and the store rejects the upload, which is the harmless case. Zip the folder instead of its contents and the store rejects it too. Zip from the wrong directory, or after an edit you meant to keep local, and the store accepts something you never ran the suite against. Nothing in the automated run would notice, because the automated run never sees the ZIP.
2. Two folders that must stay identical
Chrome and Edge get separate store listings, so there are two folders, one per package. Only the Chrome folder is ever edited. The Edge folder is a byte-for-byte mirror produced by a sync script, which also has a check mode:
#!/bin/bash
# Scripts/sync-extensions.sh: keeps extension-edge/ identical to extension-chrome/.
# Scripts/sync-extensions.sh # copy chrome -> edge
# Scripts/sync-extensions.sh --check # exit 1 if the folders differ
if [ "${1:-}" = "--check" ]; then
if diff -rq "$SRC" "$DST" >/dev/null 2>&1; then
echo "extension-edge is in sync with extension-chrome"
else
echo "extension-edge differs from extension-chrome - run Scripts/sync-extensions.sh" >&2
diff -rq "$SRC" "$DST" || true
exit 1
fi
exit 0
fi
rsync -a --delete --exclude '.DS_Store' "$SRC/" "$DST/"
Nothing is browser-specific at build time. The code detects Edge at runtime and swaps wording and internal page URLs (chrome:// becomes edge://), so either folder works in either browser. The split exists purely so each store has its own folder to zip. But a mirror is only a mirror if someone runs the sync, and the Edge ZIP is built from the Edge folder. --check is cheap enough to run before every zip, and the store-build comparison below catches the case where nobody did.
3. The store install is a different extension
An unpacked copy gets an ID derived from its path. A store install gets the store’s ID. Most code does not care, but anything that branches on the ID does. Ours has exactly one such place, the link behind the “Rate it” card, which must point at the listing the user installed from:
// src/lib/browser.js: a store install runs under that store's ID; an unpacked
// copy (development) falls back to the store of the browser it runs in.
const CHROME_STORE_ID = 'egbgiedfabclbnaicfhkcdjcddadapkc';
const EDGE_STORE_ID = 'dfbghliglnmbjnmmjmndbfgegldclmhn';
export function reviewUrl() {
const id = chrome.runtime.id;
if (id === EDGE_STORE_ID) return `https://microsoftedge.microsoft.com/addons/detail/${EDGE_STORE_ID}`;
if (id === CHROME_STORE_ID) return `https://chromewebstore.google.com/detail/${CHROME_STORE_ID}/reviews`;
// ...falls back by browser for unpacked copies
}
In the test run, chrome.runtime.id is neither store ID, so the fallback path is what gets tested. The store branches only ever run on a real store install. If a listing were ever recreated with a new ID, the suite would stay green while every “Rate it” button in the wild sent people to the wrong page, or to nothing.
Downloading what the store serves
Chrome’s own updater fetches extensions from a public endpoint. You can ask it for a listing’s current package directly. Our release notes record the exact URL:
ID=egbgiedfabclbnaicfhkcdjcddadapkc # the Chrome Web Store listing
URL="https://clients2.google.com/service/update2/crx?response=redirect&prodversion=150.0&acceptformat=crx2,crx3&x=id%3D${ID}%26uc"
mkdir -p /tmp/store-check && cd /tmp/store-check
curl -sSL -o store.crx "$URL"
file store.crx # should not be HTML or an empty file
head -c 4 store.crx; echo # CRX files start with the magic bytes Cr24
Two parameters deserve a word. prodversion tells the server which browser version is asking; it should be at least the extension’s minimum_chrome_version (116 for ours), or the server may decline to serve it. acceptformat says which package formats the client understands. Check the result before trusting it: if the ID is wrong or the item is not published yet, you can end up with an error page or an empty file rather than a package.
Turning a CRX into something you can diff
A CRX is a ZIP with a signed header in front. In the current format, CRX3, the file starts with the magic bytes Cr24, then a little-endian version number (3), then the length of a header that holds the signatures, then the header itself, and then an ordinary ZIP archive. Many unzip tools will cope with the extra bytes in front and warn about them, but stripping the header properly takes a dozen lines:
#!/usr/bin/env python3
# crx2zip.py: strip a CRX3 header so the payload can be unzipped.
# CRX3 layout: "Cr24" | uint32 version (3) | uint32 header_size | header | zip
import struct, sys
data = open(sys.argv[1], "rb").read()
if data[:4] != b"Cr24":
sys.exit("not a CRX file")
version, header_size = struct.unpack("<II", data[4:12])
if version != 3:
sys.exit(f"unexpected CRX version {version}")
open(sys.argv[2], "wb").write(data[12 + header_size:])
print(f"wrote {sys.argv[2]} ({len(data) - 12 - header_size} bytes)")
With the payload extracted, the comparison is three questions:
python3 crx2zip.py store.crx store.zip
rm -rf store && mkdir store && unzip -q store.zip -d store
# 1. Which version is the store actually serving?
python3 -c "import json;print(json.load(open('store/manifest.json'))['version'])"
# 2. Everything except store-added metadata should match the release folder.
diff -rq --exclude=_metadata --exclude=.DS_Store \
store ~/HappyRec/extension-chrome
# 3. manifest.json: compare as data, not as text.
python3 - <<'PY'
import json
a = json.load(open("store/manifest.json"))
b = json.load(open("/path/to/extension-chrome/manifest.json"))
for k in sorted(set(a) | set(b)):
if a.get(k) != b.get(k):
print(k, "| store:", a.get(k), "| folder:", b.get(k))
PY
Which version is live? After an upload, a listing goes through review, and for a while the store keeps serving the previous version. Reading the version out of the downloaded manifest tells you whether the release you are about to announce is actually what users get.
Do the files match? Exclude what the store adds itself (expect a _metadata folder carrying the store’s signed hashes) and anything your ZIP command deliberately skipped. Everything else should be identical. A stray file, a missing file, or a JavaScript file that differs by one line means the ZIP was not built from the folder you think it was.
Does the manifest match as data? Compare manifest.json by key rather than as text. Formatting changes are noise; a changed permissions array is not. For an extension whose listing depends on a deliberately small permission set, that comparison is the single most important line in the whole check.
Then install it like a user does
A diff proves the bytes are right. It does not prove the experience is. The last step is to install from the store page into an ordinary browser profile, not a testing build, and work through the checks the automated run cannot reach. Ours are written down so nobody has to remember them:

Each item is on the list for a concrete reason:
- Entire Screen and Window capture need the operating system’s Screen Recording grant, which a scripted browser never asks for. The code path after the picker is the same as for a tab, but the permission prompt and the picker are not.
- A real camera behaves differently from the fake test-pattern device: it takes time to start, it can be busy in another app, and its resolution is not fixed.
- Keyboard shortcuts and the context-menu item cannot be triggered over DevTools. The messages they send are tested; the key presses and the right-click are not.
- Drawing after granting the optional all-sites permission involves a browser permission prompt, which is a real click.
- “Ask where to save”, “Save a copy”, Open and Show in folder all open native dialogs or the file manager, which need a person.
- The recorder window on Windows, because everything was developed on macOS, and fonts, scrollbars and window chrome differ.
That list is also a design document of sorts. Every item on it is something we chose not to fake in automation, because faking it would test the fake.
How honest are the automated numbers?
It is worth recording what the suite reports, misses included. On the last full run noted in our docs, Chrome for Testing 154 passed 53 of 54 checks and Edge 153 passed 51 of 54. The misses were known and explained, not ignored. In both browsers, one check trips over a quirk where Chrome’s audio-only fragmented MP4 writes a short duration in its header even though the full audio is present. In Edge, two more checks read a video element’s width 2.5 seconds after attaching a stream, and Edge reports it later than that; the recordings themselves were correct.
A suite that is allowed to be slightly red, with each red line explained, is more useful than one that has been bent until it is green. It also makes the store check feel proportionate. Automation covers the code thoroughly; the store check covers the packaging and the handful of things automation honestly cannot do.
Doing the same for Edge
The Edge listing gets the same ZIP contents from its own folder. The manual half of the check is identical: install from Edge Add-ons into a normal profile, confirm the version shown on the extensions page, and work through the list. Because the code is the same and the sync check guards the folders, the Chrome package diff covers most of the risk, but the Edge install still deserves its own pass, since it is the only place the Edge store ID branch actually runs.
When the comparison finds something
The point of a check is what you do when it fails, so it is worth deciding in advance. Each of the three questions has a different answer.
The store is serving an older version. Usually this just means review is not finished. Wait, and do not announce the release yet. If the dashboard says the update is published and the update endpoint still serves the old version, give it time before assuming anything is wrong; store distribution is not instant, and installed copies update on the browser’s own schedule rather than the moment you publish. What you should not do is upload again to “nudge” it, because a new upload can restart the review.
Files differ. This is the serious one. It means the package that passed review is not the code that passed your tests. Do not patch around it. Rebuild the ZIP from a clean checkout of the tagged source, run the suite against that exact folder, and upload a new version with a bumped version number. The store will not accept the same version twice, which is a useful guard here: you cannot quietly replace a bad package under the same number.
The manifest differs. Look at which keys. A difference in version you already know about. A difference in permissions, optional_host_permissions, commands or background is a release blocker, because those decide what the install warning says, what the reviewer approved, and how the extension starts. For an extension that deliberately asks for the smallest set of permissions and requests broad site access only as an optional grant, a surprise in that array changes the promise made on the listing.
Why not automate the store check completely?
The download, the header strip, the version read and the diff are all scriptable, and there is no reason not to script them; it takes a minute and removes the temptation to skip it. The install is a different matter. Installing from a store page needs a real browser profile signed into nothing in particular, a click on the store’s Add button, and acceptance of the permission prompt. Browsers make that deliberately hard to drive from automation, for the same reason they refuse to let an extension start a screen recording from a keyboard shortcut: some steps exist precisely to require a person.
We also think the manual pass earns its time in a way that is easy to underrate. Ten minutes using the store build the way a user does, on the machine a user has, can turn up things no assertion was written for: a label that wraps badly at a real window size, a permission prompt worded more alarmingly than expected, a first-run window that opens behind another. Automation is very good at confirming what you already thought to check. A human pass is how you find the next thing to check, and that is worth writing into the suite afterwards.
Keep the evidence
One last habit makes all of this more useful: keep the downloaded package. Store the CRX for each release next to the ZIP you uploaded, with the date and the version. When a user reports something odd weeks later, you can confirm exactly which bytes they were running instead of reasoning from memory about what was probably in that release. Packages are small, and an archive of what actually shipped is the cheapest debugging aid there is.
A release checklist that fits on a card
- Bump
versionin the source folder’s manifest, run the sync, thensync-extensions.sh --check. - Run the end-to-end suite against both browsers. Every red line should be one you can explain.
- Zip the folder contents and confirm
manifest.jsonis at the archive root. - After the store approves the update, download the CRX, strip the header and check the version.
- Diff the payload against the folder, excluding
_metadata; compare the manifest key by key. - Install from each store into a normal profile and work through the manual list.
None of this is elaborate. The point is only that the thing you tested and the thing you shipped are two different artefacts, assembled by different steps, and a release is not finished until you have looked at the second one.
HappyRec is our free screen recorder for Mac and Windows, with a Chrome and Edge extension for recording from the browser. See what it does.



