Add e2e tests for "complete" property
This commit is contained in:
parent
15b3372c66
commit
7df99cf232
2 changed files with 124 additions and 13 deletions
14
QA.md
14
QA.md
|
@ -26,19 +26,10 @@ The behaviors of the console are tested in [Console section](#consoles).
|
||||||
- [ ] Select link and open it in the frame in `<iframe>`/`<frame`> on following by <kbd>f</kbd>
|
- [ ] Select link and open it in the frame in `<iframe>`/`<frame`> on following by <kbd>f</kbd>
|
||||||
- [ ] Select link and open it in new tab in `<iframe>`/`<frame`> on following by <kbd>F</kbd>
|
- [ ] Select link and open it in new tab in `<iframe>`/`<frame`> on following by <kbd>F</kbd>
|
||||||
- [ ] Select link and open it in `<area>` tags, for <kbd>f</kbd> and <kbd>F</kbd>
|
- [ ] Select link and open it in `<area>` tags, for <kbd>f</kbd> and <kbd>F</kbd>
|
||||||
- [ ] Open new tab in background by `"background": true`
|
|
||||||
- [ ] Opened tabs is in child on Tree Style Tab
|
- [ ] Opened tabs is in child on Tree Style Tab
|
||||||
|
|
||||||
### Consoles
|
### Consoles
|
||||||
|
|
||||||
#### Exec a command
|
|
||||||
|
|
||||||
- [ ] `<EMPTY>`: do nothing
|
|
||||||
|
|
||||||
#### Misc
|
|
||||||
|
|
||||||
- [ ] Select next item by <kbd>Tab</kbd> and previous item by <kbd>Shift</kbd>+<kbd>Tab</kbd>
|
|
||||||
|
|
||||||
### Properties
|
### Properties
|
||||||
|
|
||||||
- [ ] Configure custom hint character by `:set hintchars=012345678`
|
- [ ] Configure custom hint character by `:set hintchars=012345678`
|
||||||
|
@ -47,10 +38,7 @@ The behaviors of the console are tested in [Console section](#consoles).
|
||||||
- [ ] Smooth scroll by `:set smoothscroll`
|
- [ ] Smooth scroll by `:set smoothscroll`
|
||||||
- [ ] Non-smooth scroll by `:set nosmoothscroll`
|
- [ ] Non-smooth scroll by `:set nosmoothscroll`
|
||||||
- [ ] Configure smooth scroll by settings `"smoothscroll": true`, `"smoothscroll": false`
|
- [ ] Configure smooth scroll by settings `"smoothscroll": true`, `"smoothscroll": false`
|
||||||
|
- [ ] Open new tab in background by `"background": true`
|
||||||
- [ ] Show search engine, bookmark and history items in order by `:set complete=sbh`
|
|
||||||
- [ ] Show bookmark, search engine, and search engine items in order by `:set complete=bss`
|
|
||||||
- [ ] Configure completion items by setting `"complete": "sbh"`, `"complete": "bss"`
|
|
||||||
|
|
||||||
### Settings
|
### Settings
|
||||||
|
|
||||||
|
|
|
@ -129,4 +129,127 @@ describe("completion on open/tabopen/winopen commands", () => {
|
||||||
assert(items.every(x => x.includes('https://')));
|
assert(items.every(x => x.includes('https://')));
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should display only specified items in "complete" property by set command', async() => {
|
||||||
|
let c = new Console(session);
|
||||||
|
|
||||||
|
const execCommand = async(line) => {
|
||||||
|
await body.sendKeys(':');
|
||||||
|
await session.switchToFrame(0);
|
||||||
|
await c.sendKeys(line, Key.Enter);
|
||||||
|
await session.switchToParentFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
const typeCommand = async(...keys) => {
|
||||||
|
await body.sendKeys(':');
|
||||||
|
await session.switchToFrame(0);
|
||||||
|
await c.sendKeys(...keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
const cancel = async() => {
|
||||||
|
await c.sendKeys(Key.Escape);
|
||||||
|
await session.switchToParentFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
await execCommand('set complete=sbh');
|
||||||
|
await typeCommand('open ');
|
||||||
|
|
||||||
|
await eventually(async() => {
|
||||||
|
let completions = await c.getCompletions();
|
||||||
|
let titles = completions.filter(x => x.type === 'title').map(x => x.text);
|
||||||
|
assert.deepEqual(titles, ['Search Engines', 'Bookmarks', 'History'])
|
||||||
|
});
|
||||||
|
|
||||||
|
await cancel();
|
||||||
|
await execCommand('set complete=bss');
|
||||||
|
await typeCommand('open ');
|
||||||
|
|
||||||
|
await eventually(async() => {
|
||||||
|
let completions = await c.getCompletions();
|
||||||
|
let titles = completions.filter(x => x.type === 'title').map(x => x.text);
|
||||||
|
assert.deepEqual(titles, ['Bookmarks', 'Search Engines', 'Search Engines'])
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should display only specified items in "complete" property by setting', async() => {
|
||||||
|
const settings = {
|
||||||
|
source: 'json',
|
||||||
|
json: `{
|
||||||
|
"keymaps": {
|
||||||
|
":": { "type": "command.show" }
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"default": "google",
|
||||||
|
"engines": { "google": "https://google.com/search?q={}" }
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"complete": "sbh"
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
};
|
||||||
|
await browser.storage.local.set({ settings, });
|
||||||
|
|
||||||
|
let c = new Console(session);
|
||||||
|
|
||||||
|
const typeCommand = async(...keys) => {
|
||||||
|
await body.sendKeys(':');
|
||||||
|
await session.switchToFrame(0);
|
||||||
|
await c.sendKeys(...keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
const cancel = async() => {
|
||||||
|
await c.sendKeys(Key.Escape);
|
||||||
|
await session.switchToParentFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
}});
|
||||||
|
await typeCommand('open ');
|
||||||
|
|
||||||
|
await eventually(async() => {
|
||||||
|
let completions = await c.getCompletions();
|
||||||
|
let titles = completions.filter(x => x.type === 'title').map(x => x.text);
|
||||||
|
assert.deepEqual(titles, ['Search Engines', 'Bookmarks', 'History'])
|
||||||
|
});
|
||||||
|
|
||||||
|
await cancel();
|
||||||
|
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
}});
|
||||||
|
await typeCommand('open ');
|
||||||
|
|
||||||
|
await eventually(async() => {
|
||||||
|
let completions = await c.getCompletions();
|
||||||
|
let titles = completions.filter(x => x.type === 'title').map(x => x.text);
|
||||||
|
assert.deepEqual(titles, ['Bookmarks', 'Search Engines', 'Search Engines'])
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
Reference in a new issue