aboutsummaryrefslogtreecommitdiff
path: root/e2e/contents
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-06-17 15:37:13 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-06-17 15:37:13 +0900
commitd6dc869d1f785b628b193d69e698602bbe83a787 (patch)
treefc16176bbce43af0a82a5047bc2d13730a31213b /e2e/contents
parentf1be4fa0a87dbd63647a51d44e55f52efa3d1696 (diff)
Rewrite e2e tests with await/async
Diffstat (limited to 'e2e/contents')
-rw-r--r--e2e/contents/zoom.test.js78
1 files changed, 29 insertions, 49 deletions
diff --git a/e2e/contents/zoom.test.js b/e2e/contents/zoom.test.js
index c7efc93..2d90e28 100644
--- a/e2e/contents/zoom.test.js
+++ b/e2e/contents/zoom.test.js
@@ -7,64 +7,44 @@ describe("zoom test", () => {
let targetWindow;
let targetTab;
- before(() => {
- return windows.create(CLIENT_URL).then((win) => {
- targetWindow = win;
- });
+ before(async () => {
+ targetWindow = await windows.create(CLIENT_URL);
});
- after(() => {
- return windows.remove(targetWindow.id);
+ after(async () => {
+ await windows.remove(targetWindow.id);
});
- beforeEach(() => {
- return tabs.create(targetWindow.id, CLIENT_URL).then((tab) => {
- targetTab = tab;
- });
+ beforeEach(async () => {
+ targetTab = await tabs.create(targetWindow.id, CLIENT_URL);
});
- it('zooms-in by zi', () => {
- let before;
- return tabs.getZoom(targetTab.id).then((zoom) => {
- before = zoom;
- return keys.press(targetTab.id, 'z');
- }).then(() => {
- return keys.press(targetTab.id, 'i');
- }).then(() => {
- return tabs.getZoom(targetTab.id);
- }).then((actual) => {
- expect(actual).to.be.greaterThan(before);
- });
+ it('zooms-in by zi', async () => {
+ let before = await tabs.getZoom(targetTab.id);
+ await keys.press(targetTab.id, 'z');
+ await keys.press(targetTab.id, 'i');
+
+ let actual = await tabs.getZoom(targetTab.id);
+ expect(actual).to.be.greaterThan(before);
});
- it('zooms-in by zo', () => {
- let before;
- return tabs.getZoom(targetTab.id).then((zoom) => {
- before = zoom;
- return keys.press(targetTab.id, 'z');
- }).then(() => {
- return keys.press(targetTab.id, 'o');
- }).then(() => {
- return tabs.getZoom(targetTab.id);
- }).then((actual) => {
- expect(actual).to.be.lessThan(before);
- });
+ it('zooms-in by zo', async () => {
+ let before = await tabs.getZoom(targetTab.id);
+ await keys.press(targetTab.id, 'z');
+ await keys.press(targetTab.id, 'o');
+
+ let actual = await tabs.getZoom(targetTab.id);
+ expect(actual).to.be.lessThan(before);
});
- it('zooms-in by zz', () => {
- let before;
- tabs.setZoom(targetTab.id, 1.5).then(() => {
- return tabs.getZoom(targetTab.id);
- }).then((zoom) => {
- before = zoom;
- return keys.press(targetTab.id, 'z');
- }).then(() => {
- return keys.press(targetTab.id, 'z');
- }).then(() => {
- return tabs.getZoom(targetTab.id);
- }).then((actual) => {
- expect(actual).to.be.lessThan(before);
- expect(actual).to.be.be(1);
- });
+ it('zooms-in by zz', async () => {
+ await tabs.setZoom(targetTab.id, 1.5);
+ let before = await tabs.getZoom(targetTab.id);
+ await keys.press(targetTab.id, 'z');
+ await keys.press(targetTab.id, 'z');
+
+ let actual = await tabs.getZoom(targetTab.id);
+ expect(actual).to.be.lessThan(before);
+ expect(actual).to.equal(1);
});
});