diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-12-21 15:08:07 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-12-21 17:12:15 +0900 |
commit | ab58c5edb79b4a5aa347e80deaeb612216a9d34e (patch) | |
tree | fd28899de0a1a1558961fef105f9a842376b94cf /e2e | |
parent | 493ffc83b01bfbae5f84c66f4db0cc4e1f90a588 (diff) |
Add numeric prefix to repeat a command
Diffstat (limited to 'e2e')
-rw-r--r-- | e2e/repeat_n_times.test.ts | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/e2e/repeat_n_times.test.ts b/e2e/repeat_n_times.test.ts new file mode 100644 index 0000000..d28f3c9 --- /dev/null +++ b/e2e/repeat_n_times.test.ts @@ -0,0 +1,60 @@ +import * as path from 'path'; +import * as assert from 'assert'; + +import TestServer from './lib/TestServer'; +import eventually from './eventually'; +import { Builder, Lanthan } from 'lanthan'; +import { WebDriver } from 'selenium-webdriver'; +import Page from './lib/Page'; + +describe("tab test", () => { + let server = new TestServer().receiveContent('/', + `<!DOCTYPE html><html lang="en"><body style="width:10000px; height:10000px"></body></html>`, + ); + let lanthan: Lanthan; + let webdriver: WebDriver; + let browser: any; + + before(async() => { + lanthan = await Builder + .forBrowser('firefox') + .spyAddon(path.join(__dirname, '..')) + .build(); + webdriver = lanthan.getWebDriver(); + browser = lanthan.getWebExtBrowser(); + await server.start(); + + browser = browser; + }); + + after(async() => { + await server.stop(); + if (lanthan) { + await lanthan.quit(); + } + }); + + it('repeats scroll 3-times', async () => { + let page = await Page.navigateTo(webdriver, server.url()); + await page.sendKeys('3', 'j'); + + let scrollY = await page.getScrollY(); + assert.strictEqual(scrollY, 64 * 3); + }); + + it('repeats tab deletion 3-times', async () => { + let win = await browser.windows.create({ url: server.url('/#0') }); + for (let i = 1; i < 5; ++i) { + await browser.tabs.create({ url: server.url('/#' + i), windowId: win.id }); + await webdriver.navigate().to(server.url('/#' + i)); + } + + let page = await Page.navigateTo(webdriver, server.url()); + await page.sendKeys('3', 'd'); + + await eventually(async() => { + let current = await browser.tabs.query({ windowId: win.id }); + assert.strictEqual(current.length, 2); + }); + }); +}); |