diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-09-21 15:32:30 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-09-21 16:33:14 +0900 |
commit | 4d36a203c09d2e04bf4304ba4a5b63f66b3e2adf (patch) | |
tree | 780d19a0f13041e20206925a3c2c4d12ee53fa54 /e2e/blacklist.test.js | |
parent | 0fc2eea7431649f85c6e5d57cca66457f24bb14d (diff) |
Use latest lanthan
Diffstat (limited to 'e2e/blacklist.test.js')
-rw-r--r-- | e2e/blacklist.test.js | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/e2e/blacklist.test.js b/e2e/blacklist.test.js index fa8e8db..8a8996e 100644 --- a/e2e/blacklist.test.js +++ b/e2e/blacklist.test.js @@ -1,8 +1,9 @@ const express = require('express'); -const lanthan = require('lanthan'); const path = require('path'); const assert = require('assert'); const settings = require('./settings'); +const { Builder } = require('lanthan'); +const { By } = require('selenium-webdriver'); const newApp = () => { let app = express(); @@ -19,26 +20,24 @@ describe("navigate test", () => { const port = 12321; let http; - let firefox; - let session; + let lanthan; + let webdriver; let browser; before(async() => { http = newApp().listen(port); - firefox = await lanthan.firefox({ - spy: path.join(__dirname, '..'), - builderf: (builder) => { - builder.addFile('build/settings.js'); - }, - }); - session = firefox.session; - browser = firefox.browser; + lanthan = await Builder + .forBrowser('firefox') + .spyAddon(path.join(__dirname, '..')) + .build(); + webdriver = lanthan.getWebDriver(); + browser = lanthan.getWebExtBrowser(); }); after(async() => { - if (firefox) { - await firefox.close(); + if (lanthan) { + await lanthan.quit(); } http.close(); }); @@ -56,21 +55,21 @@ describe("navigate test", () => { }, }); - await session.navigateTo(`http://127.0.0.1:${port}/a`); + await webdriver.navigate().to(`http://127.0.0.1:${port}/a`); - let body = await session.findElementByCSS('body'); + let body = await webdriver.findElement(By.css('body')); await body.sendKeys('j'); // not works - let pageYOffset = await session.executeScript(() => window.pageYOffset); + let pageYOffset = await webdriver.executeScript(() => window.pageYOffset); assert.equal(pageYOffset, 0); - await session.navigateTo(`http://127.0.0.1:${port}/ab`); - body = await session.findElementByCSS('body'); + await webdriver.navigate().to(`http://127.0.0.1:${port}/ab`); + body = await webdriver.findElement(By.css('body')); await body.sendKeys('j'); // works - pageYOffset = await session.executeScript(() => window.pageYOffset); + pageYOffset = await webdriver.executeScript(() => window.pageYOffset); assert.equal(pageYOffset, 64); }); }); |