diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-05-12 23:21:16 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-05-13 01:01:10 +0900 |
commit | 82aad419a74a3061247d4e82656fa711e63f213c (patch) | |
tree | d2b435195ef3d1ca27444739e836bf66a19a9565 /e2e/contents | |
parent | c6c885345e212bedc2723e9105488d3e5fe9f8be (diff) |
Add navigate test
Diffstat (limited to 'e2e/contents')
-rw-r--r-- | e2e/contents/navigate.test.js | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/e2e/contents/navigate.test.js b/e2e/contents/navigate.test.js new file mode 100644 index 0000000..518c3e3 --- /dev/null +++ b/e2e/contents/navigate.test.js @@ -0,0 +1,63 @@ +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 * as scrolls from "../ambassador/src/client/scrolls"; + +const SERVER_URL = "http://localhost:11111"; + +describe("navigate test", () => { + let targetWindow; + + before(() => { + return windows.create().then((win) => { + targetWindow = win; + return tabs.create(targetWindow.id, SERVER_URL); + }); + }); + + after(() => { + return windows.remove(targetWindow.id); + }); + + it('goes to parent', () => { + let targetTab; + return tabs.create(targetWindow.id, SERVER_URL + '/a/b/c').then((tab) => { + targetTab = tab; + return keys.press(targetTab.id, 'g'); + }).then(() => { + return keys.press(targetTab.id, 'u'); + }).then(() => { + return tabs.get(targetTab.id); + }).then((tab) => { + expect(tab.url).to.be.equal(SERVER_URL + '/a/b/'); + }); + }); + + it('removes hash', () => { + let targetTab; + return tabs.create(targetWindow.id, SERVER_URL + '/a/b/c#navigate').then((tab) => { + targetTab = tab; + return keys.press(targetTab.id, 'g'); + }).then(() => { + return keys.press(targetTab.id, 'u'); + }).then(() => { + return tabs.get(targetTab.id); + }).then((tab) => { + expect(tab.url).to.be.equal(SERVER_URL + '/a/b/c#'); + }); + }); + + it('goes to root', () => { + let targetTab; + return tabs.create(targetWindow.id, SERVER_URL + '/a/b/c').then((tab) => { + targetTab = tab; + return keys.press(targetTab.id, 'g'); + }).then(() => { + return keys.press(targetTab.id, 'U', { shiftKey: true }); + }).then(() => { + return tabs.get(targetTab.id); + }).then((tab) => { + expect(tab.url).to.be.equal(SERVER_URL + '/'); + }); + }); +}); |