Clean e2e tests

jh-changes
Shin'ya UEOKA 5 years ago
parent f59a2dd8c7
commit 68f6211aac
  1. 21
      e2e/blacklist.test.ts
  2. 16
      e2e/clipboard.test.ts
  3. 2
      e2e/command_addbookmark.test.ts
  4. 8
      e2e/command_bdelete.test.ts
  5. 2
      e2e/command_buffer.test.ts
  6. 2
      e2e/command_help.test.ts
  7. 30
      e2e/command_open.test.ts
  8. 20
      e2e/command_tabopen.test.ts
  9. 19
      e2e/command_winopen.test.ts
  10. 21
      e2e/completion.test.ts
  11. 25
      e2e/completion_buffers.test.ts
  12. 55
      e2e/completion_open.test.ts
  13. 13
      e2e/completion_set.test.ts
  14. 4
      e2e/console.test.ts
  15. 18
      e2e/follow.test.ts
  16. 2
      e2e/follow_properties.test.ts
  17. 18
      e2e/lib/SettingRepository.ts
  18. 2
      e2e/mark.test.ts
  19. 14
      e2e/navigate.test.ts
  20. 14
      e2e/options.test.ts
  21. 16
      e2e/options_form.test.ts
  22. 27
      e2e/partial_blacklist.test.ts
  23. 86
      e2e/settings.ts
  24. 2
      e2e/zoom.test.ts

