DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk5 min

Chrome Extension Testing: Three Bugs 187 Tests Missed

Hammad Ghafoor’s account of three bugs in PixelMatch shows how computed styles, fabricated licence state, and browser-reported SVG dimensions can pass tests while user-facing behavior is wrong.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Hammad Ghafoor says he wrote 187 tests across four suites for PixelMatch, a Chrome extension that compares a design mockup with a live page. Yet three user-facing failures escaped them: a visual blend that did not blend, a licence check that failed to revoke stored access, and an SVG that appeared at the wrong size. His account is a useful reminder that a passing assertion proves only what the test actually observed.

Why 187 passing tests did not catch the failures

In his DEV Community article, published October 5, 2026, Ghafoor describes tests that passed while the extension’s behavior was wrong. The issue was not simply the number of tests. Some checks observed a property or a prepared fixture rather than the outcome a user would see after the browser rendered a page, a licence state changed, or a real file was loaded.

As an Amazon Associate I earn from qualifying purchases.

The article’s central testing lesson is to match the check to the failure: inspect rendered pixels for a visual feature, exercise actual state transitions for persisted access, and examine the contents of files when browser-provided dimensions may be misleading. The three examples below are Ghafoor’s account, not an independently reproduced test report.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

1. The blend mode was set, but the page did not blend

What failed

PixelMatch placed an image in a closed shadow root and applied mix-blend-mode: difference. The computed style reported the expected value, so a test asserting that CSS property could pass. But the image appeared as ordinary rendering instead of blending against the page.

Ghafoor attributes the problem to the extension’s positioned host and high z-index: together, they created a stacking context that confined the blend to the host’s backdrop rather than the underlying page. As he put it, “The property was set. It was applied. It just had nothing to blend with.”

What changed—and what to test

The described fix was to avoid properties that trigger a stacking context on the host, put the necessary z-index on the child, and re-pin host properties that page CSS could otherwise override. The regression check samples screenshot pixels: where a red overlay matches red page pixels, the difference composite should be near-black.

This checks the user-visible result rather than the declaration. For a feature whose success is visual, a screenshot or pixel assertion can catch failures that computed-style checks cannot. The harness Ghafoor describes launches real Chrome, drives it through the Chrome DevTools Protocol, loads a deliberately hostile page, and captures screenshots; he says it uses Node’s WebSocket client without npm packages. Read Ghafoor’s DEV Community article for the described harness and implementation details.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. A failed licence check left Pro access stored

What failed

A licence validation failure displayed an error but left isPro: true in storage. The tests had created Pro state directly, skipping the activation and revocation flows where the inconsistency occurred.

What changed—and what to test

Ghafoor’s fix revokes access only when the currently stored key receives a definite invalid response. An inconclusive result—such as a network or configuration problem—should not downgrade the user. Tests should exercise activation, invalidation, and revocation, then inspect persisted storage after each real transition rather than relying on a fixture that starts in the desired state.

This distinction matters because “the check failed” can mean either “the key is invalid” or “the extension could not establish validity.” Treating those outcomes identically can revoke legitimate access during a transient failure; treating neither as a state transition can leave access enabled after definite invalidation.

3. An SVG loaded at an unexpected size

What failed

Ghafoor reports that an SVG containing only a viewBox could expose placeholder naturalWidth and naturalHeight values when loaded as an image. His example, viewBox="0 0 640 400", reportedly produced natural dimensions of 240×150 in Chrome 152. He attributes that result to default object sizing combined with the viewBox aspect ratio. This is the article author’s reported measurement; it has not been independently reproduced here.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What changed—and what to test

Instead of treating an image element’s natural dimensions as the source of truth, the described solution parses the SVG document. It uses explicit width and height only when both are valid positive pixel values; otherwise, it falls back to positive dimensions from the viewBox. Percentages and relative units are not accepted as pixel dimensions.

A useful test therefore loads representative real SVG files and checks the dimensions the extension derives from their contents. It should cover explicit pixel dimensions, viewBox-only files, and values that cannot safely be interpreted as pixel sizes. This tests the input the feature actually receives, not a convenient synthetic object.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose assertions that observe the outcome

What the test observes What it can establish What it can miss
Computed CSS property The browser reports a declared or computed value such as mix-blend-mode: difference. Whether stacking contexts or page CSS prevent the intended visual composite.
Screenshot pixels Whether rendered pixels show the expected visual result in the tested browser and page setup. Behavior in untested pages, browser configurations, or visual conditions.
Fabricated licence state Code behavior from a prearranged state, such as already having Pro access. Whether activation, definite invalidation, and revocation update persisted state correctly.
State after an exercised licence flow Whether the tested transition produces the expected stored access state. Transitions and error classes the test does not exercise, including inconclusive network outcomes.
Image natural dimensions The dimensions the browser reports for that loaded image. Whether those values represent the SVG dimensions the extension needs.
Parsed real-file dimensions Whether the SVG’s supported width, height, or viewBox values yield the intended dimensions. Malformed or unusual files not included in the test set.

How to apply the lesson to a browser extension

  • For visual overlays: run the extension in a real browser and test rendered output, especially where host-page CSS, stacking contexts, or shadow DOM are involved.
  • For persisted permissions or entitlements: exercise the user-facing transition and inspect storage afterward; distinguish a definite invalid result from an inability to validate.
  • For file-derived behavior: use representative real inputs and parse the fields that define the behavior instead of assuming a browser convenience property captures the intended meaning.
  • For hostile environments: test against pages that apply conflicting CSS, because an extension operates in a page it does not control.

These are not arguments against unit tests or computed-style assertions. Those checks remain useful for the behavior they cover. The gap appears when a test treats an intermediate condition—such as a CSS value or a preloaded storage flag—as proof of the final outcome.

Ghafoor reports 187 tests across four suites and three consequential bugs, but the count alone does not measure coverage or reliability. The more actionable question is whether each test observes the result that matters to the user.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.