aboutsummaryrefslogtreecommitdiff
path: root/e2e/command_bdelete.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_bdelete.test.js
parent0fc2eea7431649f85c6e5d57cca66457f24bb14d (diff)
Use latest lanthan
Diffstat (limited to 'e2e/command_bdelete.test.js')
-rw-r--r--e2e/command_bdelete.test.js102
1 files changed, 49 insertions, 53 deletions
diff --git a/e2e/command_bdelete.test.js b/e2e/command_bdelete.test.js
index 1f416db..aae5b67 100644
--- a/e2e/command_bdelete.test.js
+++ b/e2e/command_bdelete.test.js
@@ -1,10 +1,9 @@
const express = require('express');
-const lanthan = require('lanthan');
const path = require('path');
const assert = require('assert');
const eventually = require('./eventually');
-
-const Key = lanthan.Key;
+const { Builder } = require('lanthan');
+const { By, Key } = require('selenium-webdriver');
const newApp = () => {
let app = express();
@@ -23,27 +22,24 @@ const newApp = () => {
describe('bdelete/bdeletes command 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() => {
http.close();
- if (firefox) {
- await firefox.close();
+ if (lanthan) {
+ await lanthan.quit();
}
});
@@ -59,22 +55,22 @@ describe('bdelete/bdeletes command test', () => {
await browser.tabs.create({ url: `http://127.0.0.1:${port}/site5` })
await eventually(async() => {
- let handles = await session.getWindowHandles();
+ let handles = await webdriver.getAllWindowHandles();
assert.equal(handles.length, 5);
- await session.switchToWindow(handles[2]);
- await session.findElementByCSS('iframe');
+ await webdriver.switchTo().window(handles[2]);
+ await webdriver.findElement(By.css('iframe'));
});
await new Promise((resolve) => setTimeout(resolve, 100));
});
it('should delete an unpinned tab by bdelete command', async() => {
- let body = await session.findElementByCSS('body');
+ let body = await webdriver.findElement(By.css('body'));
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- await input.sendKeys('bdelete site5', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ await input.sendKeys('bdelete site5', Key.ENTER);
await eventually(async() => {
let tabs = await browser.tabs.query({});
@@ -88,12 +84,12 @@ describe('bdelete/bdeletes command test', () => {
});
it('should not delete an pinned tab by bdelete command by bdelete command', async() => {
- let body = await session.findElementByCSS('body');
+ let body = await webdriver.findElement(By.css('body'));
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- await input.sendKeys('bdelete site1', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ await input.sendKeys('bdelete site1', Key.ENTER);
await eventually(async() => {
let tabs = await browser.tabs.query({});
@@ -102,42 +98,42 @@ describe('bdelete/bdeletes command test', () => {
});
it('should show an error when no tabs are matched by bdelete command', async() => {
- let body = await session.findElementByCSS('body');
+ let body = await webdriver.findElement(By.css('body'));
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- await input.sendKeys('bdelete xyz', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ await input.sendKeys('bdelete xyz', Key.ENTER);
await eventually(async() => {
- let p = await session.findElementByCSS('.vimvixen-console-error');
+ let p = await webdriver.findElement(By.css('.vimvixen-console-error'));
let text = await p.getText();
assert.equal(text, 'No matching buffer for xyz');
});
});
it('should show an error when more than one tabs are matched by bdelete command', async() => {
- let body = await session.findElementByCSS('body');
+ let body = await webdriver.findElement(By.css('body'));
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- await input.sendKeys('bdelete site', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ await input.sendKeys('bdelete site', Key.ENTER);
await eventually(async() => {
- let p = await session.findElementByCSS('.vimvixen-console-error');
+ let p = await webdriver.findElement(By.css('.vimvixen-console-error'));
let text = await p.getText();
assert.equal(text, 'More than one match for site');
});
});
it('should delete an unpinned tab by bdelete! command', async() => {
- let body = await session.findElementByCSS('body');
+ let body = await webdriver.findElement(By.css('body'));
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- await input.sendKeys('bdelete! site5', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ await input.sendKeys('bdelete! site5', Key.ENTER);
await eventually(async() => {
let tabs = await browser.tabs.query({});
@@ -151,12 +147,12 @@ describe('bdelete/bdeletes command test', () => {
});
it('should delete an pinned tab by bdelete! command', async() => {
- let body = await session.findElementByCSS('body');
+ let body = await webdriver.findElement(By.css('body'));
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- await input.sendKeys('bdelete! site1', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ await input.sendKeys('bdelete! site1', Key.ENTER);
await eventually(async() => {
let tabs = await browser.tabs.query({});
@@ -170,12 +166,12 @@ describe('bdelete/bdeletes command test', () => {
});
it('should delete unpinned tabs by bdeletes command', async() => {
- let body = await session.findElementByCSS('body');
+ let body = await webdriver.findElement(By.css('body'));
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- await input.sendKeys('bdeletes site', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ await input.sendKeys('bdeletes site', Key.ENTER);
await eventually(async() => {
let tabs = await browser.tabs.query({});
@@ -188,12 +184,12 @@ describe('bdelete/bdeletes command test', () => {
});
it('should delete both pinned and unpinned tabs by bdeletes! command', async() => {
- let body = await session.findElementByCSS('body');
+ let body = await webdriver.findElement(By.css('body'));
await body.sendKeys(':');
- await session.switchToFrame(0);
- let input = await session.findElementByCSS('input');
- await input.sendKeys('bdeletes! site', Key.Enter);
+ await webdriver.switchTo().frame(0);
+ let input = await webdriver.findElement(By.css('input'));
+ await input.sendKeys('bdeletes! site', Key.ENTER);
await eventually(async() => {
let tabs = await browser.tabs.query({});