Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
const URL = '/late-url-change';

navigateButton.addEventListener("click", async () => {
content.innerHTML = '<img src="/images/lcp-256x256.png" elementtiming="test-image"></img>';
content.innerHTML = '<img id="target" src="/images/lcp-256x256.png" elementtiming="test-image"></img>';

const entries = await new Promise(resolve => {
new PerformanceObserver((list, observer) => {
Expand All @@ -31,6 +31,8 @@

const softNavPromise =
SoftNavigationTestHelper.getPerformanceEntries("soft-navigation");
const icpPromise =
SoftNavigationTestHelper.getPerformanceEntries("interaction-contentful-paint");

if (test_driver) {
test_driver.click(navigateButton);
Expand All @@ -43,5 +45,10 @@
assert_true(
entries[0].name.endsWith(URL),
'Unexpected Soft Navigation URL.');

const icps = await helper.withTimeoutMessage(
icpPromise, 'ICP not detected.', /*timeout=*/ 3000);
assert_equals(icps.length, 1, 'Expected exactly one ICP entry.');
assert_equals(icps[0].id, 'target', 'Expected ICP candidate to be "target"');
}, 'Soft Navigation Detection supports setting URL after paint');
</script>