Make navigate e2e test stable

jh-changes
Shin'ya Ueoka 6 years ago
parent ac1c383fd0
commit 0b558cc523
  1. 25
      e2e/navigate.test.js

@ -71,15 +71,24 @@ describe("navigate test", () => {
http.close(); http.close();
}); });
beforeEach(async() => {
let tabs = await browser.tabs.query({});
for (let tab of tabs.slice(1)) {
await browser.tabs.remove(tab.id);
}
})
it('should go to parent path without hash by gu', async () => { it('should go to parent path without hash by gu', async () => {
await session.navigateTo(`http://127.0.0.1:${port}/a/b/c`); await session.navigateTo(`http://127.0.0.1:${port}/a/b/c`);
let body = await session.findElementByCSS('body'); let body = await session.findElementByCSS('body');
await body.sendKeys('g', 'u'); await body.sendKeys('g', 'u');
let tab = (await browser.tabs.query({}))[0]; await eventually(async() => {
let url = new URL(tab.url); let tab = (await browser.tabs.query({}))[0];
assert.equal(url.pathname, `/a/b/`) let url = new URL(tab.url);
assert.equal(url.pathname, `/a/b/`)
});
}); });
it('should remove hash by gu', async () => { it('should remove hash by gu', async () => {
@ -88,10 +97,12 @@ describe("navigate test", () => {
await body.sendKeys('g', 'u'); await body.sendKeys('g', 'u');
let tab = (await browser.tabs.query({}))[0]; await eventually(async() => {
let url = new URL(tab.url); let tab = (await browser.tabs.query({}))[0];
assert.equal(url.hash, '') let url = new URL(tab.url);
assert.equal(url.pathname, `/a/b/c`) assert.equal(url.hash, '')
assert.equal(url.pathname, `/a/b/c`)
});
}); });
it('should go to root path by gU', async () => { it('should go to root path by gU', async () => {