From 4d5573356e30721431b74351d93691d6ce4da4a8 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 3 Feb 2020 21:28:12 +0900 Subject: Store settings in sync storage --- e2e/follow_properties.test.ts | 31 +++++++++++++------------------ e2e/lib/SettingRepository.ts | 2 +- 2 files changed, 14 insertions(+), 19 deletions(-) (limited to 'e2e') diff --git a/e2e/follow_properties.test.ts b/e2e/follow_properties.test.ts index bbd46d4..78597a5 100644 --- a/e2e/follow_properties.test.ts +++ b/e2e/follow_properties.test.ts @@ -6,6 +6,8 @@ import eventually from './eventually'; 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('follow properties test', () => { const server = new TestServer().receiveContent('/', ` @@ -31,24 +33,17 @@ describe('follow properties test', () => { webdriver = lanthan.getWebDriver(); browser = lanthan.getWebExtBrowser(); - await browser.storage.local.set({ settings: { - source: 'json', - json: `{ - "keymaps": { - ":": { "type": "command.show" }, - "f": { "type": "follow.start", "newTab": false }, - "F": { "type": "follow.start", "newTab": true, "background": false }, - "": { "type": "follow.start", "newTab": true, "background": true } - }, - "search": { - "default": "google", - "engines": { "google": "https://google.com/search?q={}" } - }, - "properties": { - "hintchars": "jk" - } - }`, - }}); + await new SettingRepository(browser).saveJSON(Settings.fromJSON({ + "keymaps": { + ":": { "type": "command.show" }, + "f": { "type": "follow.start", "newTab": false }, + "F": { "type": "follow.start", "newTab": true, "background": false }, + "": { "type": "follow.start", "newTab": true, "background": true } + }, + "properties": { + "hintchars": "jk" + } + })); await server.start(); }); diff --git a/e2e/lib/SettingRepository.ts b/e2e/lib/SettingRepository.ts index 9d5d5aa..3bdf6d2 100644 --- a/e2e/lib/SettingRepository.ts +++ b/e2e/lib/SettingRepository.ts @@ -8,7 +8,7 @@ export default class SettingRepository { } async saveJSON(settings: Settings): Promise { - await this.browser.storage.local.set({ + await this.browser.storage.sync.set({ settings: { source: SettingSource.JSON, json: JSONTextSettings.fromSettings(settings).toJSONText(), -- cgit v1.2.3