diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-07-27 22:20:48 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-07-27 22:20:48 +0900 |
commit | 1160cf8aedf9810a76d84e3d99a72365e8aeae8a (patch) | |
tree | 98526906950e33bcb6e06028e19a02ffe8202d52 | |
parent | 6814b7c3e4795c76fc9c0cfdc9de0a9d558d6c8c (diff) |
Fix e2e test
-rw-r--r-- | e2e/find.test.ts | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/e2e/find.test.ts b/e2e/find.test.ts index accf37b..dd5069c 100644 --- a/e2e/find.test.ts +++ b/e2e/find.test.ts @@ -41,23 +41,31 @@ describe("find test", () => { await console.execCommand("hello"); await page.switchToTop(); - let selection = await page.getSelection(); - assert.deepStrictEqual(selection, { from: 2, to: 7 }); + await eventually(async () => { + const selection = await page.getSelection(); + assert.deepStrictEqual(selection, { from: 2, to: 7 }); + }); // search next keyword await page.sendKeys("n"); - selection = await page.getSelection(); - assert.deepStrictEqual(selection, { from: 9, to: 14 }); + await eventually(async () => { + const selection = await page.getSelection(); + assert.deepStrictEqual(selection, { from: 9, to: 14 }); + }); // search previous keyword await page.sendKeys(Key.SHIFT, "N"); - selection = await page.getSelection(); - assert.deepStrictEqual(selection, { from: 2, to: 7 }); + await eventually(async () => { + const selection = await page.getSelection(); + assert.deepStrictEqual(selection, { from: 2, to: 7 }); + }); // search previous keyword by wrap-search await page.sendKeys(Key.SHIFT, "N"); - selection = await page.getSelection(); - assert.deepStrictEqual(selection, { from: 16, to: 21 }); + await eventually(async () => { + const selection = await page.getSelection(); + assert.deepStrictEqual(selection, { from: 16, to: 21 }); + }); }); it("shows error if pattern not found", async () => { @@ -66,8 +74,10 @@ describe("find test", () => { await console.execCommand("world"); await page.switchToTop(); - const selection = await page.getSelection(); - assert.deepStrictEqual(selection, { from: 0, to: 0 }); + await eventually(async () => { + const selection = await page.getSelection(); + assert.deepStrictEqual(selection, { from: 0, to: 0 }); + }); await eventually(async () => { console = await page.getConsole(); @@ -83,16 +93,20 @@ describe("find test", () => { await page.switchToTop(); await page.clearSelection(); - let selection = await page.getSelection(); - assert.deepStrictEqual(selection, { from: 0, to: 0 }); + await eventually(async () => { + const selection = await page.getSelection(); + assert.deepStrictEqual(selection, { from: 0, to: 0 }); + }); await page.sendKeys("/"); console = await page.getConsole(); await console.execCommand(""); await page.switchToTop(); - selection = await page.getSelection(); - assert.deepStrictEqual(selection, { from: 2, to: 7 }); + await eventually(async () => { + const selection = await page.getSelection(); + assert.deepStrictEqual(selection, { from: 2, to: 7 }); + }); }); it("search with last keyword on new page", async () => { @@ -102,12 +116,16 @@ describe("find test", () => { await page.switchToTop(); await page.sendKeys("n"); - let selection = await page.getSelection(); - assert.deepStrictEqual(selection, { from: 9, to: 14 }); + await eventually(async () => { + const selection = await page.getSelection(); + assert.deepStrictEqual(selection, { from: 9, to: 14 }); + }); page = await Page.navigateTo(webdriver, server.url()); await page.sendKeys("n"); - selection = await page.getSelection(); - assert.deepStrictEqual(selection, { from: 2, to: 7 }); + await eventually(async () => { + const selection = await page.getSelection(); + assert.deepStrictEqual(selection, { from: 2, to: 7 }); + }); }); }); |