Skip to content

Commit

Permalink
Make AnimatedMock instantly complete spring and timing animations
Browse files Browse the repository at this point in the history
Summary:
Some MP E2E tests started failing when I introduced AnimatedMock (D13811035) with this error:

> message: Timeout exception: Message: element located by locator {"id":"mp_your_items_tab_button"} is not visible

The test relied on the button to animate in, which AnimatedMock disabled. The fix is to complete animations instantly in AnimatedMock. This diff implements that for spring and timing.

Reviewed By: cpojer

Differential Revision: D14036172

fbshipit-source-id: 18a422ce8ef6de05ff9224c94214524511a76949
  • Loading branch information
Peter Argany authored and facebook-github-bot committed Feb 12, 2019
1 parent e2bd7db commit 2d86d38
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Libraries/Animated/src/AnimatedMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,28 @@ const spring = function(
value: AnimatedValue | AnimatedValueXY,
config: SpringAnimationConfig,
): CompositeAnimation {
return emptyAnimation;
const anyValue: any = value;
return {
...emptyAnimation,
start: (callback?: ?EndCallback): void => {
anyValue.setValue(config.toValue);
callback && callback({finished: true});
},
};
};

const timing = function(
value: AnimatedValue | AnimatedValueXY,
config: TimingAnimationConfig,
): CompositeAnimation {
return emptyAnimation;
const anyValue: any = value;
return {
...emptyAnimation,
start: (callback?: ?EndCallback): void => {
anyValue.setValue(config.toValue);
callback && callback({finished: true});
},
};
};

const decay = function(
Expand Down

0 comments on commit 2d86d38

Please sign in to comment.