aboutsummaryrefslogtreecommitdiff
path: root/e2e/options_form.test.ts
diff options
context:
space:
mode:
authorShin'ya UEOKA <ueokande@i-beam.org>2019-10-09 12:33:08 +0000
committerShin'ya UEOKA <ueokande@i-beam.org>2019-10-09 12:33:08 +0000
commitbe3ee38fdb3d482d776b98b3febb357d7fc297e9 (patch)
tree5beec70fc986ba95c1e474ef70da23b2f1c0d7ad /e2e/options_form.test.ts
parentc9efeeaf3a5f4f996b8edab330a50546d69ce49d (diff)
Add e2e test for partial blacklist form option
Diffstat (limited to 'e2e/options_form.test.ts')
-rw-r--r--e2e/options_form.test.ts49
1 files changed, 48 insertions, 1 deletions
diff --git a/e2e/options_form.test.ts b/e2e/options_form.test.ts
index 6023f9c..c3dc5fb 100644
--- a/e2e/options_form.test.ts
+++ b/e2e/options_form.test.ts
@@ -35,7 +35,7 @@ describe("options form page", () => {
assert.strictEqual(settings.source, 'form')
});
- it('add blacklist', async () => {
+ it('add blacklist item', async () => {
let page = await OptionPage.open(lanthan);
let forms = await page.switchToForm();
// Scroll is required to click a button on Firefox 60
@@ -64,6 +64,53 @@ describe("options form page", () => {
assert.deepStrictEqual(settings.form.blacklist, ['yahoo.com'])
});
+ it('add a partial blacklist item', async () => {
+ let page = await OptionPage.open(lanthan);
+ let forms = await page.switchToForm();
+ // Scroll is required to click a button on Firefox 60
+ await page.scrollTo(0, 1000);
+
+ // assert default
+ let settings = (await browser.storage.local.get('settings')).settings;
+ assert.deepStrictEqual(settings.form.blacklist, []);
+
+ // add blacklist items
+ await forms.addPartialBlacklist();
+ await forms.setPartialBlacklist(0, 'google.com', 'j,k,<C-U>');
+
+ settings = (await browser.storage.local.get('settings')).settings;
+ assert.deepStrictEqual(settings.form.blacklist, [
+ { url: 'google.com', keys: ['j', 'k', '<C-U>'] },
+ ]);
+
+ await forms.addPartialBlacklist();
+ await forms.setPartialBlacklist(1, 'yahoo.com', 'g,G');
+
+ settings = (await browser.storage.local.get('settings')).settings;
+ assert.deepStrictEqual(settings.form.blacklist, [
+ { url: 'google.com', keys: ['j', 'k', '<C-U>'] },
+ { url: 'yahoo.com', keys: ['g', 'G'] },
+ ]);
+
+ await forms.addBlacklist();
+ await forms.setBlacklist(0, 'bing.com');
+
+ settings = (await browser.storage.local.get('settings')).settings;
+ assert.deepStrictEqual(settings.form.blacklist, [
+ { url: 'google.com', keys: ['j', 'k', '<C-U>'] },
+ { url: 'yahoo.com', keys: ['g', 'G'] },
+ 'bing.com',
+ ]);
+
+ // delete first item
+ await forms.removePartialBlackList(0);
+ settings = (await browser.storage.local.get('settings')).settings;
+ assert.deepStrictEqual(settings.form.blacklist, [
+ { url: 'yahoo.com', keys: ['g', 'G'] },
+ 'bing.com',
+ ])
+ });
+
it('add search engines', async () => {
let page = await OptionPage.open(lanthan);
let forms = await page.switchToForm();