Add e2e test case for history navigations

This commit is contained in:
Shin'ya Ueoka 2018-05-13 01:06:01 +09:00
parent 5617f6f765
commit e17399c4df
2 changed files with 26 additions and 1 deletions

1
QA.md
View file

@ -27,7 +27,6 @@ The behaviors of the console are tested in [Console section](#consoles).
#### Navigation
- [ ] <kbd>H</kbd>, <kbd>L</kbd>: go back and forward in history
- [ ] <kbd>[</kbd><kbd>[</kbd>, <kbd>]</kbd><kbd>]</kbd>: Open next/prev link in `<link>` tags.
- [ ] <kbd>[</kbd><kbd>[</kbd>, <kbd>]</kbd><kbd>]</kbd>: find prev and next links and open it

View file

@ -60,4 +60,30 @@ describe("navigate test", () => {
expect(tab.url).to.be.equal(SERVER_URL + '/');
});
});
it('goes back and forward in history', () => {
let targetTab;
return tabs.create(targetWindow.id, SERVER_URL + '/#navigate').then((tab) => {
targetTab = tab;
return keys.press(targetTab.id, 'g');
}).then(() => {
return keys.press(targetTab.id, 'u');
}).then(() => {
return keys.press(targetTab.id, 'H', { shiftKey: true });
}).then(() => {
return new Promise(resolve => { setTimeout(() => resolve(), 2000) });
}).then(() => {
return tabs.get(targetTab.id);
}).then((tab) => {
expect(tab.url, 'go back in history').to.be.equal(SERVER_URL + '/#navigate');
}).then(() => {
return new Promise(resolve => { setTimeout(() => resolve(), 2000) });
}).then(() => {
return keys.press(targetTab.id, 'L', { shiftKey: true });
}).then(() => {
return tabs.get(targetTab.id);
}).then((tab) => {
expect(tab.url, 'go next in history').to.be.equal(SERVER_URL + '/#');
});
});
});