From 7f00e717c9c8ff52d674fc355c112af4a7067bea Mon Sep 17 00:00:00 2001 From: SETHULAKSHMI-PM Date: Fri, 31 May 2024 12:45:44 +0530 Subject: [PATCH] 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+)+$/); + }); + } }); }); });