@ -5,10 +5,12 @@ import TestServer from './lib/TestServer';
import { Builder, Lanthan } from 'lanthan'; import { Builder, Lanthan } from 'lanthan';
import { WebDriver } from 'selenium-webdriver'; import { WebDriver } from 'selenium-webdriver';
import Page from './lib/Page'; import Page from './lib/Page';
import SettingRepository from "./lib/SettingRepository";
import Settings from "../src/shared/settings/Settings";
describe("blacklist test", () => { describe("blacklist test", () => {
let server = new TestServer().receiveContent('/*', let server = new TestServer().receiveContent('/*',
`<!DOCTYPE html><html lang="en"><body style="width:10000px; height:10000px"></body></html">`, `<!DOCTYPE html><html lang="en"><body style="width:10000px; height:10000px"></body></html>`,
); );
let lanthan: Lanthan; let lanthan: Lanthan;
let webdriver: WebDriver; let webdriver: WebDriver;
@ -24,17 +26,12 @@ describe("blacklist test", () => {
await server.start(); await server.start();
let url = server.url('/a').replace('http://', ''); let url = server.url('/a').replace('http://', '');
await browser.storage.local.set({ await new SettingRepository(browser).saveJSON(Settings.fromJSON({
settings: { keymaps: {
source: 'json', j: { type: "scroll.vertically", count: 1 },
json: `{
"keymaps": {
"j": { "type": "scroll.vertically", "count": 1 }
},
"blacklist": [ "${url}" ]
}`,
}, },
}); blacklist: [ url ],
}));
}); });
after(async() => { after(async() => {
@ -46,7 +43,7 @@ describe("blacklist test", () => {
it('should disable add-on if the URL is in the blacklist', async () => { it('should disable add-on if the URL is in the blacklist', async () => {
let page = await Page.navigateTo(webdriver, server.url('/a')); let page = await Page.navigateTo(webdriver, server.url('/a'));
await page.sendKeys('j') await page.sendKeys('j');
let scrollY = await page.getScrollY(); let scrollY = await page.getScrollY();
assert.strictEqual(scrollY, 0); assert.strictEqual(scrollY, 0);

@ -4,10 +4,11 @@ import * as path from 'path';
import TestServer from './lib/TestServer'; import TestServer from './lib/TestServer';
import eventually from './eventually'; import eventually from './eventually';
import * as clipboard from './lib/clipboard'; import * as clipboard from './lib/clipboard';
import settings from './settings';
import { Builder, Lanthan } from 'lanthan'; import { Builder, Lanthan } from 'lanthan';
import { WebDriver, Key } from 'selenium-webdriver'; import { WebDriver, Key } from 'selenium-webdriver';
import Page from './lib/Page'; import Page from './lib/Page';
import SettingRepository from "./lib/SettingRepository";
import Settings from "../src/shared/settings/Settings";
describe("clipboard test", () => { describe("clipboard test", () => {
let server = new TestServer(12321).receiveContent('/happy', 'ok'); let server = new TestServer(12321).receiveContent('/happy', 'ok');
@ -23,9 +24,14 @@ describe("clipboard test", () => {
webdriver = lanthan.getWebDriver(); webdriver = lanthan.getWebDriver();
browser = lanthan.getWebExtBrowser(); browser = lanthan.getWebExtBrowser();
await browser.storage.local.set({ await new SettingRepository(browser).saveJSON(Settings.fromJSON({
settings, search: {
}); default: "google",
engines: {
"google": "http://127.0.0.1:12321/google?q={}",
},
},
}));
await server.start(); await server.start();
}); });
@ -42,7 +48,7 @@ describe("clipboard test", () => {
for (let tab of tabs.slice(1)) { for (let tab of tabs.slice(1)) {
await browser.tabs.remove(tab.id); await browser.tabs.remove(tab.id);
} }
}) });
it('should copy current URL by y', async () => { it('should copy current URL by y', async () => {
let page = await Page.navigateTo(webdriver, server.url('/#should_copy_url')); let page = await Page.navigateTo(webdriver, server.url('/#should_copy_url'));

@ -10,7 +10,7 @@ import Page from './lib/Page';
describe('addbookmark command test', () => { describe('addbookmark command test', () => {
let server = new TestServer().receiveContent('/happy', ` let server = new TestServer().receiveContent('/happy', `
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"><head><title>how to be happy</title></head></html">`, <html lang="en"><head><title>how to be happy</title></head></html>`,
); );
let lanthan: Lanthan; let lanthan: Lanthan;
let webdriver: WebDriver; let webdriver: WebDriver;

@ -36,10 +36,10 @@ describe('bdelete/bdeletes command test', () => {
await browser.tabs.remove(tab.id); await browser.tabs.remove(tab.id);
} }
await browser.tabs.update(tabs[0].id, { url: server.url('/site1'), pinned: true }); await browser.tabs.update(tabs[0].id, { url: server.url('/site1'), pinned: true });
await browser.tabs.create({ url: server.url('/site2'), pinned: true }) await browser.tabs.create({ url: server.url('/site2'), pinned: true });
await browser.tabs.create({ url: server.url('/site3'), pinned: true }) await browser.tabs.create({ url: server.url('/site3'), pinned: true });
await browser.tabs.create({ url: server.url('/site4'), }) await browser.tabs.create({ url: server.url('/site4'), });
await browser.tabs.create({ url: server.url('/site5'), }) await browser.tabs.create({ url: server.url('/site5'), });
await eventually(async() => { await eventually(async() => {
let handles = await webdriver.getAllWindowHandles(); let handles = await webdriver.getAllWindowHandles();

@ -16,7 +16,7 @@ describe('buffer command test', () => {
<head> <head>
<title>my_${req.path.slice(1)}</title> <title>my_${req.path.slice(1)}</title>
</head> </head>
</html">`); </html>`);
}); });
let lanthan: Lanthan; let lanthan: Lanthan;
let webdriver: WebDriver; let webdriver: WebDriver;

@ -34,7 +34,7 @@ describe("help command test", () => {
beforeEach(async() => { beforeEach(async() => {
page = await Page.navigateTo(webdriver, server.url()); page = await Page.navigateTo(webdriver, server.url());
}) });
it('should open help page by help command ', async() => { it('should open help page by help command ', async() => {
let console = await page.showConsole(); let console = await page.showConsole();

@ -2,14 +2,15 @@ import * as path from 'path';
import * as assert from 'assert'; import * as assert from 'assert';
import TestServer from './lib/TestServer'; import TestServer from './lib/TestServer';
import settings from './settings';
import eventually from './eventually'; import eventually from './eventually';
import { Builder, Lanthan } from 'lanthan'; import { Builder, Lanthan } from 'lanthan';
import { WebDriver } from 'selenium-webdriver'; import { WebDriver } from 'selenium-webdriver';
import Page from './lib/Page'; import Page from './lib/Page';
import SettingRepository from "./lib/SettingRepository";
import Settings from "../src/shared/settings/Settings";
describe("open command test", () => { describe("open command test", () => {
let server = new TestServer(12321) let server = new TestServer()
.receiveContent('/google', 'google') .receiveContent('/google', 'google')
.receiveContent('/yahoo', 'yahoo'); .receiveContent('/yahoo', 'yahoo');
let lanthan: Lanthan; let lanthan: Lanthan;
@ -25,11 +26,16 @@ describe("open command test", () => {
webdriver = lanthan.getWebDriver(); webdriver = lanthan.getWebDriver();
browser = lanthan.getWebExtBrowser(); browser = lanthan.getWebExtBrowser();
await browser.storage.local.set({
settings,
});
await server.start(); await server.start();
await new SettingRepository(browser).saveJSON(Settings.fromJSON({
search: {
default: "google",
engines: {
"google": server.url('/google?q={}'),
"yahoo": server.url('/yahoo?q={}'),
},
},
}));
}); });
after(async() => { after(async() => {
@ -42,7 +48,7 @@ describe("open command test", () => {
beforeEach(async() => { beforeEach(async() => {
await webdriver.switchTo().defaultContent(); await webdriver.switchTo().defaultContent();
page = await Page.navigateTo(webdriver, server.url()); page = await Page.navigateTo(webdriver, server.url());
}) });
it('should open default search for keywords by open command ', async() => { it('should open default search for keywords by open command ', async() => {
let console = await page.showConsole(); let console = await page.showConsole();
@ -60,7 +66,7 @@ describe("open command test", () => {
await console.execCommand('open yahoo an apple'); await console.execCommand('open yahoo an apple');
await eventually(async() => { await eventually(async() => {
let tabs = await browser.tabs.query({ active: true }) let tabs = await browser.tabs.query({ active: true });
let url = new URL(tabs[0].url); let url = new URL(tabs[0].url);
assert.strictEqual(url.href, server.url('/yahoo?q=an%20apple')) assert.strictEqual(url.href, server.url('/yahoo?q=an%20apple'))
}); });
@ -71,7 +77,7 @@ describe("open command test", () => {
await console.execCommand('open'); await console.execCommand('open');
await eventually(async() => { await eventually(async() => {
let tabs = await browser.tabs.query({ active: true }) let tabs = await browser.tabs.query({ active: true });
let url = new URL(tabs[0].url); let url = new URL(tabs[0].url);
assert.strictEqual(url.href, server.url('/google?q=')) assert.strictEqual(url.href, server.url('/google?q='))
}); });
@ -82,7 +88,7 @@ describe("open command test", () => {
await console.execCommand('open yahoo'); await console.execCommand('open yahoo');
await eventually(async() => { await eventually(async() => {
let tabs = await browser.tabs.query({ active: true }) let tabs = await browser.tabs.query({ active: true });
let url = new URL(tabs[0].url); let url = new URL(tabs[0].url);
assert.strictEqual(url.href, server.url('/yahoo?q=')) assert.strictEqual(url.href, server.url('/yahoo?q='))
}); });
@ -93,7 +99,7 @@ describe("open command test", () => {
await console.execCommand('open example.com'); await console.execCommand('open example.com');
await eventually(async() => { await eventually(async() => {
let tabs = await browser.tabs.query({ active: true }) let tabs = await browser.tabs.query({ active: true });
let url = new URL(tabs[0].url); let url = new URL(tabs[0].url);
assert.strictEqual(url.href, 'http://example.com/') assert.strictEqual(url.href, 'http://example.com/')
}); });
@ -104,7 +110,7 @@ describe("open command test", () => {
await console.execCommand('open https://example.com/'); await console.execCommand('open https://example.com/');
await eventually(async() => { await eventually(async() => {
let tabs = await browser.tabs.query({ active: true }) let tabs = await browser.tabs.query({ active: true });
let url = new URL(tabs[0].url); let url = new URL(tabs[0].url);
assert.strictEqual(url.href, 'https://example.com/') assert.strictEqual(url.href, 'https://example.com/')
}); });

@ -2,14 +2,15 @@ import * as path from 'path';
import * as assert from 'assert'; import * as assert from 'assert';
import TestServer from './lib/TestServer'; import TestServer from './lib/TestServer';
import settings from './settings';
import eventually from './eventually'; import eventually from './eventually';
import { Builder, Lanthan } from 'lanthan'; import { Builder, Lanthan } from 'lanthan';
import { WebDriver } from 'selenium-webdriver'; import { WebDriver } from 'selenium-webdriver';
import Page from './lib/Page'; import Page from './lib/Page';
import SettingRepository from "./lib/SettingRepository";
import Settings from "../src/shared/settings/Settings";
describe("tabopen command test", () => { describe("tabopen command test", () => {
let server = new TestServer(12321) let server = new TestServer()
.receiveContent('/google', 'google') .receiveContent('/google', 'google')
.receiveContent('/yahoo', 'yahoo'); .receiveContent('/yahoo', 'yahoo');
let lanthan: Lanthan; let lanthan: Lanthan;
@ -25,11 +26,16 @@ describe("tabopen command test", () => {
webdriver = lanthan.getWebDriver(); webdriver = lanthan.getWebDriver();
browser = lanthan.getWebExtBrowser(); browser = lanthan.getWebExtBrowser();
await browser.storage.local.set({
settings,
});
await server.start(); await server.start();
await new SettingRepository(browser).saveJSON(Settings.fromJSON({
search: {
default: "google",
engines: {
"google": server.url('/google?q={}'),
"yahoo": server.url('/yahoo?q={}'),
},
},
}));
}); });
after(async() => { after(async() => {
@ -46,7 +52,7 @@ describe("tabopen command test", () => {
} }
page = await Page.navigateTo(webdriver, server.url()); page = await Page.navigateTo(webdriver, server.url());
}) });
it('should open default search for keywords by tabopen command ', async() => { it('should open default search for keywords by tabopen command ', async() => {
let console = await page.showConsole(); let console = await page.showConsole();

@ -2,14 +2,15 @@ import * as path from 'path';
import * as assert from 'assert'; import * as assert from 'assert';
import TestServer from './lib/TestServer'; import TestServer from './lib/TestServer';
import settings from './settings';
import eventually from './eventually'; import eventually from './eventually';
import { Builder, Lanthan } from 'lanthan'; import { Builder, Lanthan } from 'lanthan';
import { WebDriver } from 'selenium-webdriver'; import { WebDriver } from 'selenium-webdriver';
import Page from './lib/Page'; import Page from './lib/Page';
import SettingRepository from "./lib/SettingRepository";
import Settings from "../src/shared/settings/Settings";
describe("winopen command test", () => { describe("winopen command test", () => {
let server = new TestServer(12321) let server = new TestServer()
.receiveContent('/google', 'google') .receiveContent('/google', 'google')
.receiveContent('/yahoo', 'yahoo'); .receiveContent('/yahoo', 'yahoo');
let lanthan: Lanthan; let lanthan: Lanthan;
@ -24,11 +25,17 @@ describe("winopen command test", () => {
.build(); .build();
webdriver = lanthan.getWebDriver(); webdriver = lanthan.getWebDriver();
browser = lanthan.getWebExtBrowser(); browser = lanthan.getWebExtBrowser();
await browser.storage.local.set({
settings,
});
await server.start(); await server.start();
await new SettingRepository(browser).saveJSON(Settings.fromJSON({
search: {
default: "google",
engines: {
"google": server.url('/google?q={}'),
"yahoo": server.url('/yahoo?q={}'),
},
},
}));
}); });
after(async() => { after(async() => {
@ -45,7 +52,7 @@ describe("winopen command test", () => {
} }
page = await Page.navigateTo(webdriver, server.url()); page = await Page.navigateTo(webdriver, server.url());
}) });
it('should open default search for keywords by winopen command ', async() => { it('should open default search for keywords by winopen command ', async() => {
let console = await page.showConsole(); let console = await page.showConsole();

@ -2,7 +2,6 @@ import * as path from 'path';
import * as assert from 'assert'; import * as assert from 'assert';
import eventually from './eventually'; import eventually from './eventually';
import settings from './settings';
import { Builder, Lanthan } from 'lanthan'; import { Builder, Lanthan } from 'lanthan';
import { WebDriver, Key } from 'selenium-webdriver'; import { WebDriver, Key } from 'selenium-webdriver';
import Page from './lib/Page'; import Page from './lib/Page';
@ -10,7 +9,6 @@ import Page from './lib/Page';
describe("general completion test", () => { describe("general completion test", () => {
let lanthan: Lanthan; let lanthan: Lanthan;
let webdriver: WebDriver; let webdriver: WebDriver;
let browser: any;
let page: Page; let page: Page;
before(async() => { before(async() => {
@ -19,11 +17,6 @@ describe("general completion test", () => {
.spyAddon(path.join(__dirname, '..')) .spyAddon(path.join(__dirname, '..'))
.build(); .build();
webdriver = lanthan.getWebDriver(); webdriver = lanthan.getWebDriver();
browser = lanthan.getWebExtBrowser();
await browser.storage.local.set({
settings,
});
}); });
after(async() => { after(async() => {
@ -42,8 +35,8 @@ describe("general completion test", () => {
let items = await console.getCompletions(); let items = await console.getCompletions();
assert.strictEqual(items.length, 11); assert.strictEqual(items.length, 11);
assert.deepStrictEqual(items[0], { type: 'title', text: 'Console Command' }); assert.deepStrictEqual(items[0], { type: 'title', text: 'Console Command' });
assert.ok(items[1].text.startsWith('set')) assert.ok(items[1].text.startsWith('set'));
assert.ok(items[2].text.startsWith('open')) assert.ok(items[2].text.startsWith('open'));
assert.ok(items[3].text.startsWith('tabopen')) assert.ok(items[3].text.startsWith('tabopen'))
}); });
@ -54,8 +47,8 @@ describe("general completion test", () => {
let items = await console.getCompletions(); let items = await console.getCompletions();
assert.strictEqual(items.length, 4); assert.strictEqual(items.length, 4);
assert.deepStrictEqual(items[0], { type: 'title', text: 'Console Command' }); assert.deepStrictEqual(items[0], { type: 'title', text: 'Console Command' });
assert.ok(items[1].text.startsWith('buffer')) assert.ok(items[1].text.startsWith('buffer'));
assert.ok(items[2].text.startsWith('bdelete')) assert.ok(items[2].text.startsWith('bdelete'));
assert.ok(items[3].text.startsWith('bdeletes')) assert.ok(items[3].text.startsWith('bdeletes'))
}); });
@ -74,14 +67,14 @@ describe("general completion test", () => {
await console.sendKeys(Key.TAB); await console.sendKeys(Key.TAB);
await eventually(async() => { await eventually(async() => {
let items = await console.getCompletions(); let items = await console.getCompletions();
assert.ok(items[1].highlight) assert.ok(items[1].highlight);
assert.strictEqual(await console.currentValue(), 'buffer'); assert.strictEqual(await console.currentValue(), 'buffer');
}); });
await console.sendKeys(Key.TAB, Key.TAB); await console.sendKeys(Key.TAB, Key.TAB);
await eventually(async() => { await eventually(async() => {
let items = await console.getCompletions(); let items = await console.getCompletions();
assert.ok(items[3].highlight) assert.ok(items[3].highlight);
assert.strictEqual(await console.currentValue(), 'bdeletes'); assert.strictEqual(await console.currentValue(), 'bdeletes');
}); });
@ -93,7 +86,7 @@ describe("general completion test", () => {
await console.sendKeys(Key.SHIFT, Key.TAB); await console.sendKeys(Key.SHIFT, Key.TAB);
await eventually(async() => { await eventually(async() => {
let items = await console.getCompletions(); let items = await console.getCompletions();
assert.ok(items[3].highlight) assert.ok(items[3].highlight);
assert.strictEqual(await console.currentValue(), 'bdeletes'); assert.strictEqual(await console.currentValue(), 'bdeletes');
}); });
}); });

@ -3,7 +3,6 @@ import * as path from 'path';
import { Request, Response } from 'express' import { Request, Response } from 'express'
import TestServer from './lib/TestServer'; import TestServer from './lib/TestServer';
import settings from './settings';
import eventually from './eventually'; import eventually from './eventually';
import { Builder, Lanthan } from 'lanthan'; import { Builder, Lanthan } from 'lanthan';
import { WebDriver } from 'selenium-webdriver'; import { WebDriver } from 'selenium-webdriver';
@ -17,7 +16,7 @@ describe("completion on buffer/bdelete/bdeletes", () => {
<head> <head>
<title>title_${req.path.slice(1)}</title> <title>title_${req.path.slice(1)}</title>
</head> </head>
</html">`); </html>`);
}); });
let lanthan: Lanthan; let lanthan: Lanthan;
let webdriver: WebDriver; let webdriver: WebDriver;
@ -32,10 +31,6 @@ describe("completion on buffer/bdelete/bdeletes", () => {
webdriver = lanthan.getWebDriver(); webdriver = lanthan.getWebDriver();
browser = lanthan.getWebExtBrowser(); browser = lanthan.getWebExtBrowser();
await browser.storage.local.set({
settings,
});
await server.start(); await server.start();
}); });
@ -53,7 +48,7 @@ describe("completion on buffer/bdelete/bdeletes", () => {
} }
await browser.tabs.update(tabs[0].id, { url: server.url('/site1'), pinned: true }); await browser.tabs.update(tabs[0].id, { url: server.url('/site1'), pinned: true });
await browser.tabs.create({ url:server.url('/site2'), pinned: true }) await browser.tabs.create({ url:server.url('/site2'), pinned: true });
for (let i = 3; i <= 5; ++i) { for (let i = 3; i <= 5; ++i) {
await browser.tabs.create({ url: server.url('/site' + i) }); await browser.tabs.create({ url: server.url('/site' + i) });
} }
@ -84,7 +79,7 @@ describe("completion on buffer/bdelete/bdeletes", () => {
assert.ok(items[3].text.includes('%')); assert.ok(items[3].text.includes('%'));
assert.ok(items[5].text.includes('#')); assert.ok(items[5].text.includes('#'));
}); });
}) });
it('should filter items with URLs by keywords on "buffer" command', async() => { it('should filter items with URLs by keywords on "buffer" command', async() => {
let console = await page.showConsole(); let console = await page.showConsole();
@ -97,7 +92,7 @@ describe("completion on buffer/bdelete/bdeletes", () => {
assert.ok(items[1].text.includes('title_site2')); assert.ok(items[1].text.includes('title_site2'));
assert.ok(items[1].text.includes(server.url('/site2'))); assert.ok(items[1].text.includes(server.url('/site2')));
}); });
}) });
it('should filter items with titles by keywords on "buffer" command', async() => { it('should filter items with titles by keywords on "buffer" command', async() => {
let console = await page.showConsole(); let console = await page.showConsole();
@ -108,7 +103,7 @@ describe("completion on buffer/bdelete/bdeletes", () => {
assert.deepStrictEqual(items[0], { type: 'title', text: 'Buffers' }); assert.deepStrictEqual(items[0], { type: 'title', text: 'Buffers' });
assert.ok(items[1].text.startsWith('2:')); assert.ok(items[1].text.startsWith('2:'));
}); });
}) });
it('should show one item by number on "buffer" command', async() => { it('should show one item by number on "buffer" command', async() => {
let console = await page.showConsole(); let console = await page.showConsole();
@ -120,7 +115,7 @@ describe("completion on buffer/bdelete/bdeletes", () => {
assert.deepStrictEqual(items[0], { type: 'title', text: 'Buffers' }); assert.deepStrictEqual(items[0], { type: 'title', text: 'Buffers' });
assert.ok(items[1].text.startsWith('2:')); assert.ok(items[1].text.startsWith('2:'));
}); });
}) });
it('should show unpinned tabs "bdelete" command', async() => { it('should show unpinned tabs "bdelete" command', async() => {
let console = await page.showConsole(); let console = await page.showConsole();
@ -133,7 +128,7 @@ describe("completion on buffer/bdelete/bdeletes", () => {
assert.ok(items[2].text.includes('site4')); assert.ok(items[2].text.includes('site4'));
assert.ok(items[3].text.includes('site5')); assert.ok(items[3].text.includes('site5'));
}); });
}) });
it('should show unpinned tabs "bdeletes" command', async() => { it('should show unpinned tabs "bdeletes" command', async() => {
let console = await page.showConsole(); let console = await page.showConsole();
@ -146,7 +141,7 @@ describe("completion on buffer/bdelete/bdeletes", () => {
assert.ok(items[2].text.includes('site4')); assert.ok(items[2].text.includes('site4'));
assert.ok(items[3].text.includes('site5')); assert.ok(items[3].text.includes('site5'));
}); });
}) });
it('should show both pinned and unpinned tabs "bdelete!" command', async() => { it('should show both pinned and unpinned tabs "bdelete!" command', async() => {
let console = await page.showConsole(); let console = await page.showConsole();
@ -161,7 +156,7 @@ describe("completion on buffer/bdelete/bdeletes", () => {
assert.ok(items[4].text.includes('site4')); assert.ok(items[4].text.includes('site4'));
assert.ok(items[5].text.includes('site5')); assert.ok(items[5].text.includes('site5'));
}); });
}) });
it('should show both pinned and unpinned tabs "bdeletes!" command', async() => { it('should show both pinned and unpinned tabs "bdeletes!" command', async() => {
let console = await page.showConsole(); let console = await page.showConsole();
@ -176,5 +171,5 @@ describe("completion on buffer/bdelete/bdeletes", () => {
assert.ok(items[4].text.includes('site4')); assert.ok(items[4].text.includes('site4'));
assert.ok(items[5].text.includes('site5')); assert.ok(items[5].text.includes('site5'));
}); });
}) });
}); });

@ -1,12 +1,13 @@
import * as path from 'path'; import * as path from 'path';
import * as assert from 'assert'; import * as assert from 'assert';
import Settings from "../src/shared/settings/Settings";
import TestServer from './lib/TestServer'; import TestServer from './lib/TestServer';
import settings from './settings';
import eventually from './eventually'; import eventually from './eventually';
import { Builder, Lanthan } from 'lanthan'; import { Builder, Lanthan } from 'lanthan';
import { WebDriver } from 'selenium-webdriver'; import { WebDriver } from 'selenium-webdriver';
import Page from './lib/Page'; import Page from './lib/Page';
import SettingRepository from "./lib/SettingRepository";
describe("completion on open/tabopen/winopen commands", () => { describe("completion on open/tabopen/winopen commands", () => {
let server = new TestServer().receiveContent('/*', 'ok'); let server = new TestServer().receiveContent('/*', 'ok');
@ -25,10 +26,6 @@ describe("completion on open/tabopen/winopen commands", () => {
webdriver = lanthan.getWebDriver(); webdriver = lanthan.getWebDriver();
browser = lanthan.getWebExtBrowser(); browser = lanthan.getWebExtBrowser();
await browser.storage.local.set({
settings,
});
// Add item into hitories // Add item into hitories
await webdriver.navigate().to(('https://i-beam.org/404')); await webdriver.navigate().to(('https://i-beam.org/404'));
}); });
@ -65,7 +62,7 @@ describe("completion on open/tabopen/winopen commands", () => {
let items = completions.filter(x => x.type === 'item').map(x => x.text); let items = completions.filter(x => x.type === 'item').map(x => x.text);
assert.ok(items.every(x => x.includes('https://'))); assert.ok(items.every(x => x.includes('https://')));
}); });
}) });
it('should filter items with titles by keywords on "open" command', async() => { it('should filter items with titles by keywords on "open" command', async() => {
let console = await page.showConsole(); let console = await page.showConsole();
@ -76,7 +73,7 @@ describe("completion on open/tabopen/winopen commands", () => {
let items = completions.filter(x => x.type === 'item').map(x => x.text); let items = completions.filter(x => x.type === 'item').map(x => x.text);
assert.ok(items.every(x => x.toLowerCase().includes('getting'))); assert.ok(items.every(x => x.toLowerCase().includes('getting')));
}); });
}) });
it('should filter items with titles by keywords on "tabopen" command', async() => { it('should filter items with titles by keywords on "tabopen" command', async() => {
let console = await page.showConsole(); let console = await page.showConsole();
@ -87,7 +84,7 @@ describe("completion on open/tabopen/winopen commands", () => {
let items = completions.filter(x => x.type === 'item').map(x => x.text); let items = completions.filter(x => x.type === 'item').map(x => x.text);
assert.ok(items.every(x => x.includes('https://'))); assert.ok(items.every(x => x.includes('https://')));
}); });
}) });
it('should filter items with titles by keywords on "winopen" command', async() => { it('should filter items with titles by keywords on "winopen" command', async() => {
let console = await page.showConsole(); let console = await page.showConsole();
@ -98,7 +95,7 @@ describe("completion on open/tabopen/winopen commands", () => {
let items = completions.filter(x => x.type === 'item').map(x => x.text); let items = completions.filter(x => x.type === 'item').map(x => x.text);
assert.ok(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() => { it('should display only specified items in "complete" property by set command', async() => {
let console = await page.showConsole(); let console = await page.showConsole();
@ -127,24 +124,12 @@ describe("completion on open/tabopen/winopen commands", () => {
let titles = completions.filter(x => x.type === 'title').map(x => x.text); let titles = completions.filter(x => x.type === 'title').map(x => x.text);
assert.deepStrictEqual(titles, ['Bookmarks', 'Search Engines', 'Search Engines']) assert.deepStrictEqual(titles, ['Bookmarks', 'Search Engines', 'Search Engines'])
}); });
}) });
it('should display only specified items in "complete" property by setting', async() => { it('should display only specified items in "complete" property by setting', async() => {
await browser.storage.local.set({ settings: { new SettingRepository(browser).saveJSON(Settings.fromJSON({
source: 'json', properties: { complete: "sbh" },
json: `{ }));
"keymaps": {
":": { "type": "command.show" }
},
"search": {
"default": "google",
"engines": { "google": "https://google.com/search?q={}" }
},
"properties": {
"complete": "sbh"
}
}`,
}});
let console = await page.showConsole(); let console = await page.showConsole();
await console.inputKeys('open '); await console.inputKeys('open ');
@ -158,21 +143,9 @@ describe("completion on open/tabopen/winopen commands", () => {
await console.close(); await console.close();
await (webdriver.switchTo() as any).parentFrame(); await (webdriver.switchTo() as any).parentFrame();
await browser.storage.local.set({ settings: { new SettingRepository(browser).saveJSON(Settings.fromJSON({
source: 'json', properties: { complete: "bss" },
json: `{ }));
"keymaps": {
":": { "type": "command.show" }
},
"search": {
"default": "google",
"engines": { "google": "https://google.com/search?q={}" }
},
"properties": {
"complete": "bss"
}
}`,
}});
console = await page.showConsole(); console = await page.showConsole();
await console.inputKeys('open '); await console.inputKeys('open ');
@ -182,5 +155,5 @@ describe("completion on open/tabopen/winopen commands", () => {
let titles = completions.filter(x => x.type === 'title').map(x => x.text); let titles = completions.filter(x => x.type === 'title').map(x => x.text);
assert.deepStrictEqual(titles, ['Bookmarks', 'Search Engines', 'Search Engines']) assert.deepStrictEqual(titles, ['Bookmarks', 'Search Engines', 'Search Engines'])
}); });
}) });
}); });

@ -1,7 +1,6 @@
import * as path from 'path'; import * as path from 'path';
import * as assert from 'assert'; import * as assert from 'assert';
import settings from './settings';
import eventually from './eventually'; import eventually from './eventually';
import { Builder, Lanthan } from 'lanthan'; import { Builder, Lanthan } from 'lanthan';
import { WebDriver } from 'selenium-webdriver'; import { WebDriver } from 'selenium-webdriver';
@ -10,7 +9,6 @@ import Page from './lib/Page';
describe("completion on set commands", () => { describe("completion on set commands", () => {
let lanthan: Lanthan; let lanthan: Lanthan;
let webdriver: WebDriver; let webdriver: WebDriver;
let browser: any;
let page: Page; let page: Page;
before(async() => { before(async() => {
@ -19,11 +17,6 @@ describe("completion on set commands", () => {
.spyAddon(path.join(__dirname, '..')) .spyAddon(path.join(__dirname, '..'))
.build(); .build();
webdriver = lanthan.getWebDriver(); webdriver = lanthan.getWebDriver();
browser = lanthan.getWebExtBrowser();
await browser.storage.local.set({
settings,
});
}); });
after(async() => { after(async() => {
@ -44,9 +37,9 @@ describe("completion on set commands", () => {
let items = await console.getCompletions(); let items = await console.getCompletions();
assert.strictEqual(items.length, 5); assert.strictEqual(items.length, 5);
assert.deepStrictEqual(items[0], { type: 'title', text: 'Properties' }); assert.deepStrictEqual(items[0], { type: 'title', text: 'Properties' });
assert.ok(items[1].text.startsWith('hintchars')) assert.ok(items[1].text.startsWith('hintchars'));
assert.ok(items[2].text.startsWith('smoothscroll')) assert.ok(items[2].text.startsWith('smoothscroll'));
assert.ok(items[3].text.startsWith('nosmoothscroll')) assert.ok(items[3].text.startsWith('nosmoothscroll'));
assert.ok(items[4].text.startsWith('complete')) assert.ok(items[4].text.startsWith('complete'))
}); });
}); });

@ -7,8 +7,8 @@ import { WebDriver, Key } from 'selenium-webdriver';
import Page from './lib/Page'; import Page from './lib/Page';
describe("console test", () => { describe("console test", () => {
let server = new TestServer().receiveContent('/', let server = new TestServer().receiveContent('/',
`<!DOCTYPE html><html lang="en"><head><title>Hello, world!</title></head></html">`, `<!DOCTYPE html><html lang="en"><head><title>Hello, world!</title></head></html>`,
); );
let lanthan: Lanthan; let lanthan: Lanthan;
let webdriver: WebDriver; let webdriver: WebDriver;

@ -14,13 +14,13 @@ const newApp = () => {
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"><body> <html lang="en"><body>
<a href="hello">hello</a> <a href="hello">hello</a>
</body></html">`); </body></html>`);
server.receiveContent('/follow-input', ` server.receiveContent('/follow-input', `
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"><body> <html lang="en"><body>
<input> <input>
</body></html">`); </body></html>`);
server.receiveContent('/area', ` server.receiveContent('/area', `
<!DOCTYPE html> <!DOCTYPE html>
@ -34,8 +34,8 @@ const newApp = () => {
<area shape="rect" coords="64,64,64,64" href="/"> <area shape="rect" coords="64,64,64,64" href="/">
<area shape="rect" coords="128,128,64,64" href="/"> <area shape="rect" coords="128,128,64,64" href="/">
</map> </map>
</body></html">`); </body></html>`);
/* /*
* test case: link2 is out of the viewport * test case: link2 is out of the viewport
* +-----------------+ * +-----------------+
@ -52,7 +52,7 @@ const newApp = () => {
<div><a href="link1">link1</a></div> <div><a href="link1">link1</a></div>
<div style="min-height:3000px"></div> <div style="min-height:3000px"></div>
<div><a href="link2">link2</a></div> <div><a href="link2">link2</a></div>
</body></html">`); </body></html>`);
/* /*
* test case 2: link2 and link3 are out of window of the frame * test case 2: link2 and link3 are out of window of the frame
@ -69,14 +69,14 @@ const newApp = () => {
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"><body> <html lang="en"><body>
<iframe height="5000" src='/test2-frame'> <iframe height="5000" src='/test2-frame'>
</body></html">`); </body></html>`);
server.receiveContent('/test2-frame', ` server.receiveContent('/test2-frame', `
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"><body> <html lang="en"><body>
<div><a href="link1">link1</a></div> <div><a href="link1">link1</a></div>
<div style="min-height:3000px"></div> <div style="min-height:3000px"></div>
<div><a href="link2">link2</a></div> <div><a href="link2">link2</a></div>
</body></html">`); </body></html>`);
/* test case 3: link2 is out of window of the frame /* test case 3: link2 is out of window of the frame
* +-----------------+ * +-----------------+
@ -92,14 +92,14 @@ const newApp = () => {
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"><body> <html lang="en"><body>
<iframe src='/test3-frame'> <iframe src='/test3-frame'>
</body></html">`); </body></html>`);
server.receiveContent('/test3-frame', ` server.receiveContent('/test3-frame', `
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"><body> <html lang="en"><body>
<div><a href="link1">link1</a></div> <div><a href="link1">link1</a></div>
<div style="min-height:3000px"></div> <div style="min-height:3000px"></div>
<div><a href="link2">link2</a></div> <div><a href="link2">link2</a></div>
</body></html">`); </body></html>`);
return server; return server;
}; };

@ -16,7 +16,7 @@ describe('follow properties test', () => {
<a href="/">link3</a> <a href="/">link3</a>
<a href="/">link4</a> <a href="/">link4</a>
<a href="/">link5</a> <a href="/">link5</a>
</body></html">`); </body></html>`);
let lanthan: Lanthan; let lanthan: Lanthan;
let webdriver: WebDriver; let webdriver: WebDriver;

@ -0,0 +1,18 @@
import { JSONTextSettings, SettingSource } from '../../src/shared/SettingData';
import Settings from '../../src/shared/settings/Settings';
export default class SettingRepository {
constructor(
private readonly browser: any,
) {
}
async saveJSON(settings: Settings): Promise<void> {
await this.browser.storage.local.set({
settings: {
source: SettingSource.JSON,
json: JSONTextSettings.fromSettings(settings).toJSONText(),
}
});
}
}

@ -9,7 +9,7 @@ import Page from './lib/Page';
describe("mark test", () => { describe("mark test", () => {
let server = new TestServer().receiveContent('/', let server = new TestServer().receiveContent('/',
`<!DOCTYPE html><html lang="en"><body style="width:10000px; height:10000px"></body></html">`, `<!DOCTYPE html><html lang="en"><body style="width:10000px; height:10000px"></body></html>`,
); );
let lanthan: Lanthan; let lanthan: Lanthan;
let webdriver: WebDriver; let webdriver: WebDriver;

@ -16,7 +16,7 @@ const newApp = () => {
<html lang="en"> <html lang="en">
<a href="/pagenation-a/${Number(req.params.page) - 1}">prev</a> <a href="/pagenation-a/${Number(req.params.page) - 1}">prev</a>
<a href="/pagenation-a/${Number(req.params.page) + 1}">next</a> <a href="/pagenation-a/${Number(req.params.page) + 1}">next</a>
</html">`); </html>`);
}); });
server.handle('/pagenation-link/:page', (req, res) => { server.handle('/pagenation-link/:page', (req, res) => {
@ -27,7 +27,7 @@ const newApp = () => {
<link rel="prev" href="/pagenation-link/${Number(req.params.page) - 1}"></link> <link rel="prev" href="/pagenation-link/${Number(req.params.page) - 1}"></link>
<link rel="next" href="/pagenation-link/${Number(req.params.page) + 1}"></link> <link rel="next" href="/pagenation-link/${Number(req.params.page) + 1}"></link>
</head> </head>
</html">`); </html>`);
}); });
server.receiveContent('/reload', ` server.receiveContent('/reload', `
<!DOCTYPE html> <!DOCTYPE html>
@ -36,7 +36,7 @@ const newApp = () => {
<script>window.location.hash = Date.now()</script> <script>window.location.hash = Date.now()</script>
</head> </head>
<body style="width:10000px; height:10000px"></body> <body style="width:10000px; height:10000px"></body>
</html">`); </html>`);
server.receiveContent('/*', `ok`); server.receiveContent('/*', `ok`);
@ -75,7 +75,7 @@ describe("navigate test", () => {
for (let tab of tabs.slice(1)) { for (let tab of tabs.slice(1)) {
await browser.tabs.remove(tab.id); await browser.tabs.remove(tab.id);
} }
}) });
it('should go to parent path without hash by gu', async () => { it('should go to parent path without hash by gu', async () => {
let page = await Page.navigateTo(webdriver, server.url('/a/b/c')); let page = await Page.navigateTo(webdriver, server.url('/a/b/c'));
@ -95,7 +95,7 @@ describe("navigate test", () => {
await eventually(async() => { await eventually(async() => {
let tab = (await browser.tabs.query({}))[0]; let tab = (await browser.tabs.query({}))[0];
let url = new URL(tab.url); let url = new URL(tab.url);
assert.strictEqual(url.hash, '') assert.strictEqual(url.hash, '');
assert.strictEqual(url.pathname, `/a/b/c`) assert.strictEqual(url.pathname, `/a/b/c`)
}); });
}); });
@ -213,7 +213,7 @@ describe("navigate test", () => {
await page.sendKeys('r'); await page.sendKeys('r');
let after let after;
await eventually(async() => { await eventually(async() => {
let tab = (await browser.tabs.query({}))[0]; let tab = (await browser.tabs.query({}))[0];
after = Number(new URL(tab.url).hash.split('#')[1]); after = Number(new URL(tab.url).hash.split('#')[1]);
@ -239,7 +239,7 @@ describe("navigate test", () => {
await page.sendKeys(Key.SHIFT, 'R'); await page.sendKeys(Key.SHIFT, 'R');
let after let after;
await eventually(async() => { await eventually(async() => {
let tab = (await browser.tabs.query({}))[0]; let tab = (await browser.tabs.query({}))[0];
after = Number(new URL(tab.url).hash.split('#')[1]); after = Number(new URL(tab.url).hash.split('#')[1]);

@ -10,7 +10,7 @@ import OptionPage from './lib/OptionPage';
describe("options page", () => { describe("options page", () => {
let server = new TestServer().receiveContent('/', let server = new TestServer().receiveContent('/',
`<!DOCTYPE html><html lang="en"><body style="width:10000px; height:10000px"></body></html">`, `<!DOCTYPE html><html lang="en"><body style="width:10000px; height:10000px"></body></html>`,
); );
let lanthan: Lanthan; let lanthan: Lanthan;
let webdriver: WebDriver; let webdriver: WebDriver;
@ -39,22 +39,22 @@ describe("options page", () => {
for (let tab of tabs.slice(1)) { for (let tab of tabs.slice(1)) {
await browser.tabs.remove(tab.id); await browser.tabs.remove(tab.id);
} }
}) });
it('saves current config on blur', async () => { it('saves current config on blur', async () => {
let page = await OptionPage.open(lanthan); let page = await OptionPage.open(lanthan);
let jsonPage = await page.asJSONOptionPage(); let jsonPage = await page.asJSONOptionPage();
await jsonPage.updateSettings(`{ "blacklist": [ "https://example.com" ] }`) await jsonPage.updateSettings(`{ "blacklist": [ "https://example.com" ] }`);
let { settings } = await browser.storage.local.get('settings'); let { settings } = await browser.storage.local.get('settings');
assert.strictEqual(settings.source, 'json') assert.strictEqual(settings.source, 'json');
assert.strictEqual(settings.json, '{ "blacklist": [ "https://example.com" ] } ') assert.strictEqual(settings.json, '{ "blacklist": [ "https://example.com" ] } ');
await jsonPage.updateSettings(`invalid json`); await jsonPage.updateSettings(`invalid json`);
settings = (await browser.storage.local.get('settings')).settings; settings = (await browser.storage.local.get('settings')).settings;
assert.strictEqual(settings.source, 'json') assert.strictEqual(settings.source, 'json');
assert.strictEqual(settings.json, '{ "blacklist": [ "https://example.com" ] } ') assert.strictEqual(settings.json, '{ "blacklist": [ "https://example.com" ] } ');
let message = await jsonPage.getErrorMessage(); let message = await jsonPage.getErrorMessage();
assert.ok(message.startsWith('SyntaxError:')) assert.ok(message.startsWith('SyntaxError:'))

@ -19,13 +19,13 @@ describe("options form page", () => {
for (let tab of tabs.slice(1)) { for (let tab of tabs.slice(1)) {
await browser.tabs.remove(tab.id); await browser.tabs.remove(tab.id);
} }
}) });
afterEach(async() => { afterEach(async() => {
if (lanthan) { if (lanthan) {
await lanthan.quit(); await lanthan.quit();
} }
}) });
it('switch to form settings', async () => { it('switch to form settings', async () => {
let page = await OptionPage.open(lanthan); let page = await OptionPage.open(lanthan);
@ -33,7 +33,7 @@ describe("options form page", () => {
let { settings } = await browser.storage.local.get('settings'); let { settings } = await browser.storage.local.get('settings');
assert.strictEqual(settings.source, 'form') assert.strictEqual(settings.source, 'form')
}) });
it('add blacklist', async () => { it('add blacklist', async () => {
let page = await OptionPage.open(lanthan); let page = await OptionPage.open(lanthan);
@ -43,20 +43,20 @@ describe("options form page", () => {
// assert default // assert default
let settings = (await browser.storage.local.get('settings')).settings; let settings = (await browser.storage.local.get('settings')).settings;
assert.deepStrictEqual(settings.form.blacklist, []) assert.deepStrictEqual(settings.form.blacklist, []);
// add blacklist items // add blacklist items
await forms.addBlacklist(); await forms.addBlacklist();
await forms.setBlacklist(0, 'google.com') await forms.setBlacklist(0, 'google.com');
settings = (await browser.storage.local.get('settings')).settings; settings = (await browser.storage.local.get('settings')).settings;
assert.deepStrictEqual(settings.form.blacklist, ['google.com']) assert.deepStrictEqual(settings.form.blacklist, ['google.com']);
await forms.addBlacklist(); await forms.addBlacklist();
await forms.setBlacklist(1, 'yahoo.com') await forms.setBlacklist(1, 'yahoo.com');
settings = (await browser.storage.local.get('settings')).settings; settings = (await browser.storage.local.get('settings')).settings;
assert.deepStrictEqual(settings.form.blacklist, ['google.com', 'yahoo.com']) assert.deepStrictEqual(settings.form.blacklist, ['google.com', 'yahoo.com']);
// delete first item // delete first item
await forms.removeBlackList(0); await forms.removeBlackList(0);

@ -5,6 +5,8 @@ import TestServer from './lib/TestServer';
import { Builder, Lanthan } from 'lanthan'; import { Builder, Lanthan } from 'lanthan';
import { WebDriver } from 'selenium-webdriver'; import { WebDriver } from 'selenium-webdriver';
import Page from './lib/Page'; import Page from './lib/Page';
import Settings from '../src/shared/settings/Settings';
import SettingRepository from './lib/SettingRepository';
describe("partial blacklist test", () => { describe("partial blacklist test", () => {
let server = new TestServer().receiveContent('/*', let server = new TestServer().receiveContent('/*',
@ -24,20 +26,15 @@ describe("partial blacklist test", () => {
await server.start(); await server.start();
let url = server.url().replace('http://', ''); let url = server.url().replace('http://', '');
await browser.storage.local.set({ await new SettingRepository(browser).saveJSON(Settings.fromJSON({
settings: { keymaps: {
source: 'json', j: { type: 'scroll.vertically', count: 1 },
json: `{ k: { type: 'scroll.vertically', count: -1 },
"keymaps": {
"j": { "type": "scroll.vertically", "count": 1 },
"k": { "type": "scroll.vertically", "count": -1 }
},
"blacklist": [
{ "url": "${url}", "keys": ["k"] }
]
}`,
}, },
}); blacklist: [
{ 'url': url, 'keys': ['k'] }
]
}));
}); });
after(async() => { after(async() => {
@ -50,11 +47,11 @@ describe("partial blacklist test", () => {
it('should disable keys in the partial blacklist', async () => { it('should disable keys in the partial blacklist', async () => {
let page = await Page.navigateTo(webdriver, server.url('/')); let page = await Page.navigateTo(webdriver, server.url('/'));
await page.sendKeys('j') await page.sendKeys('j');
let scrollY = await page.getScrollY(); let scrollY = await page.getScrollY();
assert.strictEqual(scrollY, 64); assert.strictEqual(scrollY, 64);
await page.sendKeys('k') await page.sendKeys('k');
scrollY = await page.getScrollY(); scrollY = await page.getScrollY();
assert.strictEqual(scrollY, 64); assert.strictEqual(scrollY, 64);
}); });

@ -1,86 +0,0 @@
export default {
source: 'json',
json: `{
"keymaps": {
"0": { "type": "scroll.home" },
":": { "type": "command.show" },
"o": { "type": "command.show.open", "alter": false },
"O": { "type": "command.show.open", "alter": true },
"t": { "type": "command.show.tabopen", "alter": false },
"T": { "type": "command.show.tabopen", "alter": true },
"w": { "type": "command.show.winopen", "alter": false },
"W": { "type": "command.show.winopen", "alter": true },
"b": { "type": "command.show.buffer" },
"a": { "type": "command.show.addbookmark", "alter": true },
"k": { "type": "scroll.vertically", "count": -1 },
"j": { "type": "scroll.vertically", "count": 1 },
"h": { "type": "scroll.horizonally", "count": -1 },
"l": { "type": "scroll.horizonally", "count": 1 },
"<C-U>": { "type": "scroll.pages", "count": -0.5 },
"<C-D>": { "type": "scroll.pages", "count": 0.5 },
"<C-B>": { "type": "scroll.pages", "count": -1 },
"<C-F>": { "type": "scroll.pages", "count": 1 },
"gg": { "type": "scroll.top" },
"G": { "type": "scroll.bottom" },
"$": { "type": "scroll.end" },
"d": { "type": "tabs.close" },
"D": { "type": "tabs.close", "select": "left" },
"x$": { "type": "tabs.close.right" },
"!d": { "type": "tabs.close.force" },
"u": { "type": "tabs.reopen" },
"K": { "type": "tabs.prev", "count": 1 },
"J": { "type": "tabs.next", "count": 1 },
"gT": { "type": "tabs.prev", "count": 1 },
"gt": { "type": "tabs.next", "count": 1 },
"g0": { "type": "tabs.first" },
"g$": { "type": "tabs.last" },
"<C-6>": { "type": "tabs.prevsel" },
"r": { "type": "tabs.reload", "cache": false },
"R": { "type": "tabs.reload", "cache": true },
"zp": { "type": "tabs.pin.toggle" },
"zd": { "type": "tabs.duplicate" },
"zi": { "type": "zoom.in" },
"zo": { "type": "zoom.out" },
"zz": { "type": "zoom.neutral" },
"f": { "type": "follow.start", "newTab": false },
"F": { "type": "follow.start", "newTab": true, "background": false },
"m": { "type": "mark.set.prefix" },
"'": { "type": "mark.jump.prefix" },
"H": { "type": "navigate.history.prev" },
"L": { "type": "navigate.history.next" },
"[[": { "type": "navigate.link.prev" },
"]]": { "type": "navigate.link.next" },
"gu": { "type": "navigate.parent" },
"gU": { "type": "navigate.root" },
"gi": { "type": "focus.input" },
"gf": { "type": "page.source" },
"gh": { "type": "page.home" },
"gH": { "type": "page.home", "newTab": true },
"y": { "type": "urls.yank" },
"p": { "type": "urls.paste", "newTab": false },
"P": { "type": "urls.paste", "newTab": true },
"/": { "type": "find.start" },
"n": { "type": "find.next" },
"N": { "type": "find.prev" },
"<S-Esc>": { "type": "addon.toggle.enabled" }
},
"search": {
"default": "google",
"engines": {
"google": "http://127.0.0.1:12321/google?q={}",
"yahoo": "http://127.0.0.1:12321/yahoo?q={}",
"bing": "http://127.0.0.1:12321/bind?q={}",
"duckduckgo": "http://127.0.0.1:12321/duplicate?q={}",
"twitter": "http://127.0.0.1:12321/twitter?q={}",
"wikipedia": "http://127.0.0.1:12321/wikipedia?q={}"
}
},
"properties": {
"hintchars": "abcdefghijklmnopqrstuvwxyz",
"smoothscroll": false,
"complete": "sbh"
},
"blacklist": [
]
}`,
};

@ -20,7 +20,7 @@ describe("zoom test", () => {
.build(); .build();
webdriver = lanthan.getWebDriver(); webdriver = lanthan.getWebDriver();
browser = lanthan.getWebExtBrowser(); browser = lanthan.getWebExtBrowser();
tab = (await browser.tabs.query({}))[0] tab = (await browser.tabs.query({}))[0];
page = await Page.currentContext(webdriver); page = await Page.currentContext(webdriver);
}); });