[UX Dashboard] Make core web vitals test more reliable (#134401)

* Make core web vitals test more reliable.

* Remove strict numeric comparison from test.

* Fix regex string.

* Remove unneeded explicit timeout value.
This commit is contained in:
Justin Kambic 2022-06-15 12:34:57 -04:00 committed by GitHub
parent d72a08378c
commit 24312e7eda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 10 deletions

View file

@ -88,7 +88,7 @@ async function updateUser({
const hasAllRoles = difference(allRoles, existingUser.roles).length === 0;
if (hasAllRoles) {
console.log(
`Skipping: User "${username}" already has neccesarry roles: "${newUser.roles}"`
`Skipping: User "${username}" already has necessary roles: "${newUser.roles}"`
);
return;
}

View file

@ -42,15 +42,11 @@ journey('Core Web Vitals', async ({ page, params }) => {
expect(await page.$('text=Largest contentful paint'));
expect(await page.$('text=First input delay'));
expect(await page.$('text=Cumulative layout shift'));
const cwvSummary = await page.innerText('text=traffic represented');
expect(
await page.innerText('text=1.93 s', {
strict: true,
timeout: 29000,
})
).toEqual('1.93 s');
expect(await page.innerText('text=5 ms', { strict: true })).toEqual('5 ms');
expect(await page.innerText('text=0.003', { strict: true })).toEqual(
'0.003'
);
// match any three digits followed by string constant
// note this regex is suceptible to accepting values > 100
new RegExp('[0-9]{1,3}% of the traffic represented').test(cwvSummary)
).toBe(true);
});
});