From a21cc3986d499e6e7f749f9f6ec2dedae99ad812 Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Mon, 29 Apr 2024 13:17:06 +0530 Subject: [PATCH 01/16] allowed to test web vital --- protractor.saucelabs.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protractor.saucelabs.config.js b/protractor.saucelabs.config.js index aa538fae1..405dff585 100644 --- a/protractor.saucelabs.config.js +++ b/protractor.saucelabs.config.js @@ -3,7 +3,7 @@ exports.config = { specs: ['test/e2e/**/*.spec.js'], // TODO: disable webvital tests for saucelab for now, since browsers in saucelab seems never return webvital metrics - exclude: ['test/e2e/12_webvitalsAsCustomEvent/*.spec.js'], + // exclude: ['test/e2e/12_webvitalsAsCustomEvent/*.spec.js'], sauceUser: process.env.SAUCE_USERNAME, sauceKey: process.env.SAUCE_ACCESS_KEY, sauceBuild: process.env.GITHUB_RUN_NUMBER, From 19eec81bb3ae71d1e532ff57ae288a67273c7e4b Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Mon, 29 Apr 2024 15:20:08 +0530 Subject: [PATCH 02/16] Testing for only CLS values --- lib/webVitals.js | 32 ++++++------ protractor.saucelabs.config.js | 2 +- .../webvitalsAsCustomEvent.spec.js | 50 +++++++++---------- 3 files changed, 43 insertions(+), 41 deletions(-) diff --git a/lib/webVitals.js b/lib/webVitals.js index 0b0e6a748..92e064ce7 100644 --- a/lib/webVitals.js +++ b/lib/webVitals.js @@ -1,14 +1,16 @@ // @flow // $FlowFixMe Flow doesn't find the file. Let's ignore this for now. -import {onCLS, onLCP, onFID, onINP} from 'web-vitals'; +// import {onCLS, onLCP, onFID, onINP} from 'web-vitals'; +import {onCLS} from 'web-vitals'; import type {PageLoadBeacon} from './types'; import {pageLoadStartTimestamp} from './timings'; import {reportCustomEvent} from './customEvents'; import vars from './vars'; interface Metric { - name: 'CLS' | 'FID' | 'LCP'; + // name: 'CLS' | 'FID' | 'LCP'; + name: 'CLS'; value: number; id?: string; @@ -31,23 +33,23 @@ function reportExtraMetrics(metric: Metric) { } export function addWebVitals(beacon: PageLoadBeacon) { - if (onLCP) { - onLCP(onMetric, true); - } - if (onFID) { - onFID(onMetric, true); - } - if (onINP) { - onINP(onMetric, true); - } + // if (onLCP) { + // onLCP(onMetric, true); + // } + // if (onFID) { + // onFID(onMetric, true); + // } + // if (onINP) { + // onINP(onMetric, true); + // } if (onCLS) { onCLS(onMetricWithoutRounding, true); } - function onMetric(metric: Metric) { - beacon['t_' + metric.name.toLocaleLowerCase()] = Math.round(metric.value); - reportExtraMetrics(metric); - } + // function onMetric(metric: Metric) { + // beacon['t_' + metric.name.toLocaleLowerCase()] = Math.round(metric.value); + // reportExtraMetrics(metric); + // } function onMetricWithoutRounding(metric: Metric) { beacon['t_' + metric.name.toLocaleLowerCase()] = metric.value; diff --git a/protractor.saucelabs.config.js b/protractor.saucelabs.config.js index 405dff585..9b127c555 100644 --- a/protractor.saucelabs.config.js +++ b/protractor.saucelabs.config.js @@ -34,7 +34,7 @@ function newSaucelabsCapability(browserName, version, platform) { browserName, version, platform, - name: 'weasel e2e', + name: 'Testing for only CLS values', 'tunnel-identifier': 'github-action-tunnel', build: process.env.GITHUB_RUN_NUMBER }; diff --git a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js index 4afb34d8a..127fd3dd2 100644 --- a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js +++ b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js @@ -38,24 +38,24 @@ describe('12_webvitalsAsCustomEvent', () => { cexpect(beacon.ty).to.equal('pl'); }); - expectOneMatching(beacons, beacon => { - cexpect(beacon.ty).to.equal('cus'); - cexpect(beacon.ts).to.be.a('string'); - cexpect(parseFloat(beacon.d)).to.be.above(3000); - cexpect(beacon.n).to.equal('instana-webvitals-LCP'); - cexpect(beacon.l).to.be.a('string'); - cexpect(beacon.pl).to.equal(pageLoadBeacon.t); - cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); - }); + // expectOneMatching(beacons, beacon => { + // cexpect(beacon.ty).to.equal('cus'); + // cexpect(beacon.ts).to.be.a('string'); + // cexpect(parseFloat(beacon.d)).to.be.above(3000); + // cexpect(beacon.n).to.equal('instana-webvitals-LCP'); + // cexpect(beacon.l).to.be.a('string'); + // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); + // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); + // }); - expectOneMatching(beacons, beacon => { - cexpect(beacon.ty).to.equal('cus'); - cexpect(beacon.ts).to.be.a('string'); - cexpect(beacon.n).to.equal('instana-webvitals-FID'); - cexpect(beacon.l).to.be.a('string'); - cexpect(beacon.pl).to.equal(pageLoadBeacon.t); - cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); - }); + // expectOneMatching(beacons, beacon => { + // cexpect(beacon.ty).to.equal('cus'); + // cexpect(beacon.ts).to.be.a('string'); + // cexpect(beacon.n).to.equal('instana-webvitals-FID'); + // cexpect(beacon.l).to.be.a('string'); + // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); + // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); + // }); expectOneMatching(beacons, beacon => { cexpect(beacon.ty).to.equal('cus'); @@ -66,14 +66,14 @@ describe('12_webvitalsAsCustomEvent', () => { cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); }); - expectOneMatching(beacons, beacon => { - cexpect(beacon.ty).to.equal('cus'); - cexpect(beacon.ts).to.be.a('string'); - cexpect(beacon.n).to.equal('instana-webvitals-INP'); - cexpect(beacon.l).to.be.a('string'); - cexpect(beacon.pl).to.equal(pageLoadBeacon.t); - cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); - }); + // expectOneMatching(beacons, beacon => { + // cexpect(beacon.ty).to.equal('cus'); + // cexpect(beacon.ts).to.be.a('string'); + // cexpect(beacon.n).to.equal('instana-webvitals-INP'); + // cexpect(beacon.l).to.be.a('string'); + // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); + // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); + // }); }); }); }); From 0eb24a83e32914af1c1c1b4dc1de2c6c001ecda7 Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Mon, 29 Apr 2024 15:29:33 +0530 Subject: [PATCH 03/16] c --- lib/webVitals.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/webVitals.js b/lib/webVitals.js index 92e064ce7..c15ac0093 100644 --- a/lib/webVitals.js +++ b/lib/webVitals.js @@ -1,7 +1,6 @@ // @flow // $FlowFixMe Flow doesn't find the file. Let's ignore this for now. -// import {onCLS, onLCP, onFID, onINP} from 'web-vitals'; import {onCLS} from 'web-vitals'; import type {PageLoadBeacon} from './types'; import {pageLoadStartTimestamp} from './timings'; @@ -9,8 +8,8 @@ import {reportCustomEvent} from './customEvents'; import vars from './vars'; interface Metric { - // name: 'CLS' | 'FID' | 'LCP'; - name: 'CLS'; + name: 'CLS' | 'FID' | 'LCP'; + // name: 'CLS'; value: number; id?: string; From f50ba07d790297a8aa58ddf21ee2159260d0ea4e Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Tue, 30 Apr 2024 10:17:09 +0530 Subject: [PATCH 04/16] Testing for LCP values --- lib/webVitals.js | 28 +++++++++---------- protractor.saucelabs.config.js | 2 +- .../webvitalsAsCustomEvent.spec.js | 24 ++++++++-------- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/lib/webVitals.js b/lib/webVitals.js index c15ac0093..5567eef28 100644 --- a/lib/webVitals.js +++ b/lib/webVitals.js @@ -1,7 +1,7 @@ // @flow // $FlowFixMe Flow doesn't find the file. Let's ignore this for now. -import {onCLS} from 'web-vitals'; +import {onLCP} from 'web-vitals'; import type {PageLoadBeacon} from './types'; import {pageLoadStartTimestamp} from './timings'; import {reportCustomEvent} from './customEvents'; @@ -9,8 +9,6 @@ import vars from './vars'; interface Metric { name: 'CLS' | 'FID' | 'LCP'; - // name: 'CLS'; - value: number; id?: string; } @@ -32,26 +30,26 @@ function reportExtraMetrics(metric: Metric) { } export function addWebVitals(beacon: PageLoadBeacon) { - // if (onLCP) { - // onLCP(onMetric, true); - // } + if (onLCP) { + onLCP(onMetric, true); + } // if (onFID) { // onFID(onMetric, true); // } // if (onINP) { // onINP(onMetric, true); // } - if (onCLS) { - onCLS(onMetricWithoutRounding, true); - } - - // function onMetric(metric: Metric) { - // beacon['t_' + metric.name.toLocaleLowerCase()] = Math.round(metric.value); - // reportExtraMetrics(metric); + // if (onCLS) { + // onCLS(onMetricWithoutRounding, true); // } - function onMetricWithoutRounding(metric: Metric) { - beacon['t_' + metric.name.toLocaleLowerCase()] = metric.value; + function onMetric(metric: Metric) { + beacon['t_' + metric.name.toLocaleLowerCase()] = Math.round(metric.value); reportExtraMetrics(metric); } + + // function onMetricWithoutRounding(metric: Metric) { + // beacon['t_' + metric.name.toLocaleLowerCase()] = metric.value; + // reportExtraMetrics(metric); + // } } diff --git a/protractor.saucelabs.config.js b/protractor.saucelabs.config.js index 9b127c555..890343546 100644 --- a/protractor.saucelabs.config.js +++ b/protractor.saucelabs.config.js @@ -34,7 +34,7 @@ function newSaucelabsCapability(browserName, version, platform) { browserName, version, platform, - name: 'Testing for only CLS values', + name: 'Testing for only LCP values', 'tunnel-identifier': 'github-action-tunnel', build: process.env.GITHUB_RUN_NUMBER }; diff --git a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js index 127fd3dd2..7fed8c2ce 100644 --- a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js +++ b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js @@ -38,11 +38,20 @@ describe('12_webvitalsAsCustomEvent', () => { cexpect(beacon.ty).to.equal('pl'); }); + expectOneMatching(beacons, beacon => { + cexpect(beacon.ty).to.equal('cus'); + cexpect(beacon.ts).to.be.a('string'); + cexpect(parseFloat(beacon.d)).to.be.above(3000); + cexpect(beacon.n).to.equal('instana-webvitals-LCP'); + cexpect(beacon.l).to.be.a('string'); + cexpect(beacon.pl).to.equal(pageLoadBeacon.t); + cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); + }); + // expectOneMatching(beacons, beacon => { // cexpect(beacon.ty).to.equal('cus'); // cexpect(beacon.ts).to.be.a('string'); - // cexpect(parseFloat(beacon.d)).to.be.above(3000); - // cexpect(beacon.n).to.equal('instana-webvitals-LCP'); + // cexpect(beacon.n).to.equal('instana-webvitals-FID'); // cexpect(beacon.l).to.be.a('string'); // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); @@ -51,21 +60,12 @@ describe('12_webvitalsAsCustomEvent', () => { // expectOneMatching(beacons, beacon => { // cexpect(beacon.ty).to.equal('cus'); // cexpect(beacon.ts).to.be.a('string'); - // cexpect(beacon.n).to.equal('instana-webvitals-FID'); + // cexpect(beacon.n).to.equal('instana-webvitals-CLS'); // cexpect(beacon.l).to.be.a('string'); // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); // }); - expectOneMatching(beacons, beacon => { - cexpect(beacon.ty).to.equal('cus'); - cexpect(beacon.ts).to.be.a('string'); - cexpect(beacon.n).to.equal('instana-webvitals-CLS'); - cexpect(beacon.l).to.be.a('string'); - cexpect(beacon.pl).to.equal(pageLoadBeacon.t); - cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); - }); - // expectOneMatching(beacons, beacon => { // cexpect(beacon.ty).to.equal('cus'); // cexpect(beacon.ts).to.be.a('string'); From dd66a4c3fb405719faf6825f91190110df5c4b6a Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Tue, 30 Apr 2024 10:57:35 +0530 Subject: [PATCH 05/16] Testing for only FID values --- lib/webVitals.js | 14 ++++++------ protractor.saucelabs.config.js | 2 +- .../webvitalsAsCustomEvent.spec.js | 22 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/webVitals.js b/lib/webVitals.js index 5567eef28..a906dc274 100644 --- a/lib/webVitals.js +++ b/lib/webVitals.js @@ -1,14 +1,14 @@ // @flow // $FlowFixMe Flow doesn't find the file. Let's ignore this for now. -import {onLCP} from 'web-vitals'; +import {onFID} from 'web-vitals'; import type {PageLoadBeacon} from './types'; import {pageLoadStartTimestamp} from './timings'; import {reportCustomEvent} from './customEvents'; import vars from './vars'; interface Metric { - name: 'CLS' | 'FID' | 'LCP'; + name: 'FID'; value: number; id?: string; } @@ -30,12 +30,12 @@ function reportExtraMetrics(metric: Metric) { } export function addWebVitals(beacon: PageLoadBeacon) { - if (onLCP) { - onLCP(onMetric, true); - } - // if (onFID) { - // onFID(onMetric, true); + // if (onLCP) { + // onLCP(onMetric, true); // } + if (onFID) { + onFID(onMetric, true); + } // if (onINP) { // onINP(onMetric, true); // } diff --git a/protractor.saucelabs.config.js b/protractor.saucelabs.config.js index 890343546..4fb2e9114 100644 --- a/protractor.saucelabs.config.js +++ b/protractor.saucelabs.config.js @@ -34,7 +34,7 @@ function newSaucelabsCapability(browserName, version, platform) { browserName, version, platform, - name: 'Testing for only LCP values', + name: 'Testing for only FID values', 'tunnel-identifier': 'github-action-tunnel', build: process.env.GITHUB_RUN_NUMBER }; diff --git a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js index 7fed8c2ce..b8f6ebfd4 100644 --- a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js +++ b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js @@ -38,25 +38,25 @@ describe('12_webvitalsAsCustomEvent', () => { cexpect(beacon.ty).to.equal('pl'); }); - expectOneMatching(beacons, beacon => { - cexpect(beacon.ty).to.equal('cus'); - cexpect(beacon.ts).to.be.a('string'); - cexpect(parseFloat(beacon.d)).to.be.above(3000); - cexpect(beacon.n).to.equal('instana-webvitals-LCP'); - cexpect(beacon.l).to.be.a('string'); - cexpect(beacon.pl).to.equal(pageLoadBeacon.t); - cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); - }); - // expectOneMatching(beacons, beacon => { // cexpect(beacon.ty).to.equal('cus'); // cexpect(beacon.ts).to.be.a('string'); - // cexpect(beacon.n).to.equal('instana-webvitals-FID'); + // cexpect(parseFloat(beacon.d)).to.be.above(3000); + // cexpect(beacon.n).to.equal('instana-webvitals-LCP'); // cexpect(beacon.l).to.be.a('string'); // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); // }); + expectOneMatching(beacons, beacon => { + cexpect(beacon.ty).to.equal('cus'); + cexpect(beacon.ts).to.be.a('string'); + cexpect(beacon.n).to.equal('instana-webvitals-FID'); + cexpect(beacon.l).to.be.a('string'); + cexpect(beacon.pl).to.equal(pageLoadBeacon.t); + cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); + }); + // expectOneMatching(beacons, beacon => { // cexpect(beacon.ty).to.equal('cus'); // cexpect(beacon.ts).to.be.a('string'); From 6626a7d7954a92cedffcba1248ee9f4edaae1dd0 Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Tue, 30 Apr 2024 12:13:43 +0530 Subject: [PATCH 06/16] Testing for only INP values --- lib/webVitals.js | 14 ++++++------ protractor.saucelabs.config.js | 2 +- .../webvitalsAsCustomEvent.spec.js | 22 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/webVitals.js b/lib/webVitals.js index a906dc274..9bbf5f15d 100644 --- a/lib/webVitals.js +++ b/lib/webVitals.js @@ -1,14 +1,14 @@ // @flow // $FlowFixMe Flow doesn't find the file. Let's ignore this for now. -import {onFID} from 'web-vitals'; +import {onINP} from 'web-vitals'; import type {PageLoadBeacon} from './types'; import {pageLoadStartTimestamp} from './timings'; import {reportCustomEvent} from './customEvents'; import vars from './vars'; interface Metric { - name: 'FID'; + name: 'INP'; value: number; id?: string; } @@ -33,12 +33,12 @@ export function addWebVitals(beacon: PageLoadBeacon) { // if (onLCP) { // onLCP(onMetric, true); // } - if (onFID) { - onFID(onMetric, true); - } - // if (onINP) { - // onINP(onMetric, true); + // if (onFID) { + // onFID(onMetric, true); // } + if (onINP) { + onINP(onMetric, true); + } // if (onCLS) { // onCLS(onMetricWithoutRounding, true); // } diff --git a/protractor.saucelabs.config.js b/protractor.saucelabs.config.js index 4fb2e9114..8cec259da 100644 --- a/protractor.saucelabs.config.js +++ b/protractor.saucelabs.config.js @@ -34,7 +34,7 @@ function newSaucelabsCapability(browserName, version, platform) { browserName, version, platform, - name: 'Testing for only FID values', + name: 'Testing for only INP values', 'tunnel-identifier': 'github-action-tunnel', build: process.env.GITHUB_RUN_NUMBER }; diff --git a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js index b8f6ebfd4..8968cada7 100644 --- a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js +++ b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js @@ -48,19 +48,10 @@ describe('12_webvitalsAsCustomEvent', () => { // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); // }); - expectOneMatching(beacons, beacon => { - cexpect(beacon.ty).to.equal('cus'); - cexpect(beacon.ts).to.be.a('string'); - cexpect(beacon.n).to.equal('instana-webvitals-FID'); - cexpect(beacon.l).to.be.a('string'); - cexpect(beacon.pl).to.equal(pageLoadBeacon.t); - cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); - }); - // expectOneMatching(beacons, beacon => { // cexpect(beacon.ty).to.equal('cus'); // cexpect(beacon.ts).to.be.a('string'); - // cexpect(beacon.n).to.equal('instana-webvitals-CLS'); + // cexpect(beacon.n).to.equal('instana-webvitals-FID'); // cexpect(beacon.l).to.be.a('string'); // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); @@ -69,11 +60,20 @@ describe('12_webvitalsAsCustomEvent', () => { // expectOneMatching(beacons, beacon => { // cexpect(beacon.ty).to.equal('cus'); // cexpect(beacon.ts).to.be.a('string'); - // cexpect(beacon.n).to.equal('instana-webvitals-INP'); + // cexpect(beacon.n).to.equal('instana-webvitals-CLS'); // cexpect(beacon.l).to.be.a('string'); // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); // }); + + expectOneMatching(beacons, beacon => { + cexpect(beacon.ty).to.equal('cus'); + cexpect(beacon.ts).to.be.a('string'); + cexpect(beacon.n).to.equal('instana-webvitals-INP'); + cexpect(beacon.l).to.be.a('string'); + cexpect(beacon.pl).to.equal(pageLoadBeacon.t); + cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); + }); }); }); }); From c101417a76b6f65d61c31ba2409d7dfd8fe4c626 Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Tue, 30 Apr 2024 17:58:16 +0530 Subject: [PATCH 07/16] Testing for only CLS values in chrome 124 --- lib/webVitals.js | 27 ++++++++++--------- protractor.saucelabs.config.js | 18 +++++-------- .../webvitalsAsCustomEvent.spec.js | 20 +++++++------- 3 files changed, 30 insertions(+), 35 deletions(-) diff --git a/lib/webVitals.js b/lib/webVitals.js index 9bbf5f15d..29a6133e4 100644 --- a/lib/webVitals.js +++ b/lib/webVitals.js @@ -1,14 +1,15 @@ // @flow // $FlowFixMe Flow doesn't find the file. Let's ignore this for now. -import {onINP} from 'web-vitals'; +import {onCLS} from 'web-vitals'; import type {PageLoadBeacon} from './types'; import {pageLoadStartTimestamp} from './timings'; import {reportCustomEvent} from './customEvents'; import vars from './vars'; interface Metric { - name: 'INP'; + name: 'CLS'; + value: number; id?: string; } @@ -36,20 +37,20 @@ export function addWebVitals(beacon: PageLoadBeacon) { // if (onFID) { // onFID(onMetric, true); // } - if (onINP) { - onINP(onMetric, true); - } - // if (onCLS) { - // onCLS(onMetricWithoutRounding, true); + // if (onINP) { + // onINP(onMetric, true); // } - - function onMetric(metric: Metric) { - beacon['t_' + metric.name.toLocaleLowerCase()] = Math.round(metric.value); - reportExtraMetrics(metric); + if (onCLS) { + onCLS(onMetricWithoutRounding, true); } - // function onMetricWithoutRounding(metric: Metric) { - // beacon['t_' + metric.name.toLocaleLowerCase()] = metric.value; + // function onMetric(metric: Metric) { + // beacon['t_' + metric.name.toLocaleLowerCase()] = Math.round(metric.value); // reportExtraMetrics(metric); // } + + function onMetricWithoutRounding(metric: Metric) { + beacon['t_' + metric.name.toLocaleLowerCase()] = metric.value; + reportExtraMetrics(metric); + } } diff --git a/protractor.saucelabs.config.js b/protractor.saucelabs.config.js index 8cec259da..8aa941a67 100644 --- a/protractor.saucelabs.config.js +++ b/protractor.saucelabs.config.js @@ -9,17 +9,11 @@ exports.config = { sauceBuild: process.env.GITHUB_RUN_NUMBER, // See https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/ multiCapabilities: [ - newSaucelabsCapability('internet explorer', '11.103', 'Windows 10'), - newSaucelabsCapability('MicrosoftEdge', '14.14393', 'Windows 10'), - newSaucelabsCapability('safari', '9.0', 'OS X 10.11'), - newSaucelabsCapability('safari', '10.1', 'macOS 10.12'), - newSaucelabsCapability('safari', '11.0', 'macOS 10.12'), - newSaucelabsCapability('safari', '11.1', 'macOS 10.13'), - newSaucelabsCapability('firefox', '78.0', 'Windows 7'), - newSaucelabsCapability('firefox', '58.0', 'Windows 11'), - newSaucelabsCapability('chrome', '67.0', 'Windows 10'), - newSaucelabsCapability('chrome', '54.0', 'OS X 10.11'), - newSaucelabsCapability('chrome', '65.0', 'OS X 10.11') + newSaucelabsCapability('chrome', '124.0', 'OS X 10.11'), + newSaucelabsCapability('chrome', '124.0', 'macOS'), + newSaucelabsCapability('chrome', '124.0', 'Windows 7'), + newSaucelabsCapability('chrome', '124.0', 'Windows 10'), + newSaucelabsCapability('chrome', '124.0', 'Windows 11') ], // Do not allow parallel test execution. Makes the test execution a lot // slower, but the setup simpler. @@ -34,7 +28,7 @@ function newSaucelabsCapability(browserName, version, platform) { browserName, version, platform, - name: 'Testing for only INP values', + name: 'Testing for only CLS values in chrome 124', 'tunnel-identifier': 'github-action-tunnel', build: process.env.GITHUB_RUN_NUMBER }; diff --git a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js index 8968cada7..127fd3dd2 100644 --- a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js +++ b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js @@ -57,23 +57,23 @@ describe('12_webvitalsAsCustomEvent', () => { // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); // }); - // expectOneMatching(beacons, beacon => { - // cexpect(beacon.ty).to.equal('cus'); - // cexpect(beacon.ts).to.be.a('string'); - // cexpect(beacon.n).to.equal('instana-webvitals-CLS'); - // cexpect(beacon.l).to.be.a('string'); - // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); - // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); - // }); - expectOneMatching(beacons, beacon => { cexpect(beacon.ty).to.equal('cus'); cexpect(beacon.ts).to.be.a('string'); - cexpect(beacon.n).to.equal('instana-webvitals-INP'); + cexpect(beacon.n).to.equal('instana-webvitals-CLS'); cexpect(beacon.l).to.be.a('string'); cexpect(beacon.pl).to.equal(pageLoadBeacon.t); cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); }); + + // expectOneMatching(beacons, beacon => { + // cexpect(beacon.ty).to.equal('cus'); + // cexpect(beacon.ts).to.be.a('string'); + // cexpect(beacon.n).to.equal('instana-webvitals-INP'); + // cexpect(beacon.l).to.be.a('string'); + // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); + // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); + // }); }); }); }); From 379d9e217ecfccf9b85995424bdbb5c8cb309ec1 Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Mon, 20 May 2024 16:29:57 +0530 Subject: [PATCH 08/16] Testing for only INP values in chrome 124 --- protractor.saucelabs.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protractor.saucelabs.config.js b/protractor.saucelabs.config.js index 8aa941a67..761e072db 100644 --- a/protractor.saucelabs.config.js +++ b/protractor.saucelabs.config.js @@ -28,7 +28,7 @@ function newSaucelabsCapability(browserName, version, platform) { browserName, version, platform, - name: 'Testing for only CLS values in chrome 124', + name: 'Testing for only INP values in chrome 124', 'tunnel-identifier': 'github-action-tunnel', build: process.env.GITHUB_RUN_NUMBER }; From 2c639c8f84e663f2760ebed1b64db7d66bf9bc10 Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Mon, 20 May 2024 16:40:48 +0530 Subject: [PATCH 09/16] Testing for only INP values in latest versions --- lib/webVitals.js | 26 +++++++++---------- protractor.saucelabs.config.js | 15 ++++++----- .../webvitalsAsCustomEvent.spec.js | 20 +++++++------- 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/lib/webVitals.js b/lib/webVitals.js index 29a6133e4..168bb1cf6 100644 --- a/lib/webVitals.js +++ b/lib/webVitals.js @@ -1,14 +1,14 @@ // @flow // $FlowFixMe Flow doesn't find the file. Let's ignore this for now. -import {onCLS} from 'web-vitals'; +import {onINP} from 'web-vitals'; import type {PageLoadBeacon} from './types'; import {pageLoadStartTimestamp} from './timings'; import {reportCustomEvent} from './customEvents'; import vars from './vars'; interface Metric { - name: 'CLS'; + name: 'INP'; value: number; id?: string; @@ -37,20 +37,20 @@ export function addWebVitals(beacon: PageLoadBeacon) { // if (onFID) { // onFID(onMetric, true); // } - // if (onINP) { - // onINP(onMetric, true); - // } - if (onCLS) { - onCLS(onMetricWithoutRounding, true); + if (onINP) { + onINP(onMetric, true); } - - // function onMetric(metric: Metric) { - // beacon['t_' + metric.name.toLocaleLowerCase()] = Math.round(metric.value); - // reportExtraMetrics(metric); + // if (onCLS) { + // onCLS(onMetricWithoutRounding, true); // } - function onMetricWithoutRounding(metric: Metric) { - beacon['t_' + metric.name.toLocaleLowerCase()] = metric.value; + function onMetric(metric: Metric) { + beacon['t_' + metric.name.toLocaleLowerCase()] = Math.round(metric.value); reportExtraMetrics(metric); } + + // function onMetricWithoutRounding(metric: Metric) { + // beacon['t_' + metric.name.toLocaleLowerCase()] = metric.value; + // reportExtraMetrics(metric); + // } } diff --git a/protractor.saucelabs.config.js b/protractor.saucelabs.config.js index 761e072db..72e96027c 100644 --- a/protractor.saucelabs.config.js +++ b/protractor.saucelabs.config.js @@ -9,11 +9,14 @@ exports.config = { sauceBuild: process.env.GITHUB_RUN_NUMBER, // See https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/ multiCapabilities: [ - newSaucelabsCapability('chrome', '124.0', 'OS X 10.11'), - newSaucelabsCapability('chrome', '124.0', 'macOS'), - newSaucelabsCapability('chrome', '124.0', 'Windows 7'), - newSaucelabsCapability('chrome', '124.0', 'Windows 10'), - newSaucelabsCapability('chrome', '124.0', 'Windows 11') + newSaucelabsCapability('chrome', '124.0', 'macOS 11.00'), + newSaucelabsCapability('firefox', '125.0', 'macOS 11.00'), + newSaucelabsCapability('chrome', '124.0', 'macOS 12.00'), + newSaucelabsCapability('firefox', '125.0', 'macOS 12.00'), + newSaucelabsCapability('chrome', '124.0', 'macOS 13.00'), + newSaucelabsCapability('firefox', '125.0', 'macOS 13.00'), + newSaucelabsCapability('chrome', '124.0', 'macOS 14.00'), + newSaucelabsCapability('firefox', '125.0', 'macOS 14.00') ], // Do not allow parallel test execution. Makes the test execution a lot // slower, but the setup simpler. @@ -28,7 +31,7 @@ function newSaucelabsCapability(browserName, version, platform) { browserName, version, platform, - name: 'Testing for only INP values in chrome 124', + name: 'Testing for only INP values', 'tunnel-identifier': 'github-action-tunnel', build: process.env.GITHUB_RUN_NUMBER }; diff --git a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js index 127fd3dd2..8968cada7 100644 --- a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js +++ b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js @@ -57,23 +57,23 @@ describe('12_webvitalsAsCustomEvent', () => { // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); // }); - expectOneMatching(beacons, beacon => { - cexpect(beacon.ty).to.equal('cus'); - cexpect(beacon.ts).to.be.a('string'); - cexpect(beacon.n).to.equal('instana-webvitals-CLS'); - cexpect(beacon.l).to.be.a('string'); - cexpect(beacon.pl).to.equal(pageLoadBeacon.t); - cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); - }); - // expectOneMatching(beacons, beacon => { // cexpect(beacon.ty).to.equal('cus'); // cexpect(beacon.ts).to.be.a('string'); - // cexpect(beacon.n).to.equal('instana-webvitals-INP'); + // cexpect(beacon.n).to.equal('instana-webvitals-CLS'); // cexpect(beacon.l).to.be.a('string'); // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); // }); + + expectOneMatching(beacons, beacon => { + cexpect(beacon.ty).to.equal('cus'); + cexpect(beacon.ts).to.be.a('string'); + cexpect(beacon.n).to.equal('instana-webvitals-INP'); + cexpect(beacon.l).to.be.a('string'); + cexpect(beacon.pl).to.equal(pageLoadBeacon.t); + cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); + }); }); }); }); From d1dd75ecc19f575f53a0735c5b7dcde429f29a39 Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Mon, 20 May 2024 17:02:18 +0530 Subject: [PATCH 10/16] Testing for only CLS values in latest versions --- lib/webVitals.js | 26 +++++++++---------- protractor.saucelabs.config.js | 2 +- .../webvitalsAsCustomEvent.spec.js | 20 +++++++------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/webVitals.js b/lib/webVitals.js index 168bb1cf6..29a6133e4 100644 --- a/lib/webVitals.js +++ b/lib/webVitals.js @@ -1,14 +1,14 @@ // @flow // $FlowFixMe Flow doesn't find the file. Let's ignore this for now. -import {onINP} from 'web-vitals'; +import {onCLS} from 'web-vitals'; import type {PageLoadBeacon} from './types'; import {pageLoadStartTimestamp} from './timings'; import {reportCustomEvent} from './customEvents'; import vars from './vars'; interface Metric { - name: 'INP'; + name: 'CLS'; value: number; id?: string; @@ -37,20 +37,20 @@ export function addWebVitals(beacon: PageLoadBeacon) { // if (onFID) { // onFID(onMetric, true); // } - if (onINP) { - onINP(onMetric, true); - } - // if (onCLS) { - // onCLS(onMetricWithoutRounding, true); + // if (onINP) { + // onINP(onMetric, true); // } - - function onMetric(metric: Metric) { - beacon['t_' + metric.name.toLocaleLowerCase()] = Math.round(metric.value); - reportExtraMetrics(metric); + if (onCLS) { + onCLS(onMetricWithoutRounding, true); } - // function onMetricWithoutRounding(metric: Metric) { - // beacon['t_' + metric.name.toLocaleLowerCase()] = metric.value; + // function onMetric(metric: Metric) { + // beacon['t_' + metric.name.toLocaleLowerCase()] = Math.round(metric.value); // reportExtraMetrics(metric); // } + + function onMetricWithoutRounding(metric: Metric) { + beacon['t_' + metric.name.toLocaleLowerCase()] = metric.value; + reportExtraMetrics(metric); + } } diff --git a/protractor.saucelabs.config.js b/protractor.saucelabs.config.js index 72e96027c..099dd8293 100644 --- a/protractor.saucelabs.config.js +++ b/protractor.saucelabs.config.js @@ -31,7 +31,7 @@ function newSaucelabsCapability(browserName, version, platform) { browserName, version, platform, - name: 'Testing for only INP values', + name: 'Testing for only CLS values', 'tunnel-identifier': 'github-action-tunnel', build: process.env.GITHUB_RUN_NUMBER }; diff --git a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js index 8968cada7..127fd3dd2 100644 --- a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js +++ b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js @@ -57,23 +57,23 @@ describe('12_webvitalsAsCustomEvent', () => { // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); // }); - // expectOneMatching(beacons, beacon => { - // cexpect(beacon.ty).to.equal('cus'); - // cexpect(beacon.ts).to.be.a('string'); - // cexpect(beacon.n).to.equal('instana-webvitals-CLS'); - // cexpect(beacon.l).to.be.a('string'); - // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); - // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); - // }); - expectOneMatching(beacons, beacon => { cexpect(beacon.ty).to.equal('cus'); cexpect(beacon.ts).to.be.a('string'); - cexpect(beacon.n).to.equal('instana-webvitals-INP'); + cexpect(beacon.n).to.equal('instana-webvitals-CLS'); cexpect(beacon.l).to.be.a('string'); cexpect(beacon.pl).to.equal(pageLoadBeacon.t); cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); }); + + // expectOneMatching(beacons, beacon => { + // cexpect(beacon.ty).to.equal('cus'); + // cexpect(beacon.ts).to.be.a('string'); + // cexpect(beacon.n).to.equal('instana-webvitals-INP'); + // cexpect(beacon.l).to.be.a('string'); + // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); + // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); + // }); }); }); }); From 413f651ef06a87f46486549024aa9595c6dac405 Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Mon, 20 May 2024 17:09:47 +0530 Subject: [PATCH 11/16] Testing for only LCP values in latest versions --- lib/webVitals.js | 28 +++++++++---------- protractor.saucelabs.config.js | 2 +- .../webvitalsAsCustomEvent.spec.js | 24 ++++++++-------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/webVitals.js b/lib/webVitals.js index 29a6133e4..c3a36b262 100644 --- a/lib/webVitals.js +++ b/lib/webVitals.js @@ -1,14 +1,14 @@ // @flow // $FlowFixMe Flow doesn't find the file. Let's ignore this for now. -import {onCLS} from 'web-vitals'; +import {onLCP} from 'web-vitals'; import type {PageLoadBeacon} from './types'; import {pageLoadStartTimestamp} from './timings'; import {reportCustomEvent} from './customEvents'; import vars from './vars'; interface Metric { - name: 'CLS'; + name: 'LCP'; value: number; id?: string; @@ -31,26 +31,26 @@ function reportExtraMetrics(metric: Metric) { } export function addWebVitals(beacon: PageLoadBeacon) { - // if (onLCP) { - // onLCP(onMetric, true); - // } + if (onLCP) { + onLCP(onMetric, true); + } // if (onFID) { // onFID(onMetric, true); // } // if (onINP) { // onINP(onMetric, true); // } - if (onCLS) { - onCLS(onMetricWithoutRounding, true); - } - - // function onMetric(metric: Metric) { - // beacon['t_' + metric.name.toLocaleLowerCase()] = Math.round(metric.value); - // reportExtraMetrics(metric); + // if (onCLS) { + // onCLS(onMetricWithoutRounding, true); // } - function onMetricWithoutRounding(metric: Metric) { - beacon['t_' + metric.name.toLocaleLowerCase()] = metric.value; + function onMetric(metric: Metric) { + beacon['t_' + metric.name.toLocaleLowerCase()] = Math.round(metric.value); reportExtraMetrics(metric); } + + // function onMetricWithoutRounding(metric: Metric) { + // beacon['t_' + metric.name.toLocaleLowerCase()] = metric.value; + // reportExtraMetrics(metric); + // } } diff --git a/protractor.saucelabs.config.js b/protractor.saucelabs.config.js index 099dd8293..636606363 100644 --- a/protractor.saucelabs.config.js +++ b/protractor.saucelabs.config.js @@ -31,7 +31,7 @@ function newSaucelabsCapability(browserName, version, platform) { browserName, version, platform, - name: 'Testing for only CLS values', + name: 'Testing for only LCP values', 'tunnel-identifier': 'github-action-tunnel', build: process.env.GITHUB_RUN_NUMBER }; diff --git a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js index 127fd3dd2..7fed8c2ce 100644 --- a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js +++ b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js @@ -38,11 +38,20 @@ describe('12_webvitalsAsCustomEvent', () => { cexpect(beacon.ty).to.equal('pl'); }); + expectOneMatching(beacons, beacon => { + cexpect(beacon.ty).to.equal('cus'); + cexpect(beacon.ts).to.be.a('string'); + cexpect(parseFloat(beacon.d)).to.be.above(3000); + cexpect(beacon.n).to.equal('instana-webvitals-LCP'); + cexpect(beacon.l).to.be.a('string'); + cexpect(beacon.pl).to.equal(pageLoadBeacon.t); + cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); + }); + // expectOneMatching(beacons, beacon => { // cexpect(beacon.ty).to.equal('cus'); // cexpect(beacon.ts).to.be.a('string'); - // cexpect(parseFloat(beacon.d)).to.be.above(3000); - // cexpect(beacon.n).to.equal('instana-webvitals-LCP'); + // cexpect(beacon.n).to.equal('instana-webvitals-FID'); // cexpect(beacon.l).to.be.a('string'); // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); @@ -51,21 +60,12 @@ describe('12_webvitalsAsCustomEvent', () => { // expectOneMatching(beacons, beacon => { // cexpect(beacon.ty).to.equal('cus'); // cexpect(beacon.ts).to.be.a('string'); - // cexpect(beacon.n).to.equal('instana-webvitals-FID'); + // cexpect(beacon.n).to.equal('instana-webvitals-CLS'); // cexpect(beacon.l).to.be.a('string'); // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); // }); - expectOneMatching(beacons, beacon => { - cexpect(beacon.ty).to.equal('cus'); - cexpect(beacon.ts).to.be.a('string'); - cexpect(beacon.n).to.equal('instana-webvitals-CLS'); - cexpect(beacon.l).to.be.a('string'); - cexpect(beacon.pl).to.equal(pageLoadBeacon.t); - cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); - }); - // expectOneMatching(beacons, beacon => { // cexpect(beacon.ty).to.equal('cus'); // cexpect(beacon.ts).to.be.a('string'); From 8c5a5d97240eea79906bdda36fd3f23677cde9d0 Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Mon, 20 May 2024 17:18:22 +0530 Subject: [PATCH 12/16] Testing for only FID values in latest versions --- lib/webVitals.js | 14 ++++++------ protractor.saucelabs.config.js | 2 +- .../webvitalsAsCustomEvent.spec.js | 22 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/webVitals.js b/lib/webVitals.js index c3a36b262..63ce04da2 100644 --- a/lib/webVitals.js +++ b/lib/webVitals.js @@ -1,14 +1,14 @@ // @flow // $FlowFixMe Flow doesn't find the file. Let's ignore this for now. -import {onLCP} from 'web-vitals'; +import {onFID} from 'web-vitals'; import type {PageLoadBeacon} from './types'; import {pageLoadStartTimestamp} from './timings'; import {reportCustomEvent} from './customEvents'; import vars from './vars'; interface Metric { - name: 'LCP'; + name: 'FID'; value: number; id?: string; @@ -31,12 +31,12 @@ function reportExtraMetrics(metric: Metric) { } export function addWebVitals(beacon: PageLoadBeacon) { - if (onLCP) { - onLCP(onMetric, true); - } - // if (onFID) { - // onFID(onMetric, true); + // if (onLCP) { + // onLCP(onMetric, true); // } + if (onFID) { + onFID(onMetric, true); + } // if (onINP) { // onINP(onMetric, true); // } diff --git a/protractor.saucelabs.config.js b/protractor.saucelabs.config.js index 636606363..6db43742b 100644 --- a/protractor.saucelabs.config.js +++ b/protractor.saucelabs.config.js @@ -31,7 +31,7 @@ function newSaucelabsCapability(browserName, version, platform) { browserName, version, platform, - name: 'Testing for only LCP values', + name: 'Testing for only FID values', 'tunnel-identifier': 'github-action-tunnel', build: process.env.GITHUB_RUN_NUMBER }; diff --git a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js index 7fed8c2ce..b8f6ebfd4 100644 --- a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js +++ b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js @@ -38,25 +38,25 @@ describe('12_webvitalsAsCustomEvent', () => { cexpect(beacon.ty).to.equal('pl'); }); - expectOneMatching(beacons, beacon => { - cexpect(beacon.ty).to.equal('cus'); - cexpect(beacon.ts).to.be.a('string'); - cexpect(parseFloat(beacon.d)).to.be.above(3000); - cexpect(beacon.n).to.equal('instana-webvitals-LCP'); - cexpect(beacon.l).to.be.a('string'); - cexpect(beacon.pl).to.equal(pageLoadBeacon.t); - cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); - }); - // expectOneMatching(beacons, beacon => { // cexpect(beacon.ty).to.equal('cus'); // cexpect(beacon.ts).to.be.a('string'); - // cexpect(beacon.n).to.equal('instana-webvitals-FID'); + // cexpect(parseFloat(beacon.d)).to.be.above(3000); + // cexpect(beacon.n).to.equal('instana-webvitals-LCP'); // cexpect(beacon.l).to.be.a('string'); // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); // }); + expectOneMatching(beacons, beacon => { + cexpect(beacon.ty).to.equal('cus'); + cexpect(beacon.ts).to.be.a('string'); + cexpect(beacon.n).to.equal('instana-webvitals-FID'); + cexpect(beacon.l).to.be.a('string'); + cexpect(beacon.pl).to.equal(pageLoadBeacon.t); + cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); + }); + // expectOneMatching(beacons, beacon => { // cexpect(beacon.ty).to.equal('cus'); // cexpect(beacon.ts).to.be.a('string'); From 4ebacfdcad4f71b3ebf0ae91df85c2fa476cd39e Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Mon, 20 May 2024 18:18:40 +0530 Subject: [PATCH 13/16] Testing for All values --- lib/webVitals.js | 30 +++++------ protractor.saucelabs.config.js | 2 +- .../webvitalsAsCustomEvent.spec.js | 50 +++++++++---------- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/lib/webVitals.js b/lib/webVitals.js index 63ce04da2..fafc3931f 100644 --- a/lib/webVitals.js +++ b/lib/webVitals.js @@ -1,14 +1,14 @@ // @flow // $FlowFixMe Flow doesn't find the file. Let's ignore this for now. -import {onFID} from 'web-vitals'; +import {onCLS, onLCP, onFID, onINP} from 'web-vitals'; import type {PageLoadBeacon} from './types'; import {pageLoadStartTimestamp} from './timings'; import {reportCustomEvent} from './customEvents'; import vars from './vars'; interface Metric { - name: 'FID'; + name: 'CLS' | 'FID' | 'LCP' | 'INP'; value: number; id?: string; @@ -31,26 +31,26 @@ function reportExtraMetrics(metric: Metric) { } export function addWebVitals(beacon: PageLoadBeacon) { - // if (onLCP) { - // onLCP(onMetric, true); - // } + if (onLCP) { + onLCP(onMetric, true); + } if (onFID) { onFID(onMetric, true); } - // if (onINP) { - // onINP(onMetric, true); - // } - // if (onCLS) { - // onCLS(onMetricWithoutRounding, true); - // } + if (onINP) { + onINP(onMetric, true); + } + if (onCLS) { + onCLS(onMetricWithoutRounding, true); + } function onMetric(metric: Metric) { beacon['t_' + metric.name.toLocaleLowerCase()] = Math.round(metric.value); reportExtraMetrics(metric); } - // function onMetricWithoutRounding(metric: Metric) { - // beacon['t_' + metric.name.toLocaleLowerCase()] = metric.value; - // reportExtraMetrics(metric); - // } + function onMetricWithoutRounding(metric: Metric) { + beacon['t_' + metric.name.toLocaleLowerCase()] = metric.value; + reportExtraMetrics(metric); + } } diff --git a/protractor.saucelabs.config.js b/protractor.saucelabs.config.js index 6db43742b..c6602f662 100644 --- a/protractor.saucelabs.config.js +++ b/protractor.saucelabs.config.js @@ -31,7 +31,7 @@ function newSaucelabsCapability(browserName, version, platform) { browserName, version, platform, - name: 'Testing for only FID values', + name: 'Testing for All values', 'tunnel-identifier': 'github-action-tunnel', build: process.env.GITHUB_RUN_NUMBER }; diff --git a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js index b8f6ebfd4..4afb34d8a 100644 --- a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js +++ b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js @@ -38,15 +38,15 @@ describe('12_webvitalsAsCustomEvent', () => { cexpect(beacon.ty).to.equal('pl'); }); - // expectOneMatching(beacons, beacon => { - // cexpect(beacon.ty).to.equal('cus'); - // cexpect(beacon.ts).to.be.a('string'); - // cexpect(parseFloat(beacon.d)).to.be.above(3000); - // cexpect(beacon.n).to.equal('instana-webvitals-LCP'); - // cexpect(beacon.l).to.be.a('string'); - // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); - // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); - // }); + expectOneMatching(beacons, beacon => { + cexpect(beacon.ty).to.equal('cus'); + cexpect(beacon.ts).to.be.a('string'); + cexpect(parseFloat(beacon.d)).to.be.above(3000); + cexpect(beacon.n).to.equal('instana-webvitals-LCP'); + cexpect(beacon.l).to.be.a('string'); + cexpect(beacon.pl).to.equal(pageLoadBeacon.t); + cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); + }); expectOneMatching(beacons, beacon => { cexpect(beacon.ty).to.equal('cus'); @@ -57,23 +57,23 @@ describe('12_webvitalsAsCustomEvent', () => { cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); }); - // expectOneMatching(beacons, beacon => { - // cexpect(beacon.ty).to.equal('cus'); - // cexpect(beacon.ts).to.be.a('string'); - // cexpect(beacon.n).to.equal('instana-webvitals-CLS'); - // cexpect(beacon.l).to.be.a('string'); - // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); - // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); - // }); + expectOneMatching(beacons, beacon => { + cexpect(beacon.ty).to.equal('cus'); + cexpect(beacon.ts).to.be.a('string'); + cexpect(beacon.n).to.equal('instana-webvitals-CLS'); + cexpect(beacon.l).to.be.a('string'); + cexpect(beacon.pl).to.equal(pageLoadBeacon.t); + cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); + }); - // expectOneMatching(beacons, beacon => { - // cexpect(beacon.ty).to.equal('cus'); - // cexpect(beacon.ts).to.be.a('string'); - // cexpect(beacon.n).to.equal('instana-webvitals-INP'); - // cexpect(beacon.l).to.be.a('string'); - // cexpect(beacon.pl).to.equal(pageLoadBeacon.t); - // cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); - // }); + expectOneMatching(beacons, beacon => { + cexpect(beacon.ty).to.equal('cus'); + cexpect(beacon.ts).to.be.a('string'); + cexpect(beacon.n).to.equal('instana-webvitals-INP'); + cexpect(beacon.l).to.be.a('string'); + cexpect(beacon.pl).to.equal(pageLoadBeacon.t); + cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); + }); }); }); }); From f81bab8086df1cc7175a11e87f6b37c036ab5838 Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Mon, 20 May 2024 19:05:20 +0530 Subject: [PATCH 14/16] Test for All compatibility --- protractor.saucelabs.config.js | 79 +++++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 10 deletions(-) diff --git a/protractor.saucelabs.config.js b/protractor.saucelabs.config.js index c6602f662..87811f2a2 100644 --- a/protractor.saucelabs.config.js +++ b/protractor.saucelabs.config.js @@ -9,14 +9,73 @@ exports.config = { sauceBuild: process.env.GITHUB_RUN_NUMBER, // See https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/ multiCapabilities: [ - newSaucelabsCapability('chrome', '124.0', 'macOS 11.00'), - newSaucelabsCapability('firefox', '125.0', 'macOS 11.00'), - newSaucelabsCapability('chrome', '124.0', 'macOS 12.00'), - newSaucelabsCapability('firefox', '125.0', 'macOS 12.00'), - newSaucelabsCapability('chrome', '124.0', 'macOS 13.00'), - newSaucelabsCapability('firefox', '125.0', 'macOS 13.00'), - newSaucelabsCapability('chrome', '124.0', 'macOS 14.00'), - newSaucelabsCapability('firefox', '125.0', 'macOS 14.00') + newSaucelabsCapability('chrome', 'latest', 'Windows 11', 'TEST FOR latest chrome - Windows 11'), + newSaucelabsCapability('edge', 'latest', 'Windows 11', 'TEST FOR latest edge - Windows 11'), + newSaucelabsCapability('firefox', 'latest', 'Windows 11', 'TEST FOR latest firefox - Windows 11'), + + newSaucelabsCapability('chrome', 'latest', 'Windows 10', 'TEST FOR latest chrome - Windows 10'), + newSaucelabsCapability('edge', 'latest', 'Windows 10', 'TEST FOR latest edge - Windows 10'), + newSaucelabsCapability('firefox', 'latest', 'Windows 10', 'TEST FOR latest firefox - Windows 10'), + newSaucelabsCapability('internetExplorer', 'latest', 'Windows 10', 'TEST FOR latest internetExplorer - Windows 10'), + + newSaucelabsCapability('chrome', 'latest', 'Windows 8.1', 'TEST FOR latest chrome - Windows 8.1'), + newSaucelabsCapability('internetExplorer', 'latest', 'Windows 8.1', 'TEST FOR latest internetExplorer - Windows 8.1'), + newSaucelabsCapability('firefox', 'latest', 'Windows 8.1', 'TEST FOR latest firefox - Windows 8.1'), + + newSaucelabsCapability('chrome', 'latest', 'Windows 8', 'TEST FOR latest chrome - Windows 8'), + newSaucelabsCapability('internetExplorer', 'latest', 'Windows 8', 'TEST FOR latest internetExplorer - Windows 8'), + newSaucelabsCapability('firefox', 'latest', 'Windows 8', 'TEST FOR latest firefox - Windows 8'), + + newSaucelabsCapability('chrome', 'latest', 'Windows 7', 'TEST FOR latest chrome - Windows 7'), + newSaucelabsCapability('internetExplorer', 'latest', 'Windows 7', 'TEST FOR latest internetExplorer - Windows 7'), + newSaucelabsCapability('firefox', 'latest', 'Windows 7', 'TEST FOR latest firefox - Windows 7'), + + newSaucelabsCapability('undefined', 'latest', 'Linux', 'TEST FOR latest undefined - Linux'), + + newSaucelabsCapability('chrome', 'latest', 'macOS 13', 'TEST FOR latest chrome - macOS 13'), + newSaucelabsCapability('edge', 'latest', 'macOS 13', 'TEST FOR latest edge - macOS 13'), + newSaucelabsCapability('firefox', 'latest', 'macOS 13', 'TEST FOR latest firefox - macOS 13'), + newSaucelabsCapability('safari', 'latest', 'macOS 13', 'TEST FOR latest safari - macOS 13'), + + newSaucelabsCapability('chrome', 'latest', 'macOS 12', 'TEST FOR latest chrome - macOS 12'), + newSaucelabsCapability('edge', 'latest', 'macOS 12', 'TEST FOR latest edge - macOS 12'), + newSaucelabsCapability('firefox', 'latest', 'macOS 12', 'TEST FOR latest firefox - macOS 12'), + newSaucelabsCapability('safari', 'latest', 'macOS 12', 'TEST FOR latest safari - macOS 12'), + + newSaucelabsCapability('chrome', 'latest', 'macOS 11.00', 'TEST FOR latest chrome - macOS 11.00'), + newSaucelabsCapability('edge', 'latest', 'macOS 11.00', 'TEST FOR latest edge - macOS 11.00'), + newSaucelabsCapability('firefox', 'latest', 'macOS 11.00', 'TEST FOR latest firefox - macOS 11.00'), + newSaucelabsCapability('safari', 'latest', 'macOS 11.00', 'TEST FOR latest safari - macOS 11.00'), + + newSaucelabsCapability('chrome', 'latest', 'macOS 10.15', 'TEST FOR latest chrome - macOS 10.15'), + newSaucelabsCapability('edge', 'latest', 'macOS 10.15', 'TEST FOR latest edge - macOS 10.15'), + newSaucelabsCapability('firefox', 'latest', 'macOS 10.15', 'TEST FOR latest firefox - macOS 10.15'), + newSaucelabsCapability('safari', 'latest', 'macOS 10.15', 'TEST FOR latest safari - macOS 10.15'), + + newSaucelabsCapability('chrome', 'latest', 'macOS 10.14', 'TEST FOR latest chrome - macOS 10.14'), + newSaucelabsCapability('edge', 'latest', 'macOS 10.14', 'TEST FOR latest edge - macOS 10.14'), + newSaucelabsCapability('firefox', 'latest', 'macOS 10.14', 'TEST FOR latest firefox - macOS 10.14'), + newSaucelabsCapability('safari', 'latest', 'macOS 10.14', 'TEST FOR latest safari - macOS 10.14'), + + newSaucelabsCapability('chrome', 'latest', 'macOS 10.13', 'TEST FOR latest chrome - macOS 10.13'), + newSaucelabsCapability('edge', 'latest', 'macOS 10.13', 'TEST FOR latest edge - macOS 10.13'), + newSaucelabsCapability('firefox', 'latest', 'macOS 10.13', 'TEST FOR latest firefox - macOS 10.13'), + newSaucelabsCapability('safari', 'latest', 'macOS 10.13', 'TEST FOR latest safari - macOS 10.13'), + + newSaucelabsCapability('chrome', 'latest', 'macOS 10.12', 'TEST FOR latest chrome - macOS 10.12'), + newSaucelabsCapability('edge', 'latest', 'macOS 10.12', 'TEST FOR latest edge - macOS 10.12'), + newSaucelabsCapability('firefox', 'latest', 'macOS 10.12', 'TEST FOR latest firefox - macOS 10.12'), + newSaucelabsCapability('safari', 'latest', 'macOS 10.12', 'TEST FOR latest safari - macOS 10.12'), + + newSaucelabsCapability('chrome', 'latest', 'OS X 10.11', 'TEST FOR latest chrome - OS X 10.11'), + newSaucelabsCapability('edge', 'latest', 'OS X 10.11', 'TEST FOR latest edge - OS X 10.11'), + newSaucelabsCapability('firefox', 'latest', 'OS X 10.11', 'TEST FOR latest firefox - OS X 10.11'), + newSaucelabsCapability('safari', 'latest', 'OS X 10.11', 'TEST FOR latest safari - OS X 10.11'), + + newSaucelabsCapability('chrome', 'latest', 'OS X 10.10', 'TEST FOR latest chrome - OS X 10.10'), + newSaucelabsCapability('edge', 'latest', 'OS X 10.10', 'TEST FOR latest edge - OS X 10.10'), + newSaucelabsCapability('firefox', 'latest', 'OS X 10.10', 'TEST FOR latest firefox - OS X 10.10'), + newSaucelabsCapability('safari', 'latest', 'OS X 10.10', 'TEST FOR latest safari - OS X 10.10') ], // Do not allow parallel test execution. Makes the test execution a lot // slower, but the setup simpler. @@ -26,12 +85,12 @@ exports.config = { } }; -function newSaucelabsCapability(browserName, version, platform) { +function newSaucelabsCapability(browserName, version, platform, name) { return { browserName, version, platform, - name: 'Testing for All values', + name, 'tunnel-identifier': 'github-action-tunnel', build: process.env.GITHUB_RUN_NUMBER }; From 24b56109909c599346920b6b0cc868e2efddb25f Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Tue, 21 May 2024 12:30:14 +0530 Subject: [PATCH 15/16] exclude WV --- protractor.saucelabs.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protractor.saucelabs.config.js b/protractor.saucelabs.config.js index 87811f2a2..0433971ea 100644 --- a/protractor.saucelabs.config.js +++ b/protractor.saucelabs.config.js @@ -3,7 +3,7 @@ exports.config = { specs: ['test/e2e/**/*.spec.js'], // TODO: disable webvital tests for saucelab for now, since browsers in saucelab seems never return webvital metrics - // exclude: ['test/e2e/12_webvitalsAsCustomEvent/*.spec.js'], + exclude: ['test/e2e/12_webvitalsAsCustomEvent/*.spec.js'], sauceUser: process.env.SAUCE_USERNAME, sauceKey: process.env.SAUCE_ACCESS_KEY, sauceBuild: process.env.GITHUB_RUN_NUMBER, From ac32a440ce727f9fc0264b308533ac0ed5cc8d91 Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Tue, 21 May 2024 12:33:17 +0530 Subject: [PATCH 16/16] old --- protractor.saucelabs.config.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/protractor.saucelabs.config.js b/protractor.saucelabs.config.js index 0433971ea..881b2a004 100644 --- a/protractor.saucelabs.config.js +++ b/protractor.saucelabs.config.js @@ -9,6 +9,18 @@ exports.config = { sauceBuild: process.env.GITHUB_RUN_NUMBER, // See https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/ multiCapabilities: [ + newSaucelabsCapability('internet explorer', '11.103', 'Windows 10'), + newSaucelabsCapability('MicrosoftEdge', '14.14393', 'Windows 10'), + newSaucelabsCapability('safari', '9.0', 'OS X 10.11'), + newSaucelabsCapability('safari', '10.1', 'macOS 10.12'), + newSaucelabsCapability('safari', '11.0', 'macOS 10.12'), + newSaucelabsCapability('safari', '11.1', 'macOS 10.13'), + newSaucelabsCapability('firefox', '78.0', 'Windows 7'), + newSaucelabsCapability('firefox', '58.0', 'Windows 11'), + newSaucelabsCapability('chrome', '67.0', 'Windows 10'), + newSaucelabsCapability('chrome', '54.0', 'OS X 10.11'), + newSaucelabsCapability('chrome', '65.0', 'OS X 10.11'), + newSaucelabsCapability('chrome', 'latest', 'Windows 11', 'TEST FOR latest chrome - Windows 11'), newSaucelabsCapability('edge', 'latest', 'Windows 11', 'TEST FOR latest edge - Windows 11'), newSaucelabsCapability('firefox', 'latest', 'Windows 11', 'TEST FOR latest firefox - Windows 11'),