Permalink
Browse files

feat(protractor): \`Scroll.to(target)\` moves the browser view port t…

…o a specific target.

affects: serenity-js
  • Loading branch information...
jan-molak committed May 13, 2017
1 parent fe58c2a commit 48239b36c75928ae093f7da3694dd161998afd0b
@@ -7,6 +7,7 @@ export * from './evaluate';
export * from './hit';
export * from './open';
export * from './resize_browser_window';
export * from './scroll';
export * from './select';
export * from './use_angular';
export * from './wait';
@@ -0,0 +1,20 @@
import { Interaction, UsesAbilities } from '../../../serenity/screenplay';
import { BrowseTheWeb } from '../abilities/browse_the_web';
import { Target } from '../ui/target';
export class Scroll implements Interaction {
public static to(target: Target): Scroll {
return new Scroll(target);
}
performAs(actor: UsesAbilities): PromiseLike<void> {
const browseTheWeb = BrowseTheWeb.as(actor);
return browseTheWeb.actions().mouseMove(browseTheWeb.locate(this.target)).perform();
}
constructor(private target: Target) { }
toString = () => `{0} scrolls to ${this.target}`;
}

0 comments on commit 48239b3

Please sign in to comment.