Mac hosting guide

Safari Extension Permission Model Test Flow

Verify the install, enable and per-site grant by hand with the worksheet, then run a safaridriver check that the content script changed the page. Safari's permission UI is not scriptable, so a person runs the worksheet.

Figment editorial teamPublished Updated Facts checked November 10, 2026

Figment Mac plans

US East. Pay before use. Hourly and daily too.

Intel Mac VM4 shared vCPUs, 4GB RAM, 80GB SSD$25per monthApple Silicon Mac VM4 shared vCPUs, 4GB RAM, 65GB SSD$39per monthDedicated M4 Pro12-core CPU, 24GB RAM, 512GB SSD$199per month

Minimum first purchase: $25 of account credit, used for your rental.

Test a Safari Web Extension with two parts: a manual acceptance worksheet for the install, enable and host-permission grant on a real Mac, and a small safaridriver check that proves the page-side effect once access is granted. Safari's permission UI cannot be reliably scripted, so a person runs the worksheet and CI runs the page check. Both parts need a real Safari on a real Mac. Apple's Creating a Safari web extension guide covers the container app model.

Why is a scripted install and grant hard?

Because Safari's permission model does not match Chrome's install-time grant, and Apple does not support UI tests in Safari. An extension ships inside a macOS or iOS container app, Safari lists it under Settings > Extensions, and the user decides per-site access. A Chrome-style assumption that host_permissions is granted at install will silently fail on Safari.

Apple is explicit on the same page: "XCTest doesn't support unit tests for the JavaScript APIs that Safari web extensions use, or UI tests in Safari." People do drive Safari with XCUIApplication(bundleIdentifier:), but the Settings pane element identifiers change between point releases and are not a public contract, so a committed CI assertion against them breaks on upgrade. Treat that path as exploratory.

What stays supportable is the split above. Apple's Testing with WebDriver in Safari article describes how safaridriver --enable and a standard Selenium client talk to Safari itself (not Playwright's WebKit, which is a separate build).

What do the manifest and container build look like?

A Safari Web Extension is a Manifest V3 extension packaged inside an Xcode-generated container app. These are the manifest fields that drive the test:

{
  "manifest_version": 3,
  "name": "My Test Extension",
  "version": "1.0",
  "permissions": ["activeTab", "scripting"],
  "host_permissions": [
    "http://localhost:3000/*"
  ],
  "action": { "default_title": "My Test Extension" },
  "content_scripts": [{
    "matches": ["http://localhost:3000/*"],
    "js": ["content.js"]
  }]
}

Declaring only localhost keeps the fixture deterministic. The content script should change a known sentinel element so the WebDriver step has something unambiguous to assert on:

// content.js
document.addEventListener('DOMContentLoaded', () => {
  const el = document.getElementById('target');
  if (el) el.dataset.extensionActive = 'yes';
});

Build the macOS container like any Xcode target. Run xcodebuild -list first and substitute the real scheme name, because the scheme Xcode generates depends on the product name you chose in the Safari Extension App template:

xcodebuild -list                             # find the real scheme
xcodebuild -scheme "<YOUR-SCHEME>" \
  -destination 'platform=macOS' \
  -configuration Debug build

Launching the built container app once registers the extension with Safari. From then on, Safari lists it under Settings > Extensions whether or not the container app is still running.

What does the manual acceptance worksheet check?

Seven checkpoints, run after the container app has launched at least once. Record one timestamp per row, and treat a failing row as the documented regression.

#StepExpected resultEvidence to capture
1Open Safari > Settings > Extensions"My Test Extension" appears in the left-hand listScreenshot of the Extensions pane
2Tick the checkbox next to the extensionCheckbox becomes enabled; toolbar icon appearsScreenshot showing enabled state
3Open the per-site permission popup for the extensionOptions include Ask, Deny, Allow for listed sites and Allow on Every WebsiteScreenshot of popup
4Choose Allow on Every Website (or Allow for localhost only)Setting persists after closing SettingsScreenshot of updated selection
5Open http://localhost:3000/testpage.htmlToolbar icon stays enabled; no permission prompt reappearsScreenshot of Safari window
6Inspect #target in Web Inspectordata-extension-active="yes" is setCopy of outer HTML
7Quit and relaunch Safari; revisit the URLEnabled state and host grant survive restartScreenshot

Store screenshots under a run-unique directory. Do not reuse paths like /tmp/test-server.pid across runs or matrix jobs, and note that GITHUB_RUN_ID alone collides across reruns. A safe pattern:

RUN_DIR="$(mktemp -d -t safari-ext-XXXXXX)"
echo "$RUN_DIR" > ./last-run-dir
# ...save screenshots and logs under $RUN_DIR/

