diff --git a/components/MetaData.tsx b/components/MetaData.tsx
index b29811b5c..87a779f7d 100644
--- a/components/MetaData.tsx
+++ b/components/MetaData.tsx
@@ -60,17 +60,20 @@ const MetaData = ({ language, data }: MetaDataProps) => {
- {process.env.ENVIRONMENT === 'production' ? (
-
- ) : (
-
- )}
+ {
+ // AA script must be loaded before the pageLoad event fires
+ process.env.ENVIRONMENT === 'production' ? (
+
+ ) : (
+
+ )
+ }
>
)
}
diff --git a/cypress/e2e/ContactUs.cy.js b/cypress/e2e/ContactUs.cy.js
index ba057ce3a..99a24f627 100644
--- a/cypress/e2e/ContactUs.cy.js
+++ b/cypress/e2e/ContactUs.cy.js
@@ -2,6 +2,11 @@
describe('Validate Contact Us Landing page', () => {
beforeEach(() => {
+ cy.intercept({
+ method: 'GET',
+ hostname: 'assets.adobedtm.com',
+ path: /.*\/launch-.*/,
+ }).as('adobeAnalytics')
cy.visit('/contact-us')
})
@@ -45,4 +50,10 @@ describe('Validate Contact Us Landing page', () => {
cy.location('pathname', { timeout: 10000 })
.should('equal', '/en/contact-us')
})
+
+ it('Validate there is exactly one copy of the AA script and it was only loaded once', () => {
+ cy.get('@adobeAnalytics.all').its('length').should('eq', 1)
+ cy.get('script[src*="adobedtm"]').filter('[src*="launch-"]').as('analyticsScript')
+ cy.get('@analyticsScript').its('length').should('eq', 1)
+ })
})
diff --git a/cypress/e2e/ContactUsCPP.cy.js b/cypress/e2e/ContactUsCPP.cy.js
index 1ec38c355..9b4d41355 100644
--- a/cypress/e2e/ContactUsCPP.cy.js
+++ b/cypress/e2e/ContactUsCPP.cy.js
@@ -3,6 +3,11 @@
describe('Validate Contact Canada Pension Plan page', () => {
beforeEach(() => {
+ cy.intercept({
+ method: 'GET',
+ hostname: 'assets.adobedtm.com',
+ path: /.*\/launch-.*/,
+ }).as('adobeAnalytics')
cy.visit('/contact-us/contact-canada-pension-plan')
})
@@ -79,4 +84,10 @@ describe('Validate Contact Canada Pension Plan page', () => {
})
})
+ it('Validate there is exactly one copy of the AA script and it was only loaded once', () => {
+ cy.get('@adobeAnalytics.all').its('length').should('eq', 1)
+ cy.get('script[src*="adobedtm"]').filter('[src*="launch-"]').as('analyticsScript')
+ cy.get('@analyticsScript').its('length').should('eq', 1)
+ })
+
})
\ No newline at end of file
diff --git a/cypress/e2e/ContactUsEI.cy.js b/cypress/e2e/ContactUsEI.cy.js
index 2244e635d..8d1cb5848 100644
--- a/cypress/e2e/ContactUsEI.cy.js
+++ b/cypress/e2e/ContactUsEI.cy.js
@@ -3,6 +3,11 @@
describe('Validate EI Contact Us Landing page', () => {
beforeEach(() => {
+ cy.intercept({
+ method: 'GET',
+ hostname: 'assets.adobedtm.com',
+ path: /.*\/launch-.*/,
+ }).as('adobeAnalytics')
cy.visit('/contact-us/contact-employment-insurance')
})
@@ -79,4 +84,10 @@ describe('Validate EI Contact Us Landing page', () => {
})
})
+ it('Validate there is exactly one copy of the AA script and it was only loaded once', () => {
+ cy.get('@adobeAnalytics.all').its('length').should('eq', 1)
+ cy.get('script[src*="adobedtm"]').filter('[src*="launch-"]').as('analyticsScript')
+ cy.get('@analyticsScript').its('length').should('eq', 1)
+ })
+
})
diff --git a/cypress/e2e/ContactUsOAS.cy.js b/cypress/e2e/ContactUsOAS.cy.js
index d32c7e067..ca4c66b7c 100644
--- a/cypress/e2e/ContactUsOAS.cy.js
+++ b/cypress/e2e/ContactUsOAS.cy.js
@@ -4,6 +4,11 @@
describe('Validate Contact Old Age Security page', () => {
beforeEach(() => {
+ cy.intercept({
+ method: 'GET',
+ hostname: 'assets.adobedtm.com',
+ path: /.*\/launch-.*/,
+ }).as('adobeAnalytics')
cy.visit('/contact-us/contact-old-age-security')
})
@@ -79,5 +84,10 @@ describe('Validate Contact Old Age Security page', () => {
.should('be.visible')
})
})
-
+
+ it('Validate there is exactly one copy of the AA script and it was only loaded once', () => {
+ cy.get('@adobeAnalytics.all').its('length').should('eq', 1)
+ cy.get('script[src*="adobedtm"]').filter('[src*="launch-"]').as('analyticsScript')
+ cy.get('@analyticsScript').its('length').should('eq', 1)
+ })
})
\ No newline at end of file
diff --git a/cypress/e2e/DecisionReviews.cy.js b/cypress/e2e/DecisionReviews.cy.js
index 37da0d5cb..c407a4b5e 100644
--- a/cypress/e2e/DecisionReviews.cy.js
+++ b/cypress/e2e/DecisionReviews.cy.js
@@ -2,6 +2,11 @@
describe('Validate Request a review of a decision page', () => {
beforeEach(() => {
+ cy.intercept({
+ method: 'GET',
+ hostname: 'assets.adobedtm.com',
+ path: /.*\/launch-.*/,
+ }).as('adobeAnalytics')
cy.visit('/en/decision-reviews')
})
it('Request a review has no detectable a11y violations on load', () => {
@@ -52,4 +57,10 @@ describe('Validate Request a review of a decision page', () => {
cy.get('[data-cy="breadcrumb-My dashboard"]').click()
cy.url().should('include', '/my-dashboard')
})
+
+ it('Validate there is exactly one copy of the AA script and it was only loaded once', () => {
+ cy.get('@adobeAnalytics.all').its('length').should('eq', 1)
+ cy.get('script[src*="adobedtm"]').filter('[src*="launch-"]').as('analyticsScript')
+ cy.get('@analyticsScript').its('length').should('eq', 1)
+ })
})
diff --git a/cypress/e2e/Login.cy.js b/cypress/e2e/Login.cy.js
index a941e39d5..85fc380ba 100644
--- a/cypress/e2e/Login.cy.js
+++ b/cypress/e2e/Login.cy.js
@@ -2,6 +2,11 @@
It does not test the authentication functionality currently since those endpoints are on prem only at this time. **/
beforeEach(() => {
+ cy.intercept({
+ method: 'GET',
+ hostname: 'assets.adobedtm.com',
+ path: /.*\/launch-.*/,
+ }).as('adobeAnalytics')
cy.visit('/auth/login')
})
@@ -36,4 +41,10 @@ describe('Validate login page', () => {
})
cy.get('[data-cy="loading-spinner"]').should('not.exist')
})
+
+ it('Validate there is exactly one copy of the AA script and it was only loaded once', () => {
+ cy.get('@adobeAnalytics.all').its('length').should('eq', 1)
+ cy.get('script[src*="adobedtm"]').filter('[src*="launch-"]').as('analyticsScript')
+ cy.get('@analyticsScript').its('length').should('eq', 1)
+ })
})
diff --git a/cypress/e2e/Profile.cy.js b/cypress/e2e/Profile.cy.js
index 9e1ad1045..51a4332c4 100644
--- a/cypress/e2e/Profile.cy.js
+++ b/cypress/e2e/Profile.cy.js
@@ -2,6 +2,11 @@
describe('Validate Profile page', () => {
beforeEach(() => {
+ cy.intercept({
+ method: 'GET',
+ hostname: 'assets.adobedtm.com',
+ path: /.*\/launch-.*/,
+ }).as('adobeAnalytics')
cy.visit('/profile')
})
@@ -142,4 +147,10 @@ describe('Validate Profile page', () => {
.and('not.have.attr', 'href', '#undefined')
})
})
+
+ it('Validate there is exactly one copy of the AA script and it was only loaded once', () => {
+ cy.get('@adobeAnalytics.all').its('length').should('eq', 1)
+ cy.get('script[src*="adobedtm"]').filter('[src*="launch-"]').as('analyticsScript')
+ cy.get('@analyticsScript').its('length').should('eq', 1)
+ })
})
diff --git a/cypress/e2e/SecuritySettings.cy.js b/cypress/e2e/SecuritySettings.cy.js
index 4d52d80a2..f945839c4 100644
--- a/cypress/e2e/SecuritySettings.cy.js
+++ b/cypress/e2e/SecuritySettings.cy.js
@@ -2,6 +2,11 @@
describe('Validate Security Settings page', () => {
beforeEach(() => {
+ cy.intercept({
+ method: 'GET',
+ hostname: 'assets.adobedtm.com',
+ path: /.*\/launch-.*/,
+ }).as('adobeAnalytics')
cy.visit('/security-settings')
})
@@ -81,4 +86,10 @@ describe('Validate Security Settings page', () => {
.should('be.visible')
.and('have.text', 'Profil')
})
+
+ it('Validate there is exactly one copy of the AA script and it was only loaded once', () => {
+ cy.get('@adobeAnalytics.all').its('length').should('eq', 1)
+ cy.get('script[src*="adobedtm"]').filter('[src*="launch-"]').as('analyticsScript')
+ cy.get('@analyticsScript').its('length').should('eq', 1)
+ })
})
diff --git a/cypress/e2e/dashboard.cy.js b/cypress/e2e/dashboard.cy.js
index fea1c00e6..7ab9324ce 100644
--- a/cypress/e2e/dashboard.cy.js
+++ b/cypress/e2e/dashboard.cy.js
@@ -2,6 +2,11 @@
describe('Validate dashboard page', () => {
beforeEach(() => {
+ cy.intercept({
+ method: 'GET',
+ hostname: 'assets.adobedtm.com',
+ path: /.*\/launch-.*/,
+ }).as('adobeAnalytics')
cy.visit('/my-dashboard')
})
@@ -369,4 +374,9 @@ describe('Validate dashboard page', () => {
})
})
+ it('Validate there is exactly one copy of the AA script and it was only loaded once', () => {
+ cy.get('@adobeAnalytics.all').its('length').should('eq', 1)
+ cy.get('script[src*="adobedtm"]').filter('[src*="launch-"]').as('analyticsScript')
+ cy.get('@analyticsScript').its('length').should('eq', 1)
+ })
})