From eee8c39e0095f2fd0d06d650c9243940a2612acc Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Tue, 28 May 2024 13:01:07 +0530 Subject: [PATCH 1/4] webvital to test --- 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 57cd905b1af14aa8cd5e474ec2822b9faa082673 Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Wed, 29 May 2024 14:35:27 +0530 Subject: [PATCH 2/4] kjh --- .../12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js index 4afb34d8a..d5333b0a1 100644 --- a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js +++ b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js @@ -13,6 +13,9 @@ describe('12_webvitalsAsCustomEvent', () => { // webvital CLS does not work if following another test, so restart browser to cleanup all context restartBrowser(); + const gg = browser.getCapabilities() + console.log('jhgjhghj', gg) + browser.get(getE2ETestBaseUrl('12_webvitalsAsCustomEvent/webvitalsAsCustomEvent')); // wait for webvital metrics browser.sleep(5000); From 7f00e717c9c8ff52d674fc355c112af4a7067bea Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Fri, 31 May 2024 12:45:44 +0530 Subject: [PATCH 3/4] TEST --- protractor.saucelabs.config.js | 33 ++++--- .../webvitalsAsCustomEvent.spec.js | 86 +++++++++++-------- 2 files changed, 73 insertions(+), 46 deletions(-) diff --git a/protractor.saucelabs.config.js b/protractor.saucelabs.config.js index 405dff585..7ba370990 100644 --- a/protractor.saucelabs.config.js +++ b/protractor.saucelabs.config.js @@ -9,17 +9,28 @@ 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('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', '77.0', 'Windows 10'), + newSaucelabsCapability('chrome', '78.0', 'Windows 10'), + newSaucelabsCapability('chrome', '79.0', 'Windows 10'), + newSaucelabsCapability('MicrosoftEdge', '79.0', 'Windows 10'), + newSaucelabsCapability('MicrosoftEdge', '80.0', 'Windows 10'), + newSaucelabsCapability('firefox', '122.0', 'Windows 11'), + newSaucelabsCapability('firefox', '123.0', 'Windows 11'), + newSaucelabsCapability('chrome', '76.0', 'Windows 10'), + newSaucelabsCapability('firefox', '89.0', 'Windows 11'), + newSaucelabsCapability('chrome', '96.0', 'Windows 10'), + newSaucelabsCapability('MicrosoftEdge', '96.0', 'Windows 10'), ], // Do not allow parallel test execution. Makes the test execution a lot // slower, but the setup simpler. diff --git a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js index d5333b0a1..bbbc5619c 100644 --- a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js +++ b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js @@ -13,9 +13,6 @@ describe('12_webvitalsAsCustomEvent', () => { // webvital CLS does not work if following another test, so restart browser to cleanup all context restartBrowser(); - const gg = browser.getCapabilities() - console.log('jhgjhghj', gg) - browser.get(getE2ETestBaseUrl('12_webvitalsAsCustomEvent/webvitalsAsCustomEvent')); // wait for webvital metrics browser.sleep(5000); @@ -41,41 +38,60 @@ 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+)+$/); - }); + return browser.getCapabilities().then(capabilities => { + const browserName = capabilities.get('browserName'); + const browserVersion = parseFloat(capabilities.get('version')); - 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+)+$/); - }); + if ((browserName === 'chrome' && browserVersion >= 77) || + (browserName === 'MicrosoftEdge' && browserVersion >= 79) || + (browserName === 'firefox' && browserVersion >= 122)) { + 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-CLS'); - cexpect(beacon.l).to.be.a('string'); - cexpect(beacon.pl).to.equal(pageLoadBeacon.t); - cexpect(beacon.m_id).to.match(/^v\d+(-\d+)+$/); - }); + if ((browserName === 'chrome' && browserVersion >= 76) || + (browserName === 'MicrosoftEdge' && browserVersion >= 79) || + (browserName === 'firefox' && browserVersion >= 89)) { + 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+)+$/); + }); + } + + if ((browserName === 'chrome' && browserVersion >= 77) || + (browserName === 'MicrosoftEdge' && browserVersion >= 79)) { + 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+)+$/); + if ((browserName === 'chrome' && browserVersion >= 96) || + (browserName === 'MicrosoftEdge' && browserVersion >= 96)) { + 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 2b68424faf8f8361df652840e00df584b80d332c Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Fri, 31 May 2024 14:39:44 +0530 Subject: [PATCH 4/4] wv added --- .../webvitalsAsCustomEvent.html | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.html b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.html index 9c1f88736..697118e14 100644 --- a/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.html +++ b/test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.html @@ -81,6 +81,19 @@ Open new blank tab +
+
+

Web vitals CLICK HERE...!!

+ +

CLS:

+

INP:

+

FID:

+

LCP:

+

FCP:

+

TTFB:

+
+
+