How do I automate the page-side check with safaridriver?

Enable the driver once, serve the fixture on a run-unique port, open the page and check that the content script wrote its sentinel attribute. safaridriver has no documented command to install or enable a Safari web extension, so rely on the granted state from the worksheet and do not try to fake one. Do not assume Selenium's Firefox-only install_addon call works with the Safari driver.

# One-time per host
safaridriver --enable

# Serve the fixture on a run-unique port; clean up on real exit
PORT=$(python3 -c 'import socket;s=socket.socket();s.bind(("",0));print(s.getsockname()[1]);s.close()')
SRV_DIR="$(mktemp -d -t safari-ext-srv-XXXXXX)"
cp -R ./test-fixtures/. "$SRV_DIR/"
( cd "$SRV_DIR" && python3 -m http.server "$PORT" ) >"$SRV_DIR/srv.log" 2>&1 &
SRV_PID=$!
trap 'kill "$SRV_PID" 2>/dev/null; rm -rf "$SRV_DIR"' EXIT INT TERM

PORT="$PORT" python3 - <<'PY'
import os, sys
from selenium import webdriver
from selenium.webdriver.common.by import By
port = os.environ["PORT"]
d = webdriver.Safari()
try:
    d.get(f"http://localhost:{port}/testpage.html")
    el = d.find_element(By.ID, "target")
    if el.get_attribute("data-extension-active") != "yes":
        print("extension did not run on target page", file=sys.stderr)
        sys.exit(1)
    print("ok")
finally:
    d.quit()
PY

test-fixtures/testpage.html should carry the sentinel element the extension changes:

<!DOCTYPE html>
<html>
  <head><title>Extension test page</title></head>
  <body><h1 id="target">Test target</h1></body>
</html>

Treat the script as a template. It stops on the first failing assertion, binds to a run-unique port, cleans up its own temp directory on EXIT, INT and TERM, and never touches the host's global keychain or user profile. It is not a benchmark and does not prove the extension is installed. Step 1 of the worksheet does that.

Can I test this in the iOS Simulator?

No. Safari Web Extension testing needs a real Safari on real macOS, and the iOS Simulator does not surface the Settings > Extensions screens this flow exercises.

How do hosted Mac prices compare?

The table lists monthly prices as published. They are not equal hardware: Figment's Apple Silicon VM is a virtual machine with shared vCPUs, while the others list whole Macs.

OptionMonthly12-month cost
Figment Apple Silicon Mac VM (4 shared vCPUs, 4GB, 65GB)$39$468
Figment Dedicated M4 Pro 48 GB (M4 Pro, 48GB, 512GB)$349$3,228 paid up front, or $3,588 on a 12-month term
CloudMac Mac mini M4 (16 GB / 256 GB)$99.99$1,199.88, or $999 on the annual price ($83.25 effective)
MacStadium M2.S$109$1,308
MacStadium M4.S (16 GB / 256 GB)$149$1,788
MacStadium M4.M (24 GB / 512 GB)$249$2,988
Mac Mini Vault M1$84.99$1,019.88
Mac Mini Vault M2$94.99$1,139.88

Arithmetic: 12 × $39 = $468; 12 × $299 = $3,588; 12 × $99.99 = $1,199.88; $999 ÷ 12 = $83.25; 12 × $109 = $1,308; 12 × $149 = $1,788; 12 × $249 = $2,988; 12 × $84.99 = $1,019.88; 12 × $94.99 = $1,139.88. CloudMac's 512 GB and 1 TB storage rows were listed as fully reserved at the time of checking, and its 256 GB row was marked reservable. MacStadium lists support and a published 99.99% uptime target, and its annual terms are available via sales, with no annual dollar figure on the public page. Mac Mini Vault showed both M1 and M2 as Out of Stock, plus M6 and M5 Pro rows with a notify-on-restock button in both regions, so ask about availability before you plan a start date.

Where do you get a real Safari for the permission worksheet?

Any plan with remote desktop gives you a real Safari for the worksheet, and we have not run this flow on any plan. The Intel Mac VM ($25 a month, $2 a day) runs macOS Sequoia with Xcode 26.3 or earlier and the Safari that Sequoia ships, which is enough if your container app and extension support Intel. For arm64-only tooling or Xcode 26.4 or later, use the Apple Silicon Mac VM ($39 a month, $6 a day). A daily plan fits a one-off acceptance run. See the Mac hosting plans and check the macOS version shown before purchase.

Which Figment Mac fits this work?

Intel Mac VM from $25 a month, Apple Silicon Mac VM from $39, or a Dedicated M4 Pro for $199. Hourly and daily plans too. You pay before use, starting with at least $25 of account credit.

Choose a Mac plan