aboutsummaryrefslogtreecommitdiff
path: root/e2e/contents/zoom.test.js
blob: 603e0b636c95db8ab91acc1754b7b0a84be37f85 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { expect } from "chai";
import * as windows from "../ambassador/src/client/windows";
import * as tabs from "../ambassador/src/client/tabs";
import * as keys from "../ambassador/src/client/keys";

const SERVER_URL = "localhost:11111/";

describe("zoom test", () => {
  let targetWindow;
  let targetTab;

  before(() => {
    return windows.create(SERVER_URL).then((win) => {
      targetWindow = win;
    });
  });

  after(() => {
    return windows.remove(targetWindow.id);
  });

  beforeEach(() => {
    return tabs.create(targetWindow.id, SERVER_URL).then((tab) => {
      targetTab = tab;
    });
  });

  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 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 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);
    });
  });
});