Skip to content

Commit

Permalink
Merge pull request #251 from GoogleChrome/metric-id
Browse files Browse the repository at this point in the history
Update the metric ID prefix for v3
  • Loading branch information
philipwalton authored Jul 27, 2022
2 parents c385f96 + b0b5137 commit 67a92f2
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 62 deletions.
2 changes: 1 addition & 1 deletion src/lib/generateUniqueID.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
* @return {string}
*/
export const generateUniqueID = () => {
return `v2-${Date.now()}-${Math.floor(Math.random() * (9e12 - 1)) + 1e12}`;
return `v3-${Date.now()}-${Math.floor(Math.random() * (9e12 - 1)) + 1e12}`;
};
44 changes: 22 additions & 22 deletions test/e2e/onCLS-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('onCLS()', async function() {

const [cls] = await getBeacons();
assert(cls.value >= 0);
assert(cls.id.match(/^v2-\d+-\d+$/));
assert(cls.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls.name, 'CLS');
assert.strictEqual(cls.value, cls.delta);
assert.strictEqual(cls.rating, 'good');
Expand All @@ -71,7 +71,7 @@ describe('onCLS()', async function() {

const [cls] = await getBeacons();
assert(cls.value >= 0);
assert(cls.id.match(/^v2-\d+-\d+$/));
assert(cls.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls.name, 'CLS');
assert.strictEqual(cls.value, cls.delta);
assert.strictEqual(cls.rating, 'good');
Expand All @@ -94,7 +94,7 @@ describe('onCLS()', async function() {
const [cls1] = await getBeacons();

assert(cls1.value >= 0);
assert(cls1.id.match(/^v2-\d+-\d+$/));
assert(cls1.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls1.name, 'CLS');
assert.strictEqual(cls1.value, cls1.delta);
assert.strictEqual(cls1.rating, 'good');
Expand Down Expand Up @@ -127,7 +127,7 @@ describe('onCLS()', async function() {
assert.strictEqual(cls2.rating, 'poor');
assert.strictEqual(cls2.entries.length, 2);
assert.match(cls2.navigationType, /navigate|reload/);
assert.match(cls2.id, /^v2-\d+-\d+$/);
assert.match(cls2.id, /^v3-\d+-\d+$/);

await browser.pause(1000);
await stubVisibilityChange('visible');
Expand Down Expand Up @@ -160,7 +160,7 @@ describe('onCLS()', async function() {
assert.strictEqual(cls3.rating, 'poor');
assert.strictEqual(cls3.entries.length, 4);
assert.match(cls3.navigationType, /navigate|reload/);
assert.match(cls3.id, /^v2-\d+-\d+$/);
assert.match(cls3.id, /^v3-\d+-\d+$/);

await browser.pause(1000);
await stubVisibilityChange('visible');
Expand Down Expand Up @@ -214,7 +214,7 @@ describe('onCLS()', async function() {
const [cls1, cls2] = await getBeacons();

assert(cls1.value >= 0);
assert(cls1.id.match(/^v2-\d+-\d+$/));
assert(cls1.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls1.name, 'CLS');
assert.strictEqual(cls1.value, cls1.delta);
assert.strictEqual(cls1.rating, 'good');
Expand Down Expand Up @@ -250,7 +250,7 @@ describe('onCLS()', async function() {
const [cls1, cls2] = await getBeacons();

assert(cls1.value >= 0);
assert(cls1.id.match(/^v2-\d+-\d+$/));
assert(cls1.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls1.value, cls1.delta);
assert.strictEqual(cls1.rating, 'good');
assert.strictEqual(cls1.entries.length, 1);
Expand Down Expand Up @@ -290,7 +290,7 @@ describe('onCLS()', async function() {

assert(cls1.value >= 0);
assert(cls1.delta >= 0);
assert(cls1.id.match(/^v2-\d+-\d+$/));
assert(cls1.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls1.name, 'CLS');
assert.strictEqual(cls1.value, cls1.delta);
assert.strictEqual(cls1.rating, 'good');
Expand Down Expand Up @@ -328,7 +328,7 @@ describe('onCLS()', async function() {
const [cls1, cls2] = await getBeacons();

assert(cls1.value > 0);
assert(cls1.id.match(/^v2-\d+-\d+$/));
assert(cls1.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls1.name, 'CLS');
assert.strictEqual(cls1.value, cls1.delta);
assert.strictEqual(cls1.entries.length, 1);
Expand Down Expand Up @@ -377,7 +377,7 @@ describe('onCLS()', async function() {
const [cls1] = await getBeacons();

assert(cls1.value >= 0);
assert(cls1.id.match(/^v2-\d+-\d+$/));
assert(cls1.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls1.delta, cls1.value);
assert.strictEqual(cls1.name, 'CLS');
assert.strictEqual(cls1.value, cls1.delta);
Expand All @@ -394,7 +394,7 @@ describe('onCLS()', async function() {
const [cls2] = await getBeacons();

assert(cls2.value >= 0);
assert(cls2.id.match(/^v2-\d+-\d+$/));
assert(cls2.id.match(/^v3-\d+-\d+$/));
assert(cls2.id !== cls1.id);

assert.strictEqual(cls2.name, 'CLS');
Expand All @@ -412,7 +412,7 @@ describe('onCLS()', async function() {
const [cls3] = await getBeacons();

assert(cls3.value >= 0);
assert(cls3.id.match(/^v2-\d+-\d+$/));
assert(cls3.id.match(/^v3-\d+-\d+$/));
assert(cls3.id !== cls2.id);

assert.strictEqual(cls3.name, 'CLS');
Expand All @@ -431,7 +431,7 @@ describe('onCLS()', async function() {
const [cls1, cls2] = await getBeacons();

assert(cls1.value > 0);
assert(cls1.id.match(/^v2-\d+-\d+$/));
assert(cls1.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls1.name, 'CLS');
assert.strictEqual(cls1.value, cls1.delta);
assert.strictEqual(cls1.entries.length, 1);
Expand All @@ -457,7 +457,7 @@ describe('onCLS()', async function() {
const [cls3] = await getBeacons();

assert(cls3.value > 0);
assert(cls3.id.match(/^v2-\d+-\d+$/));
assert(cls3.id.match(/^v3-\d+-\d+$/));
assert(cls3.id !== cls2.id);
assert.strictEqual(cls3.name, 'CLS');
assert.strictEqual(cls3.value, cls3.delta);
Expand All @@ -478,7 +478,7 @@ describe('onCLS()', async function() {
await beaconCountIs(1);

const [cls] = await getBeacons();
assert(cls.id.match(/^v2-\d+-\d+$/));
assert(cls.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls.name, 'CLS');
assert.strictEqual(cls.value, 0);
assert.strictEqual(cls.delta, 0);
Expand All @@ -499,7 +499,7 @@ describe('onCLS()', async function() {
await beaconCountIs(1);

const [cls] = await getBeacons();
assert(cls.id.match(/^v2-\d+-\d+$/));
assert(cls.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls.name, 'CLS');
assert.strictEqual(cls.value, 0);
assert.strictEqual(cls.delta, 0);
Expand All @@ -520,7 +520,7 @@ describe('onCLS()', async function() {
await beaconCountIs(1);

const [cls] = await getBeacons();
assert(cls.id.match(/^v2-\d+-\d+$/));
assert(cls.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls.name, 'CLS');
assert.strictEqual(cls.value, 0);
assert.strictEqual(cls.delta, 0);
Expand All @@ -541,7 +541,7 @@ describe('onCLS()', async function() {
await beaconCountIs(1);

const [cls] = await getBeacons();
assert(cls.id.match(/^v2-\d+-\d+$/));
assert(cls.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls.name, 'CLS');
assert.strictEqual(cls.value, 0);
assert.strictEqual(cls.delta, 0);
Expand Down Expand Up @@ -580,7 +580,7 @@ describe('onCLS()', async function() {
const [cls] = await getBeacons();

assert(cls.value >= 0);
assert(cls.id.match(/^v2-\d+-\d+$/));
assert(cls.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls.name, 'CLS');
assert.strictEqual(cls.delta, cls.value);
assert.strictEqual(cls.rating, 'good');
Expand All @@ -602,7 +602,7 @@ describe('onCLS()', async function() {

const [cls] = await getBeacons();
assert(cls.value >= 0);
assert(cls.id.match(/^v2-\d+-\d+$/));
assert(cls.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls.name, 'CLS');
assert.strictEqual(cls.value, cls.delta);
assert.strictEqual(cls.rating, 'good');
Expand Down Expand Up @@ -640,7 +640,7 @@ describe('onCLS()', async function() {
const [cls] = await getBeacons();

assert(cls.value >= 0);
assert(cls.id.match(/^v2-\d+-\d+$/));
assert(cls.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls.name, 'CLS');
assert.strictEqual(cls.value, cls.delta);
assert.strictEqual(cls.rating, 'good');
Expand Down Expand Up @@ -677,7 +677,7 @@ describe('onCLS()', async function() {
const [cls] = await getBeacons();

assert(cls.value >= 0);
assert(cls.id.match(/^v2-\d+-\d+$/));
assert(cls.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(cls.name, 'CLS');
assert.strictEqual(cls.value, cls.delta);
assert.strictEqual(cls.rating, 'good');
Expand Down
22 changes: 11 additions & 11 deletions test/e2e/onFCP-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('onFCP()', async function() {

const [fcp] = await getBeacons();
assert(fcp.value >= 0);
assert(fcp.id.match(/^v2-\d+-\d+$/));
assert(fcp.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(fcp.name, 'FCP');
assert.strictEqual(fcp.value, fcp.delta);
assert.strictEqual(fcp.rating, 'good');
Expand All @@ -66,7 +66,7 @@ describe('onFCP()', async function() {
});

assert(fcp.value >= 0);
assert(fcp.id.match(/^v2-\d+-\d+$/));
assert(fcp.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(fcp.name, 'FCP');
assert.strictEqual(fcp.value, fcp.delta);
assert.strictEqual(fcp.rating, 'good');
Expand Down Expand Up @@ -137,7 +137,7 @@ describe('onFCP()', async function() {

const [fcp] = await getBeacons();
assert(fcp.value >= 0);
assert(fcp.id.match(/^v2-\d+-\d+$/));
assert(fcp.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(fcp.name, 'FCP');
assert.strictEqual(fcp.value, fcp.delta);
assert.strictEqual(fcp.rating, 'needs-improvement');
Expand All @@ -154,7 +154,7 @@ describe('onFCP()', async function() {

const [fcp1] = await getBeacons();
assert(fcp1.value >= 0);
assert(fcp1.id.match(/^v2-\d+-\d+$/));
assert(fcp1.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(fcp1.name, 'FCP');
assert.strictEqual(fcp1.value, fcp1.delta);
assert.strictEqual(fcp1.rating, 'good');
Expand All @@ -168,7 +168,7 @@ describe('onFCP()', async function() {

const [fcp2] = await getBeacons();
assert(fcp2.value >= 0);
assert(fcp2.id.match(/^v2-\d+-\d+$/));
assert(fcp2.id.match(/^v3-\d+-\d+$/));
assert(fcp2.id !== fcp1.id);
assert.strictEqual(fcp2.name, 'FCP');
assert.strictEqual(fcp2.value, fcp2.delta);
Expand All @@ -183,7 +183,7 @@ describe('onFCP()', async function() {

const [fcp3] = await getBeacons();
assert(fcp3.value >= 0);
assert(fcp3.id.match(/^v2-\d+-\d+$/));
assert(fcp3.id.match(/^v3-\d+-\d+$/));
assert(fcp3.id !== fcp2.id);
assert.strictEqual(fcp3.name, 'FCP');
assert.strictEqual(fcp3.value, fcp3.delta);
Expand Down Expand Up @@ -212,7 +212,7 @@ describe('onFCP()', async function() {

const [fcp1] = await getBeacons();
assert(fcp1.value >= 0);
assert(fcp1.id.match(/^v2-\d+-\d+$/));
assert(fcp1.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(fcp1.name, 'FCP');
assert.strictEqual(fcp1.value, fcp1.delta);
assert.strictEqual(fcp1.rating, 'good');
Expand All @@ -226,7 +226,7 @@ describe('onFCP()', async function() {

const [fcp2] = await getBeacons();
assert(fcp2.value >= 0);
assert(fcp2.id.match(/^v2-\d+-\d+$/));
assert(fcp2.id.match(/^v3-\d+-\d+$/));
assert(fcp2.id !== fcp1.id);
assert.strictEqual(fcp2.name, 'FCP');
assert.strictEqual(fcp2.value, fcp2.delta);
Expand Down Expand Up @@ -255,7 +255,7 @@ describe('onFCP()', async function() {
const [fcp] = await getBeacons();

assert(fcp.value >= 0);
assert(fcp.id.match(/^v2-\d+-\d+$/));
assert(fcp.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(fcp.name, 'FCP');
assert.strictEqual(fcp.value, fcp.delta);
assert.strictEqual(fcp.rating, 'good');
Expand Down Expand Up @@ -302,7 +302,7 @@ describe('onFCP()', async function() {

const [fcp] = await getBeacons();
assert(fcp.value >= 0);
assert(fcp.id.match(/^v2-\d+-\d+$/));
assert(fcp.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(fcp.name, 'FCP');
assert.strictEqual(fcp.value, fcp.delta);
assert.strictEqual(fcp.rating, 'good');
Expand Down Expand Up @@ -341,7 +341,7 @@ describe('onFCP()', async function() {

const [fcp] = await getBeacons();
assert(fcp.value >= 0);
assert(fcp.id.match(/^v2-\d+-\d+$/));
assert(fcp.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(fcp.name, 'FCP');
assert.strictEqual(fcp.value, fcp.delta);
assert.strictEqual(fcp.rating, 'good');
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/onFID-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('onFID()', async function() {

const [fid] = await getBeacons();
assert(fid.value >= 0);
assert(fid.id.match(/^v2-\d+-\d+$/));
assert(fid.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(fid.name, 'FID');
assert.strictEqual(fid.value, fid.delta);
assert.strictEqual(fid.rating, 'good');
Expand Down Expand Up @@ -100,7 +100,7 @@ describe('onFID()', async function() {
const [fid] = await getBeacons();

assert(fid.value >= 0);
assert(fid.id.match(/^v2-\d+-\d+$/));
assert(fid.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(fid.name, 'FID');
assert.strictEqual(fid.value, fid.delta);
assert.strictEqual(fid.rating, 'good');
Expand Down Expand Up @@ -168,7 +168,7 @@ describe('onFID()', async function() {

const [fid1] = await getBeacons();
assert(fid1.value >= 0);
assert(fid1.id.match(/^v2-\d+-\d+$/));
assert(fid1.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(fid1.name, 'FID');
assert.strictEqual(fid1.value, fid1.delta);
assert.strictEqual(fid1.rating, 'good');
Expand All @@ -185,7 +185,7 @@ describe('onFID()', async function() {

const [fid2] = await getBeacons();
assert(fid2.value >= 0);
assert(fid2.id.match(/^v2-\d+-\d+$/));
assert(fid2.id.match(/^v3-\d+-\d+$/));
assert(fid1.id !== fid2.id);
assert.strictEqual(fid2.name, 'FID');
assert.strictEqual(fid2.rating, 'good');
Expand All @@ -208,7 +208,7 @@ describe('onFID()', async function() {

const [fid] = await getBeacons();
assert(fid.value >= 0);
assert(fid.id.match(/^v2-\d+-\d+$/));
assert(fid.id.match(/^v3-\d+-\d+$/));
assert.strictEqual(fid.name, 'FID');
assert.strictEqual(fid.value, fid.delta);
assert.strictEqual(fid.rating, 'good');
Expand Down
Loading

0 comments on commit 67a92f2

Please sign in to comment.