Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #72: Change the way we load the page for LCP #75

Merged
merged 1 commit into from
May 10, 2024
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
7 changes: 5 additions & 2 deletions src/support/steps/lcp-beacon-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ Given('I visit the following urls in {string}', async function (this: ICustomWor
for (const row of data) {
const url: string = `${WP_BASE_URL}/${row[0]}`;
await this.utils.visitPage(row[0]);
// Wait for 2 seconds before fetching from DB.
await this.page.waitForTimeout(2000);
// Wait the beacon to add an attribute `beacon-complete` to true before fetching from DB.
await this.page.waitForFunction(() => {
const beacon = document.querySelector('[data-name="wpr-lcp-beacon"]');
return beacon && beacon.getAttribute('beacon-completed') === 'true';
});

// Get the LCP/ATF from the DB
sql = `SELECT lcp, viewport FROM ${tablePrefix}wpr_above_the_fold WHERE url LIKE "%${row[0]}%"`;
Expand Down
Loading