Skip to content

Commit

Permalink
Tests: Backport test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nicjansma committed Oct 1, 2024
1 parent c205948 commit c84282c
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 200 deletions.
2 changes: 1 addition & 1 deletion boomerang.js
Original file line number Diff line number Diff line change
Expand Up @@ -4985,7 +4985,7 @@ BOOMR_check_doc_domain();
// check if there was an activation via NavigationTiming
var p = BOOMR.getPerformance();

if (p) {
if (p && typeof p.getEntriesByType === "function") {
// get the navigation entry
var navEntry = p.getEntriesByType("navigation")[0];

Expand Down
1 change: 1 addition & 0 deletions tests/page-templates/19-navtiming/00-onload.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<%= header %>
<!-- add an image so the screen is painted before Boomerang loads -->
<img src="/assets/img.jpg" />
<img src="/delay?delay=2000&amp;file=/assets/img.jpg&amp;id=2000" style="width:400px;" id="not_lcp" />
<%= boomerangSnippet %>
<script src="00-onload.js" type="text/javascript"></script>
<script>
Expand Down
1 change: 1 addition & 0 deletions tests/page-templates/20-painttiming/07-lcp-spa-soft.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<%= header %>
<!-- add an image so the screen is painted before Boomerang loads -->
<img src="/delay?delay=2000&amp;file=/assets/img.jpg&amp;id=2000" style="width:400px;" id="lcp" />
<img src="/delay?delay=3000&amp;file=/assets/img.jpg&amp;id=3000" style="width:4px;" id="not_lcp" />

<%= boomerangScript %>

Expand Down
16 changes: 8 additions & 8 deletions tests/page-templates/20-painttiming/09-prerendered.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</script>
<%= boomerangScript %>

<img src="/assets/img.jpg" style="width: 100px" id="img_id1" />
<img src="/assets/img.jpg" style="width: 100px" id="img_id1" />

<script src="09-prerendered.js" type="text/javascript"></script>
<script>
Expand Down Expand Up @@ -82,19 +82,19 @@
};
}

// fake LCP event
BOOMR_test.fireMockPerformanceObserverEvent("largest-contentful-paint",
[
generateLCP("img_id1")
]
);

BOOMR_test.init({
testAfterOnBeacon: true,
PaintTiming: {
enabled: true
}
});

// fake LCP event
BOOMR_test.fireMockPerformanceObserverEvent("largest-contentful-paint",
[
generateLCP("img_id1")
]
);
</script>
<script src="/delay?delay=2500&amp;file=/assets/blank.js"></script>
<%= footer %>
4 changes: 2 additions & 2 deletions tests/page-templates/21-continuity/17-tti-hero-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("e2e/21-continuity/17-tti-hero-images", function() {
var st = parseInt(b["rt.tstart"], 10);

assert.isDefined(b["c.tti.vr"]);
assert.closeTo(parseInt(b["c.tti.vr"], 10), vr - st, 20);
assert.closeTo(parseInt(b["c.tti.vr"], 10), vr - st, 50);
}
});

Expand All @@ -45,7 +45,7 @@ describe("e2e/21-continuity/17-tti-hero-images", function() {
var st = parseInt(b["rt.tstart"], 10);

assert.isDefined(b["c.tti.hi"]);
assert.closeTo(parseInt(b["c.tti.hi"], 10), vr - st, 20);
assert.closeTo(parseInt(b["c.tti.hi"], 10), vr - st, 50);
}
});
});
58 changes: 0 additions & 58 deletions tests/page-templates/34-bfcache/03-dimensions.html

This file was deleted.

125 changes: 0 additions & 125 deletions tests/page-templates/34-bfcache/03-dimensions.js

This file was deleted.

12 changes: 6 additions & 6 deletions tests/page-templates/35-spa/01-soft-nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
imgLatest.style = "width: " + imgSize + "px; height: " + imgSize + "px";
window.document.body.appendChild(imgLatest);

imgSize += 50;
imgSize += 100;
});
</script>

Expand All @@ -54,10 +54,6 @@
};
}

BOOMR_test.fireMockPerformanceObserverEvent("largest-contentful-paint", [
getLcpPoEntry(BOOMR.hrNow())
]);

BOOMR_test.init({
testAfterOnBeacon: window.history ? 4 : 1,
History: {
Expand Down Expand Up @@ -126,6 +122,10 @@
}, 3000);
}
});
</script>

BOOMR_test.fireMockPerformanceObserverEvent("largest-contentful-paint", [
getLcpPoEntry(BOOMR.hrNow())
]);
</script>
<script src="/delay?delay=2500&amp;file=/assets/blank.js"></script>
<%= footer %>

0 comments on commit c84282c

Please sign in to comment.