diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-02-14 18:43:28 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-14 18:43:28 +0900 |
commit | a48915d4e090378a672d780b2fbc93e1af6e082c (patch) | |
tree | 2e6a4295935577c5e0facbb3f5d569893bf28afe /e2e/contents/tab.test.js | |
parent | 5412584a7c453d074dca6d58814e29590085ff73 (diff) | |
parent | f63920e25e80ca0e472d3514fd56e27fbc505e6f (diff) |
Merge pull request #329 from ueokande/e2e-test
End-to-End testing
Diffstat (limited to 'e2e/contents/tab.test.js')
-rw-r--r-- | e2e/contents/tab.test.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/e2e/contents/tab.test.js b/e2e/contents/tab.test.js new file mode 100644 index 0000000..198bf0a --- /dev/null +++ b/e2e/contents/tab.test.js @@ -0,0 +1,48 @@ +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; + + before(() => { + return windows.create().then((win) => { + targetWindow = win; + }); + }); + + after(() => { + return windows.remove(targetWindow.id); + }); + + describe('press d', () => { + it('deletes tab', () => { + return tabs.create(targetWindow.id, SERVER_URL).then((tab) => { + return keys.press(tab.id, 'd'); + }).then(() => { + return windows.get(targetWindow.id); + }).then((after) => { + expect(after.tabs).to.have.lengthOf(1); + }); + }); + }); + + describe('press zd', () => { + it('duplicates tab', () => { + let targetTab = 0; + return tabs.create(targetWindow.id, SERVER_URL).then((tab) => { + targetTab = tab; + return keys.press(targetTab.id, 'z'); + }).then(() => { + return keys.press(targetTab.id, 'd'); + }).then(() => { + return windows.get(targetWindow.id); + }).then((after) => { + expect(after.tabs).to.have.lengthOf(3); + }); + }); + }) +}); |