Add gh/gH tests
This commit is contained in:
parent
b604a942a8
commit
bc26dbdd77
2 changed files with 31 additions and 3 deletions
2
QA.md
2
QA.md
|
@ -18,8 +18,6 @@ The behaviors of the console are tested in [Console section](#consoles).
|
||||||
|
|
||||||
- [ ] <kbd>r</kbd>: reload current tab
|
- [ ] <kbd>r</kbd>: reload current tab
|
||||||
- [ ] <kbd>R</kbd>: reload current tab without cache
|
- [ ] <kbd>R</kbd>: reload current tab without cache
|
||||||
- [ ] <kbd>g</kbd><kbd>h</kbd>: open start page on current tab
|
|
||||||
- [ ] <kbd>g</kbd><kbd>H</kbd>: open start page to new tab
|
|
||||||
|
|
||||||
#### Misc
|
#### Misc
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,11 @@ describe("zoom test", () => {
|
||||||
before(async() => {
|
before(async() => {
|
||||||
http = newApp().listen(port);
|
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, '..'));
|
await firefox.session.installAddon(path.join(__dirname, '..'));
|
||||||
session = firefox.session;
|
session = firefox.session;
|
||||||
browser = firefox.browser;
|
browser = firefox.browser;
|
||||||
|
@ -162,6 +166,32 @@ describe("zoom test", () => {
|
||||||
assert.equal(url.pathname, '/pagenation-link/11');
|
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);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue