Make navigate e2e test stable
This commit is contained in:
parent
ac1c383fd0
commit
0b558cc523
1 changed files with 18 additions and 7 deletions
|
@ -71,16 +71,25 @@ 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');
|
||||||
|
|
||||||
|
await eventually(async() => {
|
||||||
let tab = (await browser.tabs.query({}))[0];
|
let tab = (await browser.tabs.query({}))[0];
|
||||||
let url = new URL(tab.url);
|
let url = new URL(tab.url);
|
||||||
assert.equal(url.pathname, `/a/b/`)
|
assert.equal(url.pathname, `/a/b/`)
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should remove hash by gu', async () => {
|
it('should remove hash by gu', async () => {
|
||||||
await session.navigateTo(`http://127.0.0.1:${port}/a/b/c#hash`);
|
await session.navigateTo(`http://127.0.0.1:${port}/a/b/c#hash`);
|
||||||
|
@ -88,11 +97,13 @@ describe("navigate test", () => {
|
||||||
|
|
||||||
await body.sendKeys('g', 'u');
|
await body.sendKeys('g', 'u');
|
||||||
|
|
||||||
|
await eventually(async() => {
|
||||||
let tab = (await browser.tabs.query({}))[0];
|
let tab = (await browser.tabs.query({}))[0];
|
||||||
let url = new URL(tab.url);
|
let url = new URL(tab.url);
|
||||||
assert.equal(url.hash, '')
|
assert.equal(url.hash, '')
|
||||||
assert.equal(url.pathname, `/a/b/c`)
|
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 () => {
|
||||||
await session.navigateTo(`http://127.0.0.1:${port}/a/b/c#hash`);
|
await session.navigateTo(`http://127.0.0.1:${port}/a/b/c#hash`);
|
||||||
|
|
Reference in a new issue