aboutsummaryrefslogtreecommitdiff
path: root/e2e/command_winopen.test.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-09-21 15:32:30 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2019-09-21 16:33:14 +0900
commit4d36a203c09d2e04bf4304ba4a5b63f66b3e2adf (patch)
tree780d19a0f13041e20206925a3c2c4d12ee53fa54 /e2e/command_winopen.test.js
parent0fc2eea7431649f85c6e5d57cca66457f24bb14d (diff)
Use latest lanthan
Diffstat (limited to 'e2e/command_winopen.test.js')
-rw-r--r--e2e/command_winopen.test.js68
1 files changed, 32 insertions, 36 deletions
diff --git a/e2e/command_winopen.test.js b/e2e/command_winopen.test.js
index 536d759..149d775 100644
--- a/e2e/command_winopen.test.js
+++ b/e2e/command_winopen.test.js
@@ -1,11 +1,10 @@
const express = require('express');
-const lanthan = require('lanthan');
const path = require('path');
const assert = require('assert');
const eventually = require('./eventually');
const settings = require('./settings');
-
-const Key = lanthan.Key;
+const { Builder } = require('lanthan');
+const { By, Key } = require('selenium-webdriver');
const newApp = () => {
@@ -30,22 +29,19 @@ const newApp = () => {
describe("winopen command test", () => {
const port = 12321;
let http;
- let firefox;
- let session;
+ let lanthan;
+ let webdriver;
let browser;
let body;
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();
await browser.storage.local.set({
settings,
});
@@ -53,8 +49,8 @@ describe("winopen command test", () => {
after(async() => {
http.close();
- if (firefox) {
- await firefox.close();
+ if (lanthan) {
+ await lanthan.quit();
}
});
@@ -64,16 +60,16 @@ describe("winopen command test", () => {
await browser.windows.remove(win.id);
}
- await session.navigateTo(`http://127.0.0.1:${port}`);
- body = await session.findElementByCSS('body');
+ await webdriver.navigate().to(`http://127.0.0.1:${port}`);
+ body = await webdriver.findElement(By.css('body'));
})
it('should open default search for keywords by winopen command ', async() => {
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- input.sendKeys('winopen an apple', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ input.sendKeys('winopen an apple', Key.ENTER);
await eventually(async() => {
let wins = await browser.windows.getAll();
@@ -88,9 +84,9 @@ describe("winopen command test", () => {
it('should open certain search page for keywords by winopen command ', async() => {
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- input.sendKeys('winopen yahoo an apple', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ input.sendKeys('winopen yahoo an apple', Key.ENTER);
await eventually(async() => {
let wins = await browser.windows.getAll();
@@ -105,9 +101,9 @@ describe("winopen command test", () => {
it('should open default engine with empty keywords by winopen command ', async() => {
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- input.sendKeys('winopen', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ input.sendKeys('winopen', Key.ENTER);
await eventually(async() => {
let wins = await browser.windows.getAll();
@@ -122,9 +118,9 @@ describe("winopen command test", () => {
it('should open certain search page for empty keywords by winopen command ', async() => {
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- input.sendKeys('winopen yahoo', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ input.sendKeys('winopen yahoo', Key.ENTER);
await eventually(async() => {
let wins = await browser.windows.getAll();
@@ -139,9 +135,9 @@ describe("winopen command test", () => {
it('should open a site with domain by winopen command ', async() => {
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- input.sendKeys('winopen i-beam.org', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ input.sendKeys('winopen i-beam.org', Key.ENTER);
await eventually(async() => {
let wins = await browser.windows.getAll();
@@ -156,9 +152,9 @@ describe("winopen command test", () => {
it('should open a site with URL by winopen command ', async() => {
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- input.sendKeys('winopen https://i-beam.org', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ input.sendKeys('winopen https://i-beam.org', Key.ENTER);
await eventually(async() => {
let wins = await browser.windows.getAll();