aboutsummaryrefslogtreecommitdiff
path: root/e2e/blacklist.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'e2e/blacklist.test.js')
-rw-r--r--e2e/blacklist.test.js37
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);
});
});