aboutsummaryrefslogtreecommitdiff
path: root/e2e/completion_open.test.ts
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-10-09 11:50:52 +0000
committerGitHub <noreply@github.com>2019-10-09 11:50:52 +0000
commit18c72bf15c6bc7e4c88dd06d38ff861f29d66b1b (patch)
treef46720349e17c57db7bbfc55241b12c4410f2773 /e2e/completion_open.test.ts
parent8eddcc1785a85bbe74be254d1055ebe5125dad10 (diff)
parent68f6211aac4177f3a70a40031dabbd1b61840071 (diff)
Merge pull request #655 from ueokande/partial-blacklist
Partial blacklist
Diffstat (limited to 'e2e/completion_open.test.ts')
-rw-r--r--e2e/completion_open.test.ts55
1 files changed, 14 insertions, 41 deletions
diff --git a/e2e/completion_open.test.ts b/e2e/completion_open.test.ts
index c957e2e..5f8bd11 100644
--- a/e2e/completion_open.test.ts
+++ b/e2e/completion_open.test.ts
@@ -1,12 +1,13 @@
import * as path from 'path';
import * as assert from 'assert';
+import Settings from "../src/shared/settings/Settings";
import TestServer from './lib/TestServer';
-import settings from './settings';
import eventually from './eventually';
import { Builder, Lanthan } from 'lanthan';
import { WebDriver } from 'selenium-webdriver';
import Page from './lib/Page';
+import SettingRepository from "./lib/SettingRepository";
describe("completion on open/tabopen/winopen commands", () => {
let server = new TestServer().receiveContent('/*', 'ok');
@@ -25,10 +26,6 @@ describe("completion on open/tabopen/winopen commands", () => {
webdriver = lanthan.getWebDriver();
browser = lanthan.getWebExtBrowser();
- await browser.storage.local.set({
- settings,
- });
-
// Add item into hitories
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);
assert.ok(items.every(x => x.includes('https://')));
});
- })
+ });
it('should filter items with titles by keywords on "open" command', async() => {
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);
assert.ok(items.every(x => x.toLowerCase().includes('getting')));
});
- })
+ });
it('should filter items with titles by keywords on "tabopen" command', async() => {
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);
assert.ok(items.every(x => x.includes('https://')));
});
- })
+ });
it('should filter items with titles by keywords on "winopen" command', async() => {
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);
assert.ok(items.every(x => x.includes('https://')));
});
- })
+ });
it('should display only specified items in "complete" property by set command', async() => {
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);
assert.deepStrictEqual(titles, ['Bookmarks', 'Search Engines', 'Search Engines'])
});
- })
+ });
it('should display only specified items in "complete" property by setting', async() => {
- await browser.storage.local.set({ settings: {
- source: 'json',
- json: `{
- "keymaps": {
- ":": { "type": "command.show" }
- },
- "search": {
- "default": "google",
- "engines": { "google": "https://google.com/search?q={}" }
- },
- "properties": {
- "complete": "sbh"
- }
- }`,
- }});
+ new SettingRepository(browser).saveJSON(Settings.fromJSON({
+ properties: { complete: "sbh" },
+ }));
let console = await page.showConsole();
await console.inputKeys('open ');
@@ -158,21 +143,9 @@ describe("completion on open/tabopen/winopen commands", () => {
await console.close();
await (webdriver.switchTo() as any).parentFrame();
- await browser.storage.local.set({ settings: {
- source: 'json',
- json: `{
- "keymaps": {
- ":": { "type": "command.show" }
- },
- "search": {
- "default": "google",
- "engines": { "google": "https://google.com/search?q={}" }
- },
- "properties": {
- "complete": "bss"
- }
- }`,
- }});
+ new SettingRepository(browser).saveJSON(Settings.fromJSON({
+ properties: { complete: "bss" },
+ }));
console = await page.showConsole();
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);
assert.deepStrictEqual(titles, ['Bookmarks', 'Search Engines', 'Search Engines'])
});
- })
+ });
});