diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-09-22 16:13:12 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-09-22 16:13:12 +0900 |
commit | 7e77e31ad64c3649888eae337e0c984fd9c2ea2a (patch) | |
tree | 4d3e630f82712abce5afd7e498d514253464a6ea /e2e/zoom.test.ts | |
parent | 91f8383ecc2f7ef3f95173ad973a74f79e277a6c (diff) |
Migrate e2e tests to TypeScript
Diffstat (limited to 'e2e/zoom.test.ts')
-rw-r--r-- | e2e/zoom.test.ts | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/e2e/zoom.test.ts b/e2e/zoom.test.ts new file mode 100644 index 0000000..0b55a4d --- /dev/null +++ b/e2e/zoom.test.ts @@ -0,0 +1,65 @@ +import * as path from 'path'; +import * as assert from 'assert'; + +import eventually from './eventually'; +import { Builder, Lanthan } from 'lanthan'; +import { WebDriver, WebElement, By } from 'selenium-webdriver'; + + +describe("zoom test", () => { + let lanthan: Lanthan; + let webdriver: WebDriver; + let browser: any; + let tab: any; + let body: WebElement; + + before(async() => { + lanthan = await Builder + .forBrowser('firefox') + .spyAddon(path.join(__dirname, '..')) + .build(); + webdriver = lanthan.getWebDriver(); + browser = lanthan.getWebExtBrowser(); + tab = (await browser.tabs.query({}))[0] + }); + + after(async() => { + await lanthan.quit(); + }); + + beforeEach(async() => { + await webdriver.navigate().to('about:blank'); + body = await webdriver.findElement(By.css('body')); + }); + + it('should zoom in by zi', async () => { + let before = await browser.tabs.getZoom(tab.id); + await body.sendKeys('z', 'i'); + + await eventually(async() => { + let actual = await browser.tabs.getZoom(tab.id); + assert.ok(before < actual); + }); + }); + + it('should zoom out by zo', async () => { + let before = await browser.tabs.getZoom(tab.id); + await body.sendKeys('z', 'o'); + + await eventually(async() => { + let actual = await browser.tabs.getZoom(tab.id); + assert.ok(before > actual); + }); + }); + + it('scrolls left by h', async () => { + await browser.tabs.setZoom(tab.id, 2); + await body.sendKeys('z', 'z'); + + await eventually(async() => { + let actual = await browser.tabs.getZoom(tab.id); + assert.ok(actual === 1); + }); + }); +}); + |