diff --git a/e2e/blacklist.test.ts b/e2e/blacklist.test.ts index 8bf1bd8..dec9d99 100644 --- a/e2e/blacklist.test.ts +++ b/e2e/blacklist.test.ts @@ -5,10 +5,12 @@ import TestServer from './lib/TestServer'; import { Builder, Lanthan } from 'lanthan'; import { WebDriver } from 'selenium-webdriver'; import Page from './lib/Page'; +import SettingRepository from "./lib/SettingRepository"; +import Settings from "../src/shared/settings/Settings"; describe("blacklist test", () => { let server = new TestServer().receiveContent('/*', - `
`, + ``, ); let lanthan: Lanthan; let webdriver: WebDriver; @@ -24,17 +26,12 @@ describe("blacklist test", () => { await server.start(); let url = server.url('/a').replace('http://', ''); - await browser.storage.local.set({ - settings: { - source: 'json', - json: `{ - "keymaps": { - "j": { "type": "scroll.vertically", "count": 1 } - }, - "blacklist": [ "${url}" ] - }`, + await new SettingRepository(browser).saveJSON(Settings.fromJSON({ + keymaps: { + j: { type: "scroll.vertically", count: 1 }, }, - }); + blacklist: [ url ], + })); }); after(async() => { @@ -46,7 +43,7 @@ describe("blacklist test", () => { it('should disable add-on if the URL is in the blacklist', async () => { let page = await Page.navigateTo(webdriver, server.url('/a')); - await page.sendKeys('j') + await page.sendKeys('j'); let scrollY = await page.getScrollY(); assert.strictEqual(scrollY, 0); diff --git a/e2e/clipboard.test.ts b/e2e/clipboard.test.ts index 2b71ade..3f2b289 100644 --- a/e2e/clipboard.test.ts +++ b/e2e/clipboard.test.ts @@ -4,10 +4,11 @@ import * as path from 'path'; import TestServer from './lib/TestServer'; import eventually from './eventually'; import * as clipboard from './lib/clipboard'; -import settings from './settings'; import { Builder, Lanthan } from 'lanthan'; import { WebDriver, Key } from 'selenium-webdriver'; import Page from './lib/Page'; +import SettingRepository from "./lib/SettingRepository"; +import Settings from "../src/shared/settings/Settings"; describe("clipboard test", () => { let server = new TestServer(12321).receiveContent('/happy', 'ok'); @@ -23,9 +24,14 @@ describe("clipboard test", () => { webdriver = lanthan.getWebDriver(); browser = lanthan.getWebExtBrowser(); - await browser.storage.local.set({ - settings, - }); + await new SettingRepository(browser).saveJSON(Settings.fromJSON({ + search: { + default: "google", + engines: { + "google": "http://127.0.0.1:12321/google?q={}", + }, + }, + })); await server.start(); }); @@ -42,7 +48,7 @@ describe("clipboard test", () => { for (let tab of tabs.slice(1)) { await browser.tabs.remove(tab.id); } - }) + }); it('should copy current URL by y', async () => { let page = await Page.navigateTo(webdriver, server.url('/#should_copy_url')); diff --git a/e2e/command_addbookmark.test.ts b/e2e/command_addbookmark.test.ts index bcc75ac..5344292 100644 --- a/e2e/command_addbookmark.test.ts +++ b/e2e/command_addbookmark.test.ts @@ -10,7 +10,7 @@ import Page from './lib/Page'; describe('addbookmark command test', () => { let server = new TestServer().receiveContent('/happy', ` -