aboutsummaryrefslogtreecommitdiff
path: root/e2e/command_open.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'e2e/command_open.test.js')
-rw-r--r--e2e/command_open.test.js67
1 files changed, 32 insertions, 35 deletions
diff --git a/e2e/command_open.test.js b/e2e/command_open.test.js
index 0d41f96..ccf7393 100644
--- a/e2e/command_open.test.js
+++ b/e2e/command_open.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,20 +29,18 @@ const newApp = () => {
describe("open command test", () => {
const port = 12321;
let http;
- let firefox;
- let session;
+ let lanthan;
+ let webdriver;
let browser;
let body;
before(async() => {
- 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();
http = newApp().listen(port);
await browser.storage.local.set({
@@ -53,22 +50,22 @@ describe("open command test", () => {
after(async() => {
http.close();
- if (firefox) {
- await firefox.close();
+ if (lanthan) {
+ await lanthan.quit();
}
});
beforeEach(async() => {
- 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 open command ', async() => {
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- input.sendKeys('open an apple', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ input.sendKeys('open an apple', Key.ENTER);
await eventually(async() => {
let tabs = await browser.tabs.query({ active: true });
@@ -80,9 +77,9 @@ describe("open command test", () => {
it('should open certain search page for keywords by open command ', async() => {
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- input.sendKeys('open yahoo an apple', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ input.sendKeys('open yahoo an apple', Key.ENTER);
await eventually(async() => {
let tabs = await browser.tabs.query({ active: true })
@@ -94,9 +91,9 @@ describe("open command test", () => {
it('should open default engine with empty keywords by open command ', async() => {
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- input.sendKeys('open', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ input.sendKeys('open', Key.ENTER);
await eventually(async() => {
let tabs = await browser.tabs.query({ active: true })
@@ -108,9 +105,9 @@ describe("open command test", () => {
it('should open certain search page for empty keywords by open command ', async() => {
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- input.sendKeys('open yahoo', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ input.sendKeys('open yahoo', Key.ENTER);
await eventually(async() => {
let tabs = await browser.tabs.query({ active: true })
@@ -122,9 +119,9 @@ describe("open command test", () => {
it('should open a site with domain by open command ', async() => {
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- input.sendKeys('open i-beam.org', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ input.sendKeys('open i-beam.org', Key.ENTER);
await eventually(async() => {
let tabs = await browser.tabs.query({ active: true })
@@ -136,9 +133,9 @@ describe("open command test", () => {
it('should open a site with URL by open command ', async() => {
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- input.sendKeys('open https://i-beam.org', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ input.sendKeys('open https://i-beam.org', Key.ENTER);
await eventually(async() => {
let tabs = await browser.tabs.query({ active: true })