async function verifyNodeRectsAlignWithImage(lhr, rectExpectations) {
      if (!lhr.fullPageScreenshot) throw new Error('no screenshot');

      // First check we recieved all the expected nodes.
      const nodes = Object.values(lhr.fullPageScreenshot.nodes);
      for (const expectation of rectExpectations) {
        const nodeSeen = nodes.find(node => node.id === expectation.id);
        if (!nodeSeen) throw new Error(`did not find node for id ${expectation.id}`);

        const {id, left, top, right, bottom} = nodeSeen;
        expect({id, left, top, right, bottom}).toEqual(expectation);
      }

      // Now check that the image contents line up with what we think the nodes are.

      /** @type {DebugFormat} */
      const debugFormat = process.env.LH_FPS_DEBUG ?? false;
      const results = await analyzeScreenshotNodes(page, lhr, debugFormat);

      // Very helpful for debugging. Set env LH_FPS_DEBUG to one of the valid debug formats.
      if (debugFormat) {
        console.log(lhr.fullPageScreenshot.screenshot.data);
        visualizeDebugData(results, debugFormat);
      }

      const failingIds = results.filter(r => !r.success).map(r => r.id);
      expect(failingIds).toEqual([]);

      expect(results.length).toBeGreaterThan(0);
    }
@param {LH.Result} lhr
@param {Array<id: string, top: number, bottom: number, left: number: right: number>} rectExpectations