diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-04-06 23:13:13 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-04-06 23:13:13 +0900 |
commit | bc26dbdd77b4f9dce7505cd6e78b9161dbc5d928 (patch) | |
tree | c81bb0361128eae6fb6379ee3f8507529dd53b86 /e2e/navigate.test.js | |
parent | b604a942a84d7c5d54029b48ae698d15ffe4f5ac (diff) |
Add gh/gH tests
Diffstat (limited to 'e2e/navigate.test.js')
-rw-r--r-- | e2e/navigate.test.js | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/e2e/navigate.test.js b/e2e/navigate.test.js index 089fa56..70d45ce 100644 --- a/e2e/navigate.test.js +++ b/e2e/navigate.test.js @@ -45,7 +45,11 @@ describe("zoom test", () => { before(async() => { http = newApp().listen(port); - firefox = await lanthan.firefox(); + firefox = await lanthan.firefox({ + prefs: { + 'browser.startup.homepage': `http://127.0.0.1:${port}#home`, + } + }); await firefox.session.installAddon(path.join(__dirname, '..')); session = firefox.session; browser = firefox.browser; @@ -162,6 +166,32 @@ describe("zoom test", () => { assert.equal(url.pathname, '/pagenation-link/11'); }); }); + + it('should go to home page into current tab by gh', async () => { + await session.navigateTo(`http://127.0.0.1:${port}`); + let body = await session.findElementByCSS('body'); + await body.sendKeys('g', 'h'); + + await eventually(async() => { + let tab = (await browser.tabs.query({}))[0]; + let url = new URL(tab.url); + assert.equal(url.hash, '#home'); + }); + }); + + it('should go to home page into current tab by gH', async () => { + await session.navigateTo(`http://127.0.0.1:${port}`); + let body = await session.findElementByCSS('body'); + await body.sendKeys('g', Key.Shift, 'H'); + + await eventually(async() => { + let tabs = await browser.tabs.query({}); + assert.equal(tabs.length, 2); + assert.equal(new URL(tabs[0].url).hash, ''); + assert.equal(new URL(tabs[1].url).hash, '#home'); + assert.equal(tabs[1].active, true); + }); + }); }); |