ampproject / ampproject/amphtml
amp-story: unit tests fail when "reduce-motion" setting is enabled.
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Description
`npx amp unit --files=extensions/amp-story/1.0/amp-story.js` fails when reduce motion is enabled. I believe this is because it is the only codepath that utilizes the Performance service which needs to be stubbed.
Error:
```
ERROR: '_service.Services.performanceFor(...).addEnabledExperiment is not a function [object HTMLElement]'
```
Source:
https://github.com/ampproject/amphtml/blob/e16bbdaa94c2148ab8126238c26023ff5767675e/extensions/amp-story/1.0/amp-story.js#L456-L463
### Reproduction Steps
1. Enable "Reduced motion" in accessibility settings of your OS
2. Run any amp story unit tests
cc @ampproject/wg-stories
Contributor guide
Research direction
Start with extensions/amp-story/1.0/amp-story.js at the referenced lines and run `npx amp unit --files=extensions/amp-story/1.0/amp-story.js` with reduced motion enabled. Trace the Performance service use and its test setup; done means the AMP story unit tests pass without the addEnabledExperiment error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100