== 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](https://docs.google.com/spreadsheets/d/1tYYRsxICotHT_uAt0gfZckHNZBmqZTKuykeUEwQSCvs/edit?gid=0#gid=0)
== 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 length
```
== Test Steps
__**Test Case 1: Verify events for bucketed users__**
1. Open an incognito window and visit https://en.m.wikipedia.beta.wmflabs.org/w/index.php?title=T352930.
2. 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' );
} );
```
3. Interact with search recommendations (e.g., open the search bar, click a recommendation).
4. Monitor the browser console for session length events.
5. Verify that the events are firing correctly and include relevant fields as per the spec.
6. **AC1**: Events fire for bucketed users and contain required fields.
__**Test Case 2: Verify no events for non-bucketed users__**
1. Open an incognito window and visit https://en.m.wikipedia.beta.wmflabs.org/w/index.php?title=T352930.
2. 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' );
} );
```
3. Confirm that you are not bucketed into the A/B test (e.g., no search recommendations appear).
4. Perform similar interactions as in Test Case 1.
5. Verify that no session length events are fired in the browser console.
6. **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