From 4d36a203c09d2e04bf4304ba4a5b63f66b3e2adf Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sat, 21 Sep 2019 15:32:30 +0900 Subject: Use latest lanthan --- e2e/blacklist.test.js | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'e2e/blacklist.test.js') 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); }); }); -- cgit v1.2.3