aboutsummaryrefslogtreecommitdiff
path: root/e2e/contents/tab.test.js
blob: dda572fe05d2008b1e1e1e70024e6e8022cf9093 (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
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("tab test", () => {
  let targetWindow;
  let targetTab;

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

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

  it('delete tab', () => {
    return Promise.resolve().then(() => {
      return keys.press(targetTab.id, 'd');
    }).then(() => {
      return windows.get(targetWindow.id);
    }).then((after) => {
      expect(after.tabs).to.have.lengthOf(1);
    });
  });
});