Merge pull request #416 from ueokande/qa-0.15

QA 0.15
jh-changes
Shin'ya Ueoka 7 years ago committed by GitHub
commit 2f23a87e39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      QA.md
  2. 16
      e2e/contents/navigate.test.js
  3. 14
      e2e/contents/tab.test.js
  4. 4
      src/background/shared/tabs.js

@ -27,7 +27,6 @@ The behaviors of the console are tested in [Console section](#consoles).
#### Misc #### Misc
- [ ] <kbd>g</kbd><kbd>f</kbd>: open page source in the new tab.
- [ ] <kbd>y</kbd>: yank current URL and show a message - [ ] <kbd>y</kbd>: yank current URL and show a message
- [ ] <kbd>p</kbd>: open clipboard's URL in current tab - [ ] <kbd>p</kbd>: open clipboard's URL in current tab
- [ ] <kbd>P</kbd>: open clipboard's URL in new tab - [ ] <kbd>P</kbd>: open clipboard's URL in new tab
@ -118,6 +117,7 @@ The behaviors of the console are tested in [Console section](#consoles).
#### Misc #### Misc
- [ ] Select next item by <kbd>Tab</kbd> and previous item by <kbd>Shift</kbd>+<kbd>Tab</kbd> - [ ] Select next item by <kbd>Tab</kbd> and previous item by <kbd>Shift</kbd>+<kbd>Tab</kbd>
- [ ] Reopen tab on *only current window* by <kbd>u</kbd>
### Settings ### Settings

@ -20,7 +20,7 @@ describe("navigate test", () => {
let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/a/b/c'); let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/a/b/c');
await keys.press(tab.id, 'g'); await keys.press(tab.id, 'g');
await keys.press(tab.id, 'u'); await keys.press(tab.id, 'u');
await new Promise(resolve => { setTimeout(() => resolve(), 10) }); await new Promise((resolve) => setTimeout(resolve, 10));
tab = await tabs.get(tab.id); tab = await tabs.get(tab.id);
expect(tab.url).to.be.equal(CLIENT_URL + '/a/b/'); expect(tab.url).to.be.equal(CLIENT_URL + '/a/b/');
@ -38,7 +38,7 @@ describe("navigate test", () => {
let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/a/b/c'); let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/a/b/c');
await keys.press(tab.id, 'g'); await keys.press(tab.id, 'g');
await keys.press(tab.id, 'U', { shiftKey: true }); await keys.press(tab.id, 'U', { shiftKey: true });
await new Promise(resolve => { setTimeout(() => resolve(), 10) }); await new Promise((resolve) => setTimeout(resolve, 10));
tab = await tabs.get(tab.id); tab = await tabs.get(tab.id);
expect(tab.url).to.be.equal(CLIENT_URL + '/'); expect(tab.url).to.be.equal(CLIENT_URL + '/');
@ -49,11 +49,11 @@ describe("navigate test", () => {
await keys.press(tab.id, 'g'); await keys.press(tab.id, 'g');
await keys.press(tab.id, 'u'); await keys.press(tab.id, 'u');
await keys.press(tab.id, 'H', { shiftKey: true }); await keys.press(tab.id, 'H', { shiftKey: true });
await new Promise(resolve => { setTimeout(() => resolve(), 10) }); await new Promise((resolve) => setTimeout(resolve, 10));
tab = await tabs.get(tab.id); tab = await tabs.get(tab.id);
expect(tab.url, 'go back in history').to.be.equal(CLIENT_URL + '/#navigate'); expect(tab.url, 'go back in history').to.be.equal(CLIENT_URL + '/#navigate');
await new Promise(resolve => { setTimeout(() => resolve(), 10) }); await new Promise((resolve) => setTimeout(resolve, 10));
await keys.press(tab.id, 'L', { shiftKey: true }); await keys.press(tab.id, 'L', { shiftKey: true });
tab = await tabs.get(tab.id); tab = await tabs.get(tab.id);
@ -64,7 +64,7 @@ describe("navigate test", () => {
let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/a-pagenation?page=10'); let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/a-pagenation?page=10');
await keys.press(tab.id, '['); await keys.press(tab.id, '[');
await keys.press(tab.id, '['); await keys.press(tab.id, '[');
await new Promise(resolve => { setTimeout(() => resolve(), 10) }); await new Promise((resolve) => setTimeout(resolve, 10));
tab = await tabs.get(tab.id); tab = await tabs.get(tab.id);
expect(tab.url).to.be.equal(CLIENT_URL + '/a-pagenation?page=9'); expect(tab.url).to.be.equal(CLIENT_URL + '/a-pagenation?page=9');
@ -74,7 +74,7 @@ describe("navigate test", () => {
let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/a-pagenation?page=10'); let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/a-pagenation?page=10');
await keys.press(tab.id, ']'); await keys.press(tab.id, ']');
await keys.press(tab.id, ']'); await keys.press(tab.id, ']');
await new Promise(resolve => { setTimeout(() => resolve(), 10) }); await new Promise((resolve) => setTimeout(resolve, 100));
tab = await tabs.get(tab.id); tab = await tabs.get(tab.id);
expect(tab.url).to.be.equal(CLIENT_URL + '/a-pagenation?page=11'); expect(tab.url).to.be.equal(CLIENT_URL + '/a-pagenation?page=11');
@ -84,7 +84,7 @@ describe("navigate test", () => {
let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/link-pagenation?page=10'); let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/link-pagenation?page=10');
await keys.press(tab.id, '['); await keys.press(tab.id, '[');
await keys.press(tab.id, '['); await keys.press(tab.id, '[');
await new Promise(resolve => { setTimeout(() => resolve(), 10) }); await new Promise((resolve) => setTimeout(resolve, 10));
tab = await tabs.get(tab.id); tab = await tabs.get(tab.id);
expect(tab.url).to.be.equal(CLIENT_URL + '/link-pagenation?page=9'); expect(tab.url).to.be.equal(CLIENT_URL + '/link-pagenation?page=9');
@ -94,7 +94,7 @@ describe("navigate test", () => {
let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/link-pagenation?page=10'); let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/link-pagenation?page=10');
await keys.press(tab.id, ']'); await keys.press(tab.id, ']');
await keys.press(tab.id, ']'); await keys.press(tab.id, ']');
await new Promise(resolve => { setTimeout(() => resolve(), 10) }); await new Promise((resolve) => setTimeout(resolve, 10));
tab = await tabs.get(tab.id); tab = await tabs.get(tab.id);
expect(tab.url).to.be.equal(CLIENT_URL + '/link-pagenation?page=11'); expect(tab.url).to.be.equal(CLIENT_URL + '/link-pagenation?page=11');

@ -139,7 +139,7 @@ describe("tab test", () => {
expect(win.tabs).to.have.lengthOf(1); expect(win.tabs).to.have.lengthOf(1);
await keys.press(win.tabs[0].id, 'u'); await keys.press(win.tabs[0].id, 'u');
await new Promise((resolve) => setTimeout(resolve, 100)); await new Promise(resolve => setTimeout(resolve, 100));
win = await windows.get(targetWindow.id); win = await windows.get(targetWindow.id);
expect(win.tabs).to.have.lengthOf(2); expect(win.tabs).to.have.lengthOf(2);
@ -163,4 +163,16 @@ describe("tab test", () => {
let win = await windows.get(targetWindow.id); let win = await windows.get(targetWindow.id);
expect(win.tabs).to.have.lengthOf(1); expect(win.tabs).to.have.lengthOf(1);
}); });
it('opens view-source by gf', async () => {
let win = await windows.get(targetWindow.id);
let tab = win.tabs[0];
await keys.press(tab.id, 'g');
await keys.press(tab.id, 'f');
await new Promise(resolve => setTimeout(resolve, 500));
win = await windows.get(targetWindow.id);
let urls = win.tabs.map((t) => t.url)
expect(urls).to.include.members([CLIENT_URL + '/', 'view-source:' + CLIENT_URL + '/']);
});
}); });

@ -22,7 +22,7 @@ const queryByKeyword = async(keyword, excludePinned = false) => {
}; };
const closeTabByKeywords = async(keyword) => { const closeTabByKeywords = async(keyword) => {
let tabs = await queryByKeyword(keyword, false); let tabs = await queryByKeyword(keyword, true);
if (tabs.length === 0) { if (tabs.length === 0) {
throw new Error('No matching buffer for ' + keyword); throw new Error('No matching buffer for ' + keyword);
} else if (tabs.length > 1) { } else if (tabs.length > 1) {
@ -32,7 +32,7 @@ const closeTabByKeywords = async(keyword) => {
}; };
const closeTabByKeywordsForce = async(keyword) => { const closeTabByKeywordsForce = async(keyword) => {
let tabs = await queryByKeyword(keyword, true); let tabs = await queryByKeyword(keyword, false);
if (tabs.length === 0) { if (tabs.length === 0) {
throw new Error('No matching buffer for ' + keyword); throw new Error('No matching buffer for ' + keyword);
} else if (tabs.length > 1) { } else if (tabs.length > 1) {