From 31500797daf3a7b46bbdcc84dd27ecb4cf792dec Mon Sep 17 00:00:00 2001 From: Gouri Hariharan Date: Mon, 13 Jan 2025 10:33:25 +0530 Subject: [PATCH] E2E Test queryTrackedDomainList (#132) * e2e test for queryTrackedDomainList * redaction case added * update description * added domains to list * modified regex --- test/e2e/00_pageLoad/pageLoad.spec.js | 54 +++++++++++++++++++ .../www.example1.com.html | 19 +++++++ .../www.example2.com.html | 19 +++++++ .../www.exampleWithRedactionCase.com.html | 21 ++++++++ 4 files changed, 113 insertions(+) create mode 100644 test/e2e/00_pageLoad/queryTrackedDomainList/www.example1.com.html create mode 100644 test/e2e/00_pageLoad/queryTrackedDomainList/www.example2.com.html create mode 100644 test/e2e/00_pageLoad/queryTrackedDomainList/www.exampleWithRedactionCase.com.html diff --git a/test/e2e/00_pageLoad/pageLoad.spec.js b/test/e2e/00_pageLoad/pageLoad.spec.js index 88f8c0dea..7f2439a0c 100644 --- a/test/e2e/00_pageLoad/pageLoad.spec.js +++ b/test/e2e/00_pageLoad/pageLoad.spec.js @@ -400,8 +400,62 @@ describe('pageLoad', () => { }); }); + describe('pageload url in queryTrackedDomainList', () => { + beforeEach(() => { + browser.get(getE2ETestBaseUrl('00_pageLoad/queryTrackedDomainList/www.example1.com') + '@!#$**(?account1=value'); + }); + + it('full url with query parameters must be sent to backend', () => { + return util.retry(() => { + return getBeacons() + .then(([beacon]) => { + cexpect(beacon['u']).to.equal(getE2ETestBaseUrl('00_pageLoad/queryTrackedDomainList/www.example1.com') + '@!#$**(?account1=value'); + cexpect(beacon['l']).to.equal(beacon['u']); + }); + }); + }); + + }); + + describe('pageload url not in queryTrackedDomainList', () => { + beforeEach(() => { + browser.get(getE2ETestBaseUrl('00_pageLoad/queryTrackedDomainList/www.example2.com') + '@!#$**(?account3=value'); + }); + + it('url excluding query parameters must be sent to backend', () => { + return util.retry(() => { + return getBeacons() + .then(([beacon]) => { + let parsedUrl = (getE2ETestBaseUrl('00_pageLoad/queryTrackedDomainList/www.example2.com')).split('?')[0].split('#')[0]; + cexpect(beacon['u']).to.equal(parsedUrl); + cexpect(beacon['l']).to.equal(beacon['u']); + }); + }); + }); + + }); + + describe('pageload url with redaction and in queryTrackedDomainList', () => { + beforeEach(() => { + browser.get(getE2ETestBaseUrl('00_pageLoad/queryTrackedDomainList/www.exampleWithRedactionCase.com') + '&account=myaccount&appsecret=password#fragmentstring'); + }); + + it('full url with query parameters after redaction must be sent to backend', () => { + return util.retry(() => { + return getBeacons() + .then(([beacon]) => { + cexpect(beacon['u']).to.equal(getE2ETestBaseUrl('00_pageLoad/queryTrackedDomainList/www.exampleWithRedactionCase.com') + '&account=myaccount&appsecret=#'); + cexpect(beacon['l']).to.equal(beacon['u']); + }); + }); + }); + + }); + }); + + function stripTimingValues(node) { if (node instanceof Array) { node.forEach((entry, i) => node[i] = true); diff --git a/test/e2e/00_pageLoad/queryTrackedDomainList/www.example1.com.html b/test/e2e/00_pageLoad/queryTrackedDomainList/www.example1.com.html new file mode 100644 index 000000000..d1b168069 --- /dev/null +++ b/test/e2e/00_pageLoad/queryTrackedDomainList/www.example1.com.html @@ -0,0 +1,19 @@ + + + + + pageLoad test + + + + Test url domain in queryTrackedDomainList + + + + + + + + diff --git a/test/e2e/00_pageLoad/queryTrackedDomainList/www.example2.com.html b/test/e2e/00_pageLoad/queryTrackedDomainList/www.example2.com.html new file mode 100644 index 000000000..ccc3a955c --- /dev/null +++ b/test/e2e/00_pageLoad/queryTrackedDomainList/www.example2.com.html @@ -0,0 +1,19 @@ + + + + + pageLoad test + + + + Test url domain not in queryTrackedDomainList + + + + + + + + diff --git a/test/e2e/00_pageLoad/queryTrackedDomainList/www.exampleWithRedactionCase.com.html b/test/e2e/00_pageLoad/queryTrackedDomainList/www.exampleWithRedactionCase.com.html new file mode 100644 index 000000000..74ff2d09b --- /dev/null +++ b/test/e2e/00_pageLoad/queryTrackedDomainList/www.exampleWithRedactionCase.com.html @@ -0,0 +1,21 @@ + + + + + pageLoad test + + + + Test url in queryTrackedDomainList and with redacted secret and fragment. + + + + + + + +