Commit b91575de authored by Julian Descottes's avatar Julian Descottes
Browse files

Bug 1721743 - [devtools] Wait for ruleview property in...

Bug 1721743 - [devtools] Wait for ruleview property in browser_rules_preview-tooltips-sizes.js r=nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D141106
parent 0c75d617
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ add_task(async function() {
          --test-var-wider-than-image: red;
        }

        div {
        #target {
          color: var(--test-var-wider-than-image);
          background: url(${BASE_64_URL});
        }
@@ -34,14 +34,22 @@ add_task(async function() {
  const { inspector, view } = await openRuleView();
  await selectNode("#target", inspector);

  // Note: See intermittent Bug 1721743.
  // On linux webrender opt, the inspector might open the ruleview before it has
  // been populated with the rules for the div.
  info("Wait until the rule view property is rendered");
  const colorPropertyElement = await waitFor(() =>
    getRuleViewProperty(view, "#target", "color")
  );

  // Retrieve the element for `--test-var` on which the CSS variable tooltip will appear.
  const colorPropertySpan = getRuleViewProperty(view, "div", "color").valueSpan;
  const colorPropertySpan = colorPropertyElement.valueSpan;
  const colorVariableElement = colorPropertySpan.querySelector(
    ".ruleview-variable"
  );

  // Retrieve the element for the background url on which the image preview will appear.
  const backgroundPropertySpan = getRuleViewProperty(view, "div", "background")
  const backgroundPropertySpan = getRuleViewProperty(view, "#target", "background")
    .valueSpan;
  const backgroundUrlElement = backgroundPropertySpan.querySelector(
    ".theme-link"