Skip to content

Commit

Permalink
TEST
Browse files Browse the repository at this point in the history
  • Loading branch information
SETHULAKSHMI-PM committed May 31, 2024
1 parent 57cd905 commit 7f00e71
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 46 deletions.
33 changes: 22 additions & 11 deletions protractor.saucelabs.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
86 changes: 51 additions & 35 deletions test/e2e/12_webvitalsAsCustomEvent/webvitalsAsCustomEvent.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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+)+$/);
});
}
});
});
});
Expand Down

0 comments on commit 7f00e71

Please sign in to comment.