-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WORLDSERVICE-122: Cypress E2E tests for ATI Analytics #12412
base: latest
Are you sure you want to change the base?
Conversation
…ed content on articles
}; | ||
|
||
export const assertFeaturesAnalysisComponentClick = () => { | ||
it.skip('should send a click event for the Features & Analysis component', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO try to fix this 🤷♀️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #12421 (need to check what the implications are of this fix)
cypress/e2e/specialFeatures/atiAnalytics/assertions/featuresAnalysis.js
Outdated
Show resolved
Hide resolved
const assertATIPageViewEventParamsExist = ({ | ||
params, | ||
contentType, | ||
applicationType, | ||
}) => { | ||
expect(params).to.have.property('s'); // destination | ||
expect(params).to.have.property('s2'); // producer | ||
expect(params).to.have.property('p'); // page identifier | ||
expect(params).to.have.property('x2'); // application type | ||
expect(params).to.have.property('x3'); // application name | ||
expect(params).to.have.property('x4'); // language | ||
expect(params).to.have.property('x7'); // content type | ||
expect(params).to.have.property('x8'); // library version | ||
expect(params).to.have.property('x9'); // page title | ||
|
||
if (['responsive', 'amp'].includes(applicationType)) { | ||
expect(params).to.have.property('r'); // screen resolution & colour depth | ||
expect(params).to.have.property('re'); // browser/viewport resolution | ||
expect(params).to.have.property('hl'); // timestamp | ||
expect(params).to.have.property('lng'); // device language | ||
expect(params).to.have.property('x5'); // url | ||
} | ||
|
||
if (contentType !== 'list-datadriven') { | ||
expect(params).to.have.property('x1'); // content ID | ||
} | ||
|
||
if (contentType === 'article') { | ||
expect(params).to.have.property('x11'); // first published | ||
expect(params).to.have.property('x12'); // last published | ||
expect(params).to.have.property('x13'); // ldp things | ||
expect(params).to.have.property('x17'); // category | ||
} | ||
}; | ||
|
||
const assertATIComponentViewEventParamsExist = params => { | ||
expect(params).to.have.property('s'); // destination | ||
expect(params).to.have.property('s2'); // producer | ||
expect(params).to.have.property('p'); // page identifier | ||
expect(params).to.have.property('ati'); // view event | ||
expect(params).to.have.property('type'); | ||
expect(params.type).to.equal('AT', 'params.type'); | ||
}; | ||
|
||
const assertATIComponentClickEventParamsExist = params => { | ||
expect(params).to.have.property('s'); // destination | ||
expect(params).to.have.property('s2'); // producer | ||
expect(params).to.have.property('p'); // page identifier | ||
expect(params).to.have.property('atc'); // click event | ||
expect(params).to.have.property('type'); | ||
expect(params.type).to.equal('AT', 'params.type'); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for reviewers: I've added a tests to assert that the query params exist, but we are not asserting on the values as they are often dynamic (and the value of adding them is low).
Resolves JIRA https://jira.dev.bbc.co.uk/browse/WORLDSERVICE-122
Overall changes
Allows us to test ATI analytics events are being fired as expected from all page types, especially the lite site (where we are enabling click tracking as part of #12360)
Code changes
Testing
CYPRESS_APP_ENV=test cypress run --spec './cypress/e2e/specialFeatures/atiAnalytics/*'
Expected Failing tests (as the attribute has been added in this PR):
CYPRESS_APP_ENV=live cypress run --spec './cypress/e2e/specialFeatures/atiAnalytics/*'
Expected Failing tests (as the attribute has been added in this PR):
See test output here: https://github.com/bbc/simorgh/actions/runs/13389554089/job/37393937077?pr=12412 - search for specialFeatures/atiAnalytics