simple and stable

jh-changes
Shin'ya Ueoka 7 years ago
parent 62f73898b6
commit 30d6872fa8
  1. 30
      e2e/contents/tab.test.js

@ -18,31 +18,37 @@ describe("tab test", () => {
return windows.remove(targetWindow.id); return windows.remove(targetWindow.id);
}); });
describe('press d', () => { it('deletes tab by d', () => {
it('deletes tab', () => { let before;
let targetTab;
return tabs.create(targetWindow.id, SERVER_URL).then((tab) => { return tabs.create(targetWindow.id, SERVER_URL).then((tab) => {
return keys.press(tab.id, 'd'); targetTab = tab;
return windows.get(targetWindow.id);
}).then((win) => {
before = win;
return keys.press(targetTab.id, 'd');
}).then(() => { }).then(() => {
return windows.get(targetWindow.id); return windows.get(targetWindow.id);
}).then((after) => { }).then((actual) => {
expect(after.tabs).to.have.lengthOf(1); expect(actual.tabs).to.have.lengthOf(before.tabs.length - 1);
});
}); });
}); });
describe('press zd', () => { it('duplicates tab by zd', () => {
it('duplicates tab', () => { let before;
let targetTab = 0; let targetTab;
return tabs.create(targetWindow.id, SERVER_URL).then((tab) => { return tabs.create(targetWindow.id, SERVER_URL).then((tab) => {
targetTab = tab; targetTab = tab;
return windows.get(targetWindow.id)
}).then((win) => {;
before = win;
return keys.press(targetTab.id, 'z'); return keys.press(targetTab.id, 'z');
}).then(() => { }).then(() => {
return keys.press(targetTab.id, 'd'); return keys.press(targetTab.id, 'd');
}).then(() => { }).then(() => {
return windows.get(targetWindow.id); return windows.get(targetWindow.id);
}).then((after) => { }).then((actual) => {
expect(after.tabs).to.have.lengthOf(3); expect(actual.tabs).to.have.lengthOf(before.tabs.length + 1);
});
}); });
}) })
}); });