diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-09-29 01:06:01 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-29 01:06:01 +0000 |
commit | 4f4396d0a69d33541844e723cad033b0a927333b (patch) | |
tree | f3a75c0b41d8fe2b1e6ca730501e36cee5701705 /e2e/zoom.test.ts | |
parent | 0fc2eea7431649f85c6e5d57cca66457f24bb14d (diff) | |
parent | 9f0bc5732823505c91ce6b5ba3aa8e4b60ac93f6 (diff) |
Merge pull request #648 from ueokande/migrate-to-latest-lanthan
Clean E2E tests
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..396ddd2 --- /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 } from 'selenium-webdriver'; +import Page from './lib/Page'; + +describe("zoom test", () => { + let lanthan: Lanthan; + let webdriver: WebDriver; + let browser: any; + let tab: any; + let page: Page; + + before(async() => { + lanthan = await Builder + .forBrowser('firefox') + .spyAddon(path.join(__dirname, '..')) + .build(); + webdriver = lanthan.getWebDriver(); + browser = lanthan.getWebExtBrowser(); + tab = (await browser.tabs.query({}))[0] + page = await Page.currentContext(webdriver); + }); + + after(async() => { + await lanthan.quit(); + }); + + beforeEach(async() => { + await webdriver.navigate().to('about:blank'); + }); + + it('should zoom in by zi', async () => { + let before = await browser.tabs.getZoom(tab.id); + await page.sendKeys('zi'); + + 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 page.sendKeys('zo'); + + await eventually(async() => { + let actual = await browser.tabs.getZoom(tab.id); + assert.ok(before > actual); + }); + }); + + it('should reset zoom by zz', async () => { + await browser.tabs.setZoom(tab.id, 2); + await page.sendKeys('zz'); + + await eventually(async() => { + let actual = await browser.tabs.getZoom(tab.id); + assert.strictEqual(actual, 1); + }); + }); +}); + |