diff --git a/e2e/blacklist.test.js b/e2e/blacklist.test.ts
similarity index 81%
rename from e2e/blacklist.test.js
rename to e2e/blacklist.test.ts
index 8a8996e..c88f655 100644
--- a/e2e/blacklist.test.js
+++ b/e2e/blacklist.test.ts
@@ -1,13 +1,13 @@
-const express = require('express');
-const path = require('path');
-const assert = require('assert');
-const settings = require('./settings');
-const { Builder } = require('lanthan');
-const { By } = require('selenium-webdriver');
+import express from 'express';
+import * as path from 'path';
+import * as assert from 'assert';
+import { Builder, Lanthan } from 'lanthan';
+import { WebDriver, By } from 'selenium-webdriver';
+import * as http from 'http';
const newApp = () => {
let app = express();
- app.get('/*', (req, res) => {
+ app.get('/*', (_req, res) => {
res.status(200).send(`
@@ -17,12 +17,11 @@ const newApp = () => {
};
describe("navigate test", () => {
-
const port = 12321;
- let http;
- let lanthan;
- let webdriver;
- let browser;
+ let http: http.Server;
+ let lanthan: Lanthan;
+ let webdriver: WebDriver;
+ let browser: any;
before(async() => {
http = newApp().listen(port);
@@ -73,4 +72,3 @@ describe("navigate test", () => {
assert.equal(pageYOffset, 64);
});
});
-
diff --git a/e2e/clipboard.test.js b/e2e/clipboard.test.ts
similarity index 84%
rename from e2e/clipboard.test.js
rename to e2e/clipboard.test.ts
index df31770..dbc00de 100644
--- a/e2e/clipboard.test.js
+++ b/e2e/clipboard.test.ts
@@ -1,15 +1,17 @@
-const express = require('express');
-const path = require('path');
-const assert = require('assert');
-const eventually = require('./eventually');
-const clipboard = require('./lib/clipboard');
-const settings = require('./settings');
-const { Builder } = require('lanthan');
-const { By, Key } = require('selenium-webdriver');
+import express from 'express';
+import * as path from 'path';
+import * as assert from 'assert';
+import * as http from 'http';
+
+import eventually from './eventually';
+import * as clipboard from './lib/clipboard';
+import settings from './settings';
+import { Builder, Lanthan } from 'lanthan';
+import { WebDriver, By, Key } from 'selenium-webdriver';
const newApp = () => {
let app = express();
- app.get('/', (req, res) => {
+ app.get('/', (_req, res) => {
res.status(200).send(``);
});
return app;
@@ -18,10 +20,10 @@ const newApp = () => {
describe("navigate test", () => {
const port = 12321;
- let http;
- let lanthan;
- let webdriver;
- let browser;
+ let http: http.Server;
+ let lanthan: Lanthan;
+ let webdriver: WebDriver;
+ let browser: any;
before(async() => {
http = newApp().listen(port);
@@ -85,7 +87,7 @@ describe("navigate test", () => {
await eventually(async() => {
let tabs = await browser.tabs.query({});
- assert.deepEqual(tabs.map(t => t.url), [
+ assert.deepEqual(tabs.map((t: any) => t.url), [
`http://127.0.0.1:${port}/`,
`http://127.0.0.1:${port}/#open_to_new_tab`,
]);
@@ -114,7 +116,7 @@ describe("navigate test", () => {
await eventually(async() => {
let tabs = await browser.tabs.query({});
- assert.deepEqual(tabs.map(t => t.url), [
+ assert.deepEqual(tabs.map((t: any) => t.url), [
`http://127.0.0.1:${port}/`,
`http://127.0.0.1:${port}/google?q=an%20apple`,
]);
diff --git a/e2e/command_addbookmark.test.js b/e2e/command_addbookmark.test.ts
similarity index 76%
rename from e2e/command_addbookmark.test.js
rename to e2e/command_addbookmark.test.ts
index 68d1c6d..ad94494 100644
--- a/e2e/command_addbookmark.test.js
+++ b/e2e/command_addbookmark.test.ts
@@ -1,13 +1,15 @@
-const express = require('express');
-const path = require('path');
-const assert = require('assert');
-const eventually = require('./eventually');
-const { Builder } = require('lanthan');
-const { By, Key } = require('selenium-webdriver');
+import express from 'express';
+import * as path from 'path';
+import * as assert from 'assert';
+import * as http from 'http';
+
+import eventually from './eventually';
+import { Builder, Lanthan } from 'lanthan';
+import { WebDriver, By, Key } from 'selenium-webdriver';
const newApp = () => {
let app = express();
- app.get('/happy', (req, res) => {
+ app.get('/happy', (_req, res) => {
res.send(`
@@ -20,10 +22,10 @@ const newApp = () => {
describe('addbookmark command test', () => {
const port = 12321;
- let http;
- let lanthan;
- let webdriver;
- let browser;
+ let http: http.Server;
+ let lanthan: Lanthan;
+ let webdriver: WebDriver;
+ let browser: any;
before(async() => {
http = newApp().listen(port);
diff --git a/e2e/command_bdelete.test.js b/e2e/command_bdelete.test.ts
similarity index 91%
rename from e2e/command_bdelete.test.js
rename to e2e/command_bdelete.test.ts
index aae5b67..ce54b23 100644
--- a/e2e/command_bdelete.test.js
+++ b/e2e/command_bdelete.test.ts
@@ -1,9 +1,11 @@
-const express = require('express');
-const path = require('path');
-const assert = require('assert');
-const eventually = require('./eventually');
-const { Builder } = require('lanthan');
-const { By, Key } = require('selenium-webdriver');
+import express from 'express';
+import * as path from 'path';
+import * as assert from 'assert';
+import * as http from 'http';
+
+import eventually from './eventually';
+import { Builder, Lanthan } from 'lanthan';
+import { WebDriver, By, Key } from 'selenium-webdriver';
const newApp = () => {
let app = express();
@@ -21,10 +23,10 @@ const newApp = () => {
describe('bdelete/bdeletes command test', () => {
const port = 12321;
- let http;
- let lanthan;
- let webdriver;
- let browser;
+ let http: http.Server;
+ let lanthan: Lanthan;
+ let webdriver: WebDriver;
+ let browser: any;
before(async() => {
http = newApp().listen(port);
@@ -74,7 +76,7 @@ describe('bdelete/bdeletes command test', () => {
await eventually(async() => {
let tabs = await browser.tabs.query({});
- assert.deepEqual(tabs.map(t => t.url), [
+ assert.deepEqual(tabs.map((t: any) => t.url), [
`http://127.0.0.1:${port}/site1`,
`http://127.0.0.1:${port}/site2`,
`http://127.0.0.1:${port}/site3`,
@@ -137,7 +139,7 @@ describe('bdelete/bdeletes command test', () => {
await eventually(async() => {
let tabs = await browser.tabs.query({});
- assert.deepEqual(tabs.map(t => t.url), [
+ assert.deepEqual(tabs.map((t: any) => t.url), [
`http://127.0.0.1:${port}/site1`,
`http://127.0.0.1:${port}/site2`,
`http://127.0.0.1:${port}/site3`,
@@ -156,7 +158,7 @@ describe('bdelete/bdeletes command test', () => {
await eventually(async() => {
let tabs = await browser.tabs.query({});
- assert.deepEqual(tabs.map(t => t.url), [
+ assert.deepEqual(tabs.map((t: any) => t.url), [
`http://127.0.0.1:${port}/site2`,
`http://127.0.0.1:${port}/site3`,
`http://127.0.0.1:${port}/site4`,
@@ -175,7 +177,7 @@ describe('bdelete/bdeletes command test', () => {
await eventually(async() => {
let tabs = await browser.tabs.query({});
- assert.deepEqual(tabs.map(t => t.url), [
+ assert.deepEqual(tabs.map((t: any) => t.url), [
`http://127.0.0.1:${port}/site1`,
`http://127.0.0.1:${port}/site2`,
`http://127.0.0.1:${port}/site3`,
diff --git a/e2e/command_buffer.test.js b/e2e/command_buffer.test.ts
similarity index 93%
rename from e2e/command_buffer.test.js
rename to e2e/command_buffer.test.ts
index b3336dc..e642673 100644
--- a/e2e/command_buffer.test.js
+++ b/e2e/command_buffer.test.ts
@@ -1,9 +1,11 @@
-const express = require('express');
-const path = require('path');
-const assert = require('assert');
-const eventually = require('./eventually');
-const { Builder } = require('lanthan');
-const { By, Key } = require('selenium-webdriver');
+import express from 'express';
+import * as path from 'path';
+import * as assert from 'assert';
+import * as http from 'http';
+
+import eventually from './eventually';
+import { Builder, Lanthan } from 'lanthan';
+import { WebDriver, By, Key } from 'selenium-webdriver';
const newApp = () => {
let app = express();
@@ -21,10 +23,10 @@ const newApp = () => {
describe('buffer command test', () => {
const port = 12321;
- let http;
- let lanthan;
- let webdriver;
- let browser;
+ let http: http.Server;
+ let lanthan: Lanthan;
+ let webdriver: WebDriver;
+ let browser: any;
before(async() => {
http = newApp().listen(port);
@@ -105,7 +107,7 @@ describe('buffer command test', () => {
assert.equal(text, 'tab 0 does not exist');
});
- await webdriver.switchTo().parentFrame();
+ await (webdriver.switchTo() as any).parentFrame();
body = await webdriver.findElement(By.css('body'));
await body.sendKeys(':');
diff --git a/e2e/command_open.test.js b/e2e/command_open.test.ts
similarity index 88%
rename from e2e/command_open.test.js
rename to e2e/command_open.test.ts
index ccf7393..cfaee15 100644
--- a/e2e/command_open.test.js
+++ b/e2e/command_open.test.ts
@@ -1,23 +1,25 @@
-const express = require('express');
-const path = require('path');
-const assert = require('assert');
-const eventually = require('./eventually');
-const settings = require('./settings');
-const { Builder } = require('lanthan');
-const { By, Key } = require('selenium-webdriver');
+import express from 'express';
+import * as path from 'path';
+import * as assert from 'assert';
+import * as http from 'http';
+
+import settings from './settings';
+import eventually from './eventually';
+import { Builder, Lanthan } from 'lanthan';
+import { WebDriver, WebElement, By, Key } from 'selenium-webdriver';
const newApp = () => {
let app = express();
for (let name of ['google', 'yahoo', 'bing', 'duckduckgo', 'twitter', 'wikipedia']) {
- app.get('/' + name, (req, res) => {
+ app.get('/' + name, (_req, res) => {
res.send(`
${name.charAt(0).toUpperCase() + name.slice(1)}
`);
});
}
- app.get('/', (req, res) => {
+ app.get('/', (_req, res) => {
res.send(`
home
@@ -28,11 +30,11 @@ const newApp = () => {
describe("open command test", () => {
const port = 12321;
- let http;
- let lanthan;
- let webdriver;
- let browser;
- let body;
+ let http: http.Server;
+ let lanthan: Lanthan;
+ let webdriver: WebDriver;
+ let browser: any;
+ let body: WebElement;
before(async() => {
lanthan = await Builder
diff --git a/e2e/command_quit.test.js b/e2e/command_quit.test.ts
similarity index 89%
rename from e2e/command_quit.test.js
rename to e2e/command_quit.test.ts
index 07e770a..29b947a 100644
--- a/e2e/command_quit.test.js
+++ b/e2e/command_quit.test.ts
@@ -1,9 +1,12 @@
-const express = require('express');
-const path = require('path');
-const assert = require('assert');
-const eventually = require('./eventually');
-const { Builder } = require('lanthan');
-const { By, Key } = require('selenium-webdriver');
+import express from 'express';
+import * as path from 'path';
+import * as assert from 'assert';
+import * as http from 'http';
+
+import eventually from './eventually';
+import { Builder, Lanthan } from 'lanthan';
+import { WebDriver, By, Key } from 'selenium-webdriver';
+
const newApp = () => {
let app = express();
@@ -21,10 +24,10 @@ const newApp = () => {
describe('quit/quitall command test', () => {
const port = 12321;
- let http;
- let lanthan;
- let webdriver;
- let browser;
+ let http: http.Server;
+ let lanthan: Lanthan;
+ let webdriver: WebDriver;
+ let browser: any;
before(async() => {
http = newApp().listen(port);
diff --git a/e2e/command_tabopen.test.js b/e2e/command_tabopen.test.ts
similarity index 89%
rename from e2e/command_tabopen.test.js
rename to e2e/command_tabopen.test.ts
index 78f5d7f..ca4ad92 100644
--- a/e2e/command_tabopen.test.js
+++ b/e2e/command_tabopen.test.ts
@@ -1,23 +1,26 @@
-const express = require('express');
-const path = require('path');
-const assert = require('assert');
-const eventually = require('./eventually');
-const settings = require('./settings');
-const { Builder } = require('lanthan');
-const { By, Key } = require('selenium-webdriver');
+import express from 'express';
+import * as path from 'path';
+import * as assert from 'assert';
+import * as http from 'http';
+
+import settings from './settings';
+import eventually from './eventually';
+import { Builder, Lanthan } from 'lanthan';
+import { WebDriver, WebElement, By, Key } from 'selenium-webdriver';
+
const newApp = () => {
let app = express();
for (let name of ['google', 'yahoo', 'bing', 'duckduckgo', 'twitter', 'wikipedia']) {
- app.get('/' + name, (req, res) => {
+ app.get('/' + name, (_req, res) => {
res.send(`
${name.charAt(0).toUpperCase() + name.slice(1)}
`);
});
}
- app.get('/', (req, res) => {
+ app.get('/', (_req, res) => {
res.send(`
home
@@ -28,11 +31,11 @@ const newApp = () => {
describe("tabopen command test", () => {
const port = 12321;
- let http;
- let lanthan;
- let webdriver;
- let browser;
- let body;
+ let http: http.Server;
+ let lanthan: Lanthan;
+ let webdriver: WebDriver;
+ let browser: any;
+ let body: WebElement;
before(async() => {
http = newApp().listen(port);
diff --git a/e2e/command_winopen.test.js b/e2e/command_winopen.test.ts
similarity index 90%
rename from e2e/command_winopen.test.js
rename to e2e/command_winopen.test.ts
index 149d775..cdd4c1c 100644
--- a/e2e/command_winopen.test.js
+++ b/e2e/command_winopen.test.ts
@@ -1,23 +1,25 @@
-const express = require('express');
-const path = require('path');
-const assert = require('assert');
-const eventually = require('./eventually');
-const settings = require('./settings');
-const { Builder } = require('lanthan');
-const { By, Key } = require('selenium-webdriver');
+import express from 'express';
+import * as path from 'path';
+import * as assert from 'assert';
+import * as http from 'http';
+
+import settings from './settings';
+import eventually from './eventually';
+import { Builder, Lanthan } from 'lanthan';
+import { WebDriver, WebElement, By, Key } from 'selenium-webdriver';
const newApp = () => {
let app = express();
for (let name of ['google', 'yahoo', 'bing', 'duckduckgo', 'twitter', 'wikipedia']) {
- app.get('/' + name, (req, res) => {
+ app.get('/' + name, (_req, res) => {
res.send(`
${name.charAt(0).toUpperCase() + name.slice(1)}
`);
});
}
- app.get('/', (req, res) => {
+ app.get('/', (_req, res) => {
res.send(`
home
@@ -28,11 +30,11 @@ const newApp = () => {
describe("winopen command test", () => {
const port = 12321;
- let http;
- let lanthan;
- let webdriver;
- let browser;
- let body;
+ let http: http.Server;
+ let lanthan: Lanthan;
+ let webdriver: WebDriver;
+ let browser: any;
+ let body: WebElement;
before(async() => {
http = newApp().listen(port);
diff --git a/e2e/completion.test.js b/e2e/completion.test.ts
similarity index 74%
rename from e2e/completion.test.js
rename to e2e/completion.test.ts
index fc87df0..fd58f74 100644
--- a/e2e/completion.test.js
+++ b/e2e/completion.test.ts
@@ -1,15 +1,17 @@
-const express = require('express');
-const path = require('path');
-const assert = require('assert');
-const eventually = require('./eventually');
-const settings = require('./settings');
-const { Builder } = require('lanthan');
-const { By, Key } = require('selenium-webdriver');
-const Console = require('./lib/Console');
+import express from 'express';
+import * as path from 'path';
+import * as assert from 'assert';
+import * as http from 'http';
+
+import settings from './settings';
+import eventually from './eventually';
+import { Builder, Lanthan } from 'lanthan';
+import { WebDriver, WebElement, By, Key } from 'selenium-webdriver';
+import { Console } from './lib/Console';
const newApp = () => {
let app = express();
- app.get('/', (req, res) => {
+ app.get('/', (_req, res) => {
res.send(`
ok
@@ -20,11 +22,11 @@ const newApp = () => {
describe("general completion test", () => {
const port = 12321;
- let http;
- let lanthan;
- let webdriver;
- let browser;
- let body;
+ let http: http.Server;
+ let lanthan: Lanthan;
+ let webdriver: WebDriver;
+ let browser: any;
+ let body: WebElement;
before(async() => {
lanthan = await Builder
@@ -62,9 +64,9 @@ describe("general completion test", () => {
let items = await c.getCompletions();
assert.equal(items.length, 10);
assert.deepEqual(items[0], { type: 'title', text: 'Console Command' });
- assert(items[1].text.startsWith('set'))
- assert(items[2].text.startsWith('open'))
- assert(items[3].text.startsWith('tabopen'))
+ assert.ok(items[1].text.startsWith('set'))
+ assert.ok(items[2].text.startsWith('open'))
+ assert.ok(items[3].text.startsWith('tabopen'))
});
});
@@ -79,9 +81,9 @@ describe("general completion test", () => {
let items = await c.getCompletions();
assert.equal(items.length, 4);
assert.deepEqual(items[0], { type: 'title', text: 'Console Command' });
- assert(items[1].text.startsWith('buffer'))
- assert(items[2].text.startsWith('bdelete'))
- assert(items[3].text.startsWith('bdeletes'))
+ assert.ok(items[1].text.startsWith('buffer'))
+ assert.ok(items[2].text.startsWith('bdelete'))
+ assert.ok(items[3].text.startsWith('bdeletes'))
});
});
@@ -100,7 +102,7 @@ describe("general completion test", () => {
await c.sendKeys(Key.TAB);
await eventually(async() => {
let items = await c.getCompletions();
- assert(items[1].highlight)
+ assert.ok(items[1].highlight)
let v = await c.currentValue();
assert.equal(v, 'buffer');
@@ -109,7 +111,7 @@ describe("general completion test", () => {
await c.sendKeys(Key.TAB, Key.TAB);
await eventually(async() => {
let items = await c.getCompletions();
- assert(items[3].highlight)
+ assert.ok(items[3].highlight)
let v = await c.currentValue();
assert.equal(v, 'bdeletes');
@@ -124,7 +126,7 @@ describe("general completion test", () => {
await c.sendKeys(Key.SHIFT, Key.TAB);
await eventually(async() => {
let items = await c.getCompletions();
- assert(items[3].highlight)
+ assert.ok(items[3].highlight)
let v = await c.currentValue();
assert.equal(v, 'bdeletes');
diff --git a/e2e/completion_buffers.test.js b/e2e/completion_buffers.test.ts
similarity index 71%
rename from e2e/completion_buffers.test.js
rename to e2e/completion_buffers.test.ts
index 87d2397..9c212cc 100644
--- a/e2e/completion_buffers.test.js
+++ b/e2e/completion_buffers.test.ts
@@ -1,11 +1,13 @@
-const express = require('express');
-const path = require('path');
-const assert = require('assert');
-const eventually = require('./eventually');
-const settings = require('./settings');
-const Console = require('./lib/Console');
-const { Builder } = require('lanthan');
-const { By, Key } = require('selenium-webdriver');
+import express from 'express';
+import * as path from 'path';
+import * as assert from 'assert';
+import * as http from 'http';
+
+import settings from './settings';
+import eventually from './eventually';
+import { Builder, Lanthan } from 'lanthan';
+import { WebDriver, WebElement, By } from 'selenium-webdriver';
+import { Console } from './lib/Console';
const newApp = () => {
@@ -24,11 +26,11 @@ const newApp = () => {
describe("completion on buffer/bdelete/bdeletes", () => {
const port = 12321;
- let http;
- let lanthan;
- let webdriver;
- let browser;
- let body;
+ let http: http.Server;
+ let lanthan: Lanthan;
+ let webdriver: WebDriver;
+ let browser: any;
+ let body: WebElement;
before(async() => {
lanthan = await Builder
@@ -85,14 +87,14 @@ describe("completion on buffer/bdelete/bdeletes", () => {
let items = await c.getCompletions();
assert.equal(items.length, 6);
assert.deepEqual(items[0], { type: 'title', text: 'Buffers' });
- assert(items[1].text.startsWith('1:'));
- assert(items[2].text.startsWith('2:'));
- assert(items[3].text.startsWith('3:'));
- assert(items[4].text.startsWith('4:'));
- assert(items[5].text.startsWith('5:'));
-
- assert(items[3].text.includes('%'));
- assert(items[5].text.includes('#'));
+ assert.ok(items[1].text.startsWith('1:'));
+ assert.ok(items[2].text.startsWith('2:'));
+ assert.ok(items[3].text.startsWith('3:'));
+ assert.ok(items[4].text.startsWith('4:'));
+ assert.ok(items[5].text.startsWith('5:'));
+
+ assert.ok(items[3].text.includes('%'));
+ assert.ok(items[5].text.includes('#'));
});
})
@@ -106,9 +108,9 @@ describe("completion on buffer/bdelete/bdeletes", () => {
await eventually(async() => {
let items = await c.getCompletions();
assert.deepEqual(items[0], { type: 'title', text: 'Buffers' });
- assert(items[1].text.startsWith('2:'));
- assert(items[1].text.includes('title_site2'));
- assert(items[1].text.includes(`http://127.0.0.1:${port}/site2`));
+ assert.ok(items[1].text.startsWith('2:'));
+ assert.ok(items[1].text.includes('title_site2'));
+ assert.ok(items[1].text.includes(`http://127.0.0.1:${port}/site2`));
});
})
@@ -122,7 +124,7 @@ describe("completion on buffer/bdelete/bdeletes", () => {
await eventually(async() => {
let items = await c.getCompletions();
assert.deepEqual(items[0], { type: 'title', text: 'Buffers' });
- assert(items[1].text.startsWith('2:'));
+ assert.ok(items[1].text.startsWith('2:'));
});
})
@@ -137,7 +139,7 @@ describe("completion on buffer/bdelete/bdeletes", () => {
let items = await c.getCompletions();
assert.equal(items.length, 2);
assert.deepEqual(items[0], { type: 'title', text: 'Buffers' });
- assert(items[1].text.startsWith('2:'));
+ assert.ok(items[1].text.startsWith('2:'));
});
})
@@ -151,9 +153,9 @@ describe("completion on buffer/bdelete/bdeletes", () => {
await eventually(async() => {
let items = await c.getCompletions();
assert.equal(items.length, 4);
- assert(items[1].text.includes('site3'));
- assert(items[2].text.includes('site4'));
- assert(items[3].text.includes('site5'));
+ assert.ok(items[1].text.includes('site3'));
+ assert.ok(items[2].text.includes('site4'));
+ assert.ok(items[3].text.includes('site5'));
});
})
@@ -167,9 +169,9 @@ describe("completion on buffer/bdelete/bdeletes", () => {
await eventually(async() => {
let items = await c.getCompletions();
assert.equal(items.length, 4);
- assert(items[1].text.includes('site3'));
- assert(items[2].text.includes('site4'));
- assert(items[3].text.includes('site5'));
+ assert.ok(items[1].text.includes('site3'));
+ assert.ok(items[2].text.includes('site4'));
+ assert.ok(items[3].text.includes('site5'));
});
})
@@ -183,11 +185,11 @@ describe("completion on buffer/bdelete/bdeletes", () => {
await eventually(async() => {
let items = await c.getCompletions();
assert.equal(items.length, 6);
- assert(items[1].text.includes('site1'));
- assert(items[2].text.includes('site2'));
- assert(items[3].text.includes('site3'));
- assert(items[4].text.includes('site4'));
- assert(items[5].text.includes('site5'));
+ assert.ok(items[1].text.includes('site1'));
+ assert.ok(items[2].text.includes('site2'));
+ assert.ok(items[3].text.includes('site3'));
+ assert.ok(items[4].text.includes('site4'));
+ assert.ok(items[5].text.includes('site5'));
});
})
@@ -201,11 +203,11 @@ describe("completion on buffer/bdelete/bdeletes", () => {
await eventually(async() => {
let items = await c.getCompletions();
assert.equal(items.length, 6);
- assert(items[1].text.includes('site1'));
- assert(items[2].text.includes('site2'));
- assert(items[3].text.includes('site3'));
- assert(items[4].text.includes('site4'));
- assert(items[5].text.includes('site5'));
+ assert.ok(items[1].text.includes('site1'));
+ assert.ok(items[2].text.includes('site2'));
+ assert.ok(items[3].text.includes('site3'));
+ assert.ok(items[4].text.includes('site4'));
+ assert.ok(items[5].text.includes('site5'));
});
})
});
diff --git a/e2e/completion_open.test.js b/e2e/completion_open.test.ts
similarity index 82%
rename from e2e/completion_open.test.js
rename to e2e/completion_open.test.ts
index b2b7484..dcd1829 100644
--- a/e2e/completion_open.test.js
+++ b/e2e/completion_open.test.ts
@@ -1,17 +1,18 @@
-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 { Builder } = require('lanthan');
-const { By, Key } = require('selenium-webdriver');
-const Console = require('./lib/Console');
+import express from 'express';
+import * as path from 'path';
+import * as assert from 'assert';
+import * as http from 'http';
+
+import settings from './settings';
+import eventually from './eventually';
+import { Builder, Lanthan } from 'lanthan';
+import { WebDriver, WebElement, By, Key } from 'selenium-webdriver';
+import { Console } from './lib/Console';
const newApp = () => {
let app = express();
- app.get('/', (req, res) => {
+ app.get('/', (_req, res) => {
res.send(`
ok
@@ -22,11 +23,11 @@ const newApp = () => {
describe("completion on open/tabopen/winopen commands", () => {
const port = 12321;
- let http;
- let lanthan;
- let webdriver;
- let browser;
- let body;
+ let http: http.Server;
+ let lanthan: Lanthan;
+ let webdriver: WebDriver;
+ let browser: any;
+ let body: WebElement;
before(async() => {
lanthan = await Builder
@@ -66,9 +67,9 @@ describe("completion on open/tabopen/winopen commands", () => {
await eventually(async() => {
let completions = await c.getCompletions();
- assert(completions.find(x => x.type === 'title' && x.text === 'Search Engines'));
- assert(completions.find(x => x.type === 'title' && x.text === 'Bookmarks'));
- assert(completions.find(x => x.type === 'title' && x.text === 'History'));
+ assert.ok(completions.find(x => x.type === 'title' && x.text === 'Search Engines'));
+ assert.ok(completions.find(x => x.type === 'title' && x.text === 'Bookmarks'));
+ assert.ok(completions.find(x => x.type === 'title' && x.text === 'History'));
});
});
@@ -82,7 +83,7 @@ describe("completion on open/tabopen/winopen commands", () => {
await eventually(async() => {
let completions = await c.getCompletions();
let items = completions.filter(x => x.type === 'item').map(x => x.text);
- assert(items.every(x => x.includes('https://')));
+ assert.ok(items.every(x => x.includes('https://')));
});
})
@@ -96,7 +97,7 @@ describe("completion on open/tabopen/winopen commands", () => {
await eventually(async() => {
let completions = await c.getCompletions();
let items = completions.filter(x => x.type === 'item').map(x => x.text);
- assert(items.every(x => x.toLowerCase().includes('getting')));
+ assert.ok(items.every(x => x.toLowerCase().includes('getting')));
});
})
@@ -110,7 +111,7 @@ describe("completion on open/tabopen/winopen commands", () => {
await eventually(async() => {
let completions = await c.getCompletions();
let items = completions.filter(x => x.type === 'item').map(x => x.text);
- assert(items.every(x => x.includes('https://')));
+ assert.ok(items.every(x => x.includes('https://')));
});
})
@@ -124,22 +125,22 @@ describe("completion on open/tabopen/winopen commands", () => {
await eventually(async() => {
let completions = await c.getCompletions();
let items = completions.filter(x => x.type === 'item').map(x => x.text);
- assert(items.every(x => x.includes('https://')));
+ assert.ok(items.every(x => x.includes('https://')));
});
})
it('should display only specified items in "complete" property by set command', async() => {
let c = new Console(webdriver);
- const execCommand = async(line) => {
+ const execCommand = async(line: string) => {
await body.sendKeys(':');
await webdriver.switchTo().frame(0);
await c.sendKeys(line, Key.ENTER);
await new Promise(resolve => setTimeout(resolve, 100));
- await webdriver.switchTo().parentFrame();
+ await (webdriver.switchTo() as any).parentFrame();
}
- const typeCommand = async(...keys) => {
+ const typeCommand = async(...keys: string[]) => {
await body.sendKeys(':');
await webdriver.switchTo().frame(0);
await c.sendKeys(...keys);
@@ -148,7 +149,7 @@ describe("completion on open/tabopen/winopen commands", () => {
const cancel = async() => {
await c.sendKeys(Key.ESCAPE);
await new Promise(resolve => setTimeout(resolve, 100));
- await webdriver.switchTo().parentFrame();
+ await (webdriver.switchTo() as any).parentFrame();
}
await execCommand('set complete=sbh');
@@ -191,7 +192,7 @@ describe("completion on open/tabopen/winopen commands", () => {
let c = new Console(webdriver);
- const typeCommand = async(...keys) => {
+ const typeCommand = async(...keys: string[]) => {
await body.sendKeys(':');
await webdriver.switchTo().frame(0);
await c.sendKeys(...keys);
@@ -200,7 +201,7 @@ describe("completion on open/tabopen/winopen commands", () => {
const cancel = async() => {
await c.sendKeys(Key.ESCAPE);
await new Promise(resolve => setTimeout(resolve, 100));
- await webdriver.switchTo().parentFrame();
+ await (webdriver.switchTo() as any).parentFrame();
}
await browser.storage.local.set({ settings: {
diff --git a/e2e/completion_set.test.js b/e2e/completion_set.test.ts
similarity index 65%
rename from e2e/completion_set.test.js
rename to e2e/completion_set.test.ts
index a6ec248..018479f 100644
--- a/e2e/completion_set.test.js
+++ b/e2e/completion_set.test.ts
@@ -1,19 +1,17 @@
-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 Console = require('./lib/Console');
-const { Builder } = require('lanthan');
-const { By } = require('selenium-webdriver');
+import * as path from 'path';
+import * as assert from 'assert';
+
+import settings from './settings';
+import eventually from './eventually';
+import { Builder, Lanthan } from 'lanthan';
+import { WebDriver, WebElement, By } from 'selenium-webdriver';
+import { Console } from './lib/Console';
describe("completion on set commands", () => {
- const port = 12321;
- let lanthan;
- let session;
- let browser;
- let body;
+ let lanthan: Lanthan;
+ let webdriver: WebDriver;
+ let browser: any;
+ let body: WebElement;
before(async() => {
lanthan = await Builder
@@ -50,10 +48,10 @@ describe("completion on set commands", () => {
let items = await c.getCompletions();
assert.equal(items.length, 5);
assert.deepEqual(items[0], { type: 'title', text: 'Properties' });
- assert(items[1].text.startsWith('hintchars'))
- assert(items[2].text.startsWith('smoothscroll'))
- assert(items[3].text.startsWith('nosmoothscroll'))
- assert(items[4].text.startsWith('complete'))
+ assert.ok(items[1].text.startsWith('hintchars'))
+ assert.ok(items[2].text.startsWith('smoothscroll'))
+ assert.ok(items[3].text.startsWith('nosmoothscroll'))
+ assert.ok(items[4].text.startsWith('complete'))
});
});
@@ -67,7 +65,7 @@ describe("completion on set commands", () => {
await eventually(async() => {
let items = await c.getCompletions();
assert.equal(items.length, 2);
- assert(items[1].text.includes('nosmoothscroll'))
+ assert.ok(items[1].text.includes('nosmoothscroll'))
});
});
});
diff --git a/e2e/console.test.js b/e2e/console.test.ts
similarity index 83%
rename from e2e/console.test.js
rename to e2e/console.test.ts
index 131a4ef..65c5d2d 100644
--- a/e2e/console.test.js
+++ b/e2e/console.test.ts
@@ -1,13 +1,14 @@
-const express = require('express');
-const path = require('path');
-const assert = require('assert');
-const eventually = require('./eventually');
-const { Builder } = require('lanthan');
-const { Key, By } = require('selenium-webdriver');
+import express from 'express';
+import * as path from 'path';
+import * as assert from 'assert';
+import * as http from 'http';
+
+import { Builder, Lanthan } from 'lanthan';
+import { WebDriver, WebElement, By, Key } from 'selenium-webdriver';
const newApp = () => {
let app = express();
- app.get('/', (req, res) => {
+ app.get('/', (_req, res) => {
res.send(`
@@ -21,12 +22,10 @@ const newApp = () => {
describe("console test", () => {
const port = 12321;
- let http;
- let lanthan;
- let webdriver;
- let browser;
- let tab;
- let body;
+ let http: http.Server;
+ let lanthan: Lanthan;
+ let webdriver: WebDriver;
+ let body: WebElement;
before(async() => {
http = newApp().listen(port);
@@ -35,7 +34,6 @@ describe("console test", () => {
.spyAddon(path.join(__dirname, '..'))
.build();
webdriver = lanthan.getWebDriver();
- browser = lanthan.getWebExtBrowser();
});
after(async() => {
@@ -65,7 +63,7 @@ describe("console test", () => {
await body.sendKeys('o');
await webdriver.switchTo().frame(0);
- let value = await webdriver.executeScript(() => document.querySelector('input').value);
+ let value = await webdriver.executeScript(() => document.querySelector('input')!!.value);
assert.equal(value, 'open ');
});
@@ -73,7 +71,7 @@ describe("console test", () => {
await body.sendKeys(Key.SHIFT, 'o');
await webdriver.switchTo().frame(0);
- let value = await webdriver.executeScript(() => document.querySelector('input').value);
+ let value = await webdriver.executeScript(() => document.querySelector('input')!!.value);
assert.equal(value, `open http://127.0.0.1:${port}/`);
});
@@ -81,7 +79,7 @@ describe("console test", () => {
await body.sendKeys('t');
await webdriver.switchTo().frame(0);
- let value = await webdriver.executeScript(() => document.querySelector('input').value);
+ let value = await webdriver.executeScript(() => document.querySelector('input')!!.value);
assert.equal(value, 'tabopen ');
});
@@ -89,7 +87,7 @@ describe("console test", () => {
await body.sendKeys(Key.SHIFT, 't');
await webdriver.switchTo().frame(0);
- let value = await webdriver.executeScript(() => document.querySelector('input').value);
+ let value = await webdriver.executeScript(() => document.querySelector('input')!!.value);
assert.equal(value, `tabopen http://127.0.0.1:${port}/`);
});
@@ -97,7 +95,7 @@ describe("console test", () => {
await body.sendKeys('w');
await webdriver.switchTo().frame(0);
- let value = await webdriver.executeScript(() => document.querySelector('input').value);
+ let value = await webdriver.executeScript(() => document.querySelector('input')!!.value);
assert.equal(value, 'winopen ');
});
@@ -105,7 +103,7 @@ describe("console test", () => {
await body.sendKeys(Key.SHIFT, 'W');
await webdriver.switchTo().frame(0);
- let value = await webdriver.executeScript(() => document.querySelector('input').value);
+ let value = await webdriver.executeScript(() => document.querySelector('input')!!.value);
assert.equal(value, `winopen http://127.0.0.1:${port}/`);
});
@@ -113,7 +111,7 @@ describe("console test", () => {
await body.sendKeys('b');
await webdriver.switchTo().frame(0);
- let value = await webdriver.executeScript(() => document.querySelector('input').value);
+ let value = await webdriver.executeScript(() => document.querySelector('input')!!.value);
assert.equal(value, `buffer `);
});
@@ -121,7 +119,7 @@ describe("console test", () => {
await body.sendKeys('a');
await webdriver.switchTo().frame(0);
- let value = await webdriver.executeScript(() => document.querySelector('input').value);
+ let value = await webdriver.executeScript(() => document.querySelector('input')!!.value);
assert.equal(value, `addbookmark Hello, world!`);
});
});
diff --git a/e2e/eventually.js b/e2e/eventually.js
deleted file mode 100644
index ab0ae25..0000000
--- a/e2e/eventually.js
+++ /dev/null
@@ -1,23 +0,0 @@
-let defaultInterval = 100;
-let defaultTimeout = 2000;
-
-function sleep(ms) {
- return new Promise(resolve => setTimeout(resolve, ms));
-}
-
-const eventually = async (fn, timeout = defaultTimeout, interval = defaultInterval) => {
- let start = Date.now();
- let loop = async() => {
- try {
- await fn();
- } catch (err) {
- if (Date.now() - start > timeout) {
- throw err;
- }
- await new Promise((resolve) => setTimeout(resolve, interval))
- await loop();
- }
- };
- await loop();
-};
-module.exports = eventually;
diff --git a/e2e/eventually.ts b/e2e/eventually.ts
new file mode 100644
index 0000000..12c4552
--- /dev/null
+++ b/e2e/eventually.ts
@@ -0,0 +1,30 @@
+const defaultInterval = 100;
+const defaultTimeout = 2000;
+
+type Handler = () => void
+
+const sleep = (ms: number): Promise => {
+ return new Promise(resolve => setTimeout(resolve, ms));
+}
+
+const eventually = async (
+ fn: Handler,
+ timeout = defaultTimeout,
+ interval = defaultInterval,
+): Promise => {
+ let start = Date.now();
+ let loop = async() => {
+ try {
+ await fn();
+ } catch (err) {
+ if (Date.now() - start > timeout) {
+ throw err;
+ }
+ await sleep(interval);
+ await loop();
+ }
+ };
+ await loop();
+};
+
+export default eventually;
diff --git a/e2e/follow.test.js b/e2e/follow.test.ts
similarity index 88%
rename from e2e/follow.test.js
rename to e2e/follow.test.ts
index 336d673..5d38085 100644
--- a/e2e/follow.test.js
+++ b/e2e/follow.test.ts
@@ -1,28 +1,30 @@
-const express = require('express');
-const path = require('path');
-const assert = require('assert');
-const eventually = require('./eventually');
-const { Builder } = require('lanthan');
-const { Key, By } = require('selenium-webdriver');
+import express from 'express';
+import * as path from 'path';
+import * as assert from 'assert';
+import * as http from 'http';
+
+import eventually from './eventually';
+import { Builder, Lanthan } from 'lanthan';
+import { WebDriver, By, Key } from 'selenium-webdriver';
const newApp = () => {
let app = express();
- app.get('/', (req, res) => {
+ app.get('/', (_req, res) => {
res.send(`
hello
`);
});
- app.get('/follow-input', (req, res) => {
+ app.get('/follow-input', (_req, res) => {
res.send(`
`);
});
- app.get('/area', (req, res) => {
+ app.get('/area', (_req, res) => {
res.send(`
@@ -49,7 +51,7 @@ const newApp = () => {
* | |
* +-----------------+
*/
- app.get('/test1', (req, res) => {
+ app.get('/test1', (_req, res) => {
res.send(`
@@ -71,13 +73,13 @@ const newApp = () => {
* | |
* +-----------------+
*/
- app.get('/test2', (req, res) => {
+ app.get('/test2', (_req, res) => {
res.send(`