Background
- Now that the session length instrument is implemented with https://phabricator.wikimedia.org/T383422, we want to use it in RelatedArticles after users are bucketed
The stream used by this instrument will be created in https://phabricator.wikimedia.org/T380926
User story
- As the web team, we need data from our A/B test to make the most informed decision
Requirements
- Events are fired for session length based off the spec
BDD
Feature: Verify session length events for search recommendations
Scenario: Events fire for bucketed users
Given a user is bucketed into the A/B test for RelatedArticles
When the user interacts with search recommendations
Then events should fire as per the specification
Scenario: Events do not fire for non-bucketed users
Given a user is not bucketed into the A/B test for RelatedArticles
When the user interacts with search recommendations
Then no events should fire for session lengthTest Steps
Test Case 1: Verify events for bucketed users
- Open an incognito window and visit https://en.m.wikipedia.beta.wmflabs.org/w/index.php?title=T352930.
- Use the following code in the JavaScript console as a logged-in user:
mw.loader.using( 'mediawiki.api' ).then( function () {
new mw.Api().saveOption( 'eventlogging-display-console', '1' );
} );- Interact with search recommendations (e.g., open the search bar, click a recommendation).
- Monitor the browser console for session length events.
- Verify that the events are firing correctly and include relevant fields as per the spec.
- AC1: Events fire for bucketed users and contain required fields.
Test Case 2: Verify no events for non-bucketed users
- Open an incognito window and visit https://en.m.wikipedia.beta.wmflabs.org/w/index.php?title=T352930.
- Use the same JavaScript code in the console as a logged-in user:
mw.loader.using( 'mediawiki.api' ).then( function () {
new mw.Api().saveOption( 'eventlogging-display-console', '1' );
} );- Confirm that you are not bucketed into the A/B test (e.g., no search recommendations appear).
- Perform similar interactions as in Test Case 1.
- Verify that no session length events are fired in the browser console.
- AC2: No events fire for non-bucketed users.
Design
- none
Acceptance criteria
- Instrumentation fires for each item in the spec and with the correct fields
Communication criteria - does this need an announcement or discussion?
- no
QA Results - Beta
| AC | Status | Details |
|---|---|---|
| 1 | ✅ | T381604#10494965 |
| 2 | ✅ | T381604#10494965 |
