aboutsummaryrefslogtreecommitdiff
path: root/e2e/contents/zoom.test.js
blob: 2d90e289918016b69fd233db3627f9a8fde8451f (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
import * as windows from "../ambassador/src/client/windows";
import * as tabs from "../ambassador/src/client/tabs";
import * as keys from "../ambassador/src/client/keys";
import { CLIENT_URL } from '../web-server/url';

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

  before(async () => {
    targetWindow = await windows.create(CLIENT_URL);
  });

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

  beforeEach(async () => {
    targetTab = await tabs.create(targetWindow.id, CLIENT_URL);
  });

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