aboutsummaryrefslogtreecommitdiff
path: root/e2e/ambassador/src
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-05-12 23:21:16 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-05-13 01:01:10 +0900
commit82aad419a74a3061247d4e82656fa711e63f213c (patch)
treed2b435195ef3d1ca27444739e836bf66a19a9565 /e2e/ambassador/src
parentc6c885345e212bedc2723e9105488d3e5fe9f8be (diff)
Add navigate test
Diffstat (limited to 'e2e/ambassador/src')
-rw-r--r--e2e/ambassador/src/background/index.js4
-rw-r--r--e2e/ambassador/src/background/tabs.js2
-rw-r--r--e2e/ambassador/src/client/tabs.js11
-rw-r--r--e2e/ambassador/src/shared/messages.js2
4 files changed, 15 insertions, 4 deletions
diff --git a/e2e/ambassador/src/background/index.js b/e2e/ambassador/src/background/index.js
index db2deb3..c40b4d8 100644
--- a/e2e/ambassador/src/background/index.js
+++ b/e2e/ambassador/src/background/index.js
@@ -1,6 +1,6 @@
import {
WINDOWS_CREATE, WINDOWS_REMOVE, WINDOWS_GET,
- TABS_CREATE, TABS_SELECT_AT, TABS_GET_ZOOM, TABS_SET_ZOOM,
+ TABS_CREATE, TABS_SELECT_AT, TABS_GET, TABS_GET_ZOOM, TABS_SET_ZOOM,
EVENT_KEYPRESS, EVENT_KEYDOWN, EVENT_KEYUP,
SCROLL_GET, SCROLL_SET,
} from '../shared/messages';
@@ -25,6 +25,8 @@ receiveContentMessage((message) => {
windowId: message.windowId,
index: message.index,
});
+ case TABS_GET:
+ return browser.tabs.get(message.tabId);
case TABS_GET_ZOOM:
return browser.tabs.getZoom(message.tabId);
case TABS_SET_ZOOM:
diff --git a/e2e/ambassador/src/background/tabs.js b/e2e/ambassador/src/background/tabs.js
index d049500..37156c4 100644
--- a/e2e/ambassador/src/background/tabs.js
+++ b/e2e/ambassador/src/background/tabs.js
@@ -5,7 +5,7 @@ const create = (props = {}) => {
if (tab.url !== 'about:blank' && tabId === createdTab.id &&
changeInfo.status === 'complete') {
browser.tabs.onUpdated.removeListener(callback);
- resolve(tab);
+ setTimeout(() => resolve(tab), 50) // wait for 50 milliseconds to ensure plugin loaded;
}
};
browser.tabs.onUpdated.addListener(callback);
diff --git a/e2e/ambassador/src/client/tabs.js b/e2e/ambassador/src/client/tabs.js
index c7b1340..14d524d 100644
--- a/e2e/ambassador/src/client/tabs.js
+++ b/e2e/ambassador/src/client/tabs.js
@@ -1,5 +1,5 @@
import {
- TABS_CREATE, TABS_SELECT_AT, TABS_GET_ZOOM, TABS_SET_ZOOM,
+ TABS_CREATE, TABS_SELECT_AT, TABS_GET, TABS_GET_ZOOM, TABS_SET_ZOOM,
} from '../shared/messages';
import * as ipc from './ipc';
@@ -19,6 +19,13 @@ const selectAt = (windowId, index) => {
});
};
+const get = (tabId) => {
+ return ipc.send({
+ type: TABS_GET,
+ tabId,
+ });
+};
+
const getZoom = (tabId) => {
return ipc.send({
tabId,
@@ -34,4 +41,4 @@ const setZoom = (tabId, factor) => {
});
};
-export { create, selectAt, getZoom, setZoom };
+export { create, selectAt, get, getZoom, setZoom };
diff --git a/e2e/ambassador/src/shared/messages.js b/e2e/ambassador/src/shared/messages.js
index 1fc47d2..34ec5d3 100644
--- a/e2e/ambassador/src/shared/messages.js
+++ b/e2e/ambassador/src/shared/messages.js
@@ -5,6 +5,7 @@ const WINDOWS_REMOVE = 'windows.remove';
const WINDOWS_GET = 'windows.get';
const TABS_CREATE = 'tabs.create';
const TABS_SELECT_AT = 'tabs.selectAt';
+const TABS_GET = 'tabs.get';
const TABS_GET_ZOOM = 'tabs.get.zoom';
const TABS_SET_ZOOM = 'tabs.set.zoom';
const EVENT_KEYPRESS = 'event.keypress';
@@ -21,6 +22,7 @@ export {
WINDOWS_REMOVE,
WINDOWS_GET,
+ TABS_GET,
TABS_CREATE,
TABS_SELECT_AT,
TABS_GET_ZOOM,