From ffd1018fa73eef644b170485cc9bd477e21804e7 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Wed, 14 Feb 2018 21:48:19 +0900 Subject: add scroll test --- e2e/ambassador/src/content/scrolls.js | 2 ++ e2e/contents/scroll.test.js | 48 +++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/e2e/ambassador/src/content/scrolls.js b/e2e/ambassador/src/content/scrolls.js index 79be01d..4227cf7 100644 --- a/e2e/ambassador/src/content/scrolls.js +++ b/e2e/ambassador/src/content/scrolls.js @@ -5,6 +5,8 @@ const get = () => { yMax: element.scrollHeight - element.clientHeight, x: element.scrollLeft, y: element.scrollTop, + frameWidth: element.clientWidth, + frameHeight: element.clientHeight, }; }; diff --git a/e2e/contents/scroll.test.js b/e2e/contents/scroll.test.js index da14f76..070529a 100644 --- a/e2e/contents/scroll.test.js +++ b/e2e/contents/scroll.test.js @@ -100,4 +100,52 @@ describe("scroll test", () => { expect(actual.x).to.be.equals(actual.xMax); }); }); + + it('scrolls bottom by ', () => { + let before + return scrolls.set(targetTab.id, 5000, 5000).then((scroll) => { + before = scroll; + return keys.press(targetTab.id, 'u', { ctrlKey: true }); + }).then(() => { + return scrolls.get(targetTab.id); + }).then((actual) => { + expect(actual.y).to.closeTo(before.y - before.frameHeight / 2, 1); + }); + }); + + it('scrolls bottom by ', () => { + let before + return scrolls.set(targetTab.id, 5000, 5000).then((scroll) => { + before = scroll; + return keys.press(targetTab.id, 'd', { ctrlKey: true }); + }).then(() => { + return scrolls.get(targetTab.id); + }).then((actual) => { + expect(actual.y).to.closeTo(before.y + before.frameHeight / 2, 1); + }); + }); + + it('scrolls bottom by ', () => { + let before + return scrolls.set(targetTab.id, 5000, 5000).then((scroll) => { + before = scroll; + return keys.press(targetTab.id, 'b', { ctrlKey: true }); + }).then(() => { + return scrolls.get(targetTab.id); + }).then((actual) => { + expect(actual.y).to.equals(before.y - before.frameHeight); + }); + }); + + it('scrolls bottom by ', () => { + let before + return scrolls.set(targetTab.id, 5000, 5000).then((scroll) => { + before = scroll; + return keys.press(targetTab.id, 'f', { ctrlKey: true }); + }).then(() => { + return scrolls.get(targetTab.id); + }).then((actual) => { + expect(actual.y).to.equals(before.y + before.frameHeight); + }); + }); }); -- cgit v1.2.3