aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--e2e/ambassador/src/background/index.js5
-rw-r--r--e2e/ambassador/src/client/windows.js13
-rw-r--r--e2e/ambassador/src/content/index.js4
-rw-r--r--e2e/ambassador/src/shared/messages.js2
-rw-r--r--e2e/contents/tab.test.js17
5 files changed, 28 insertions, 13 deletions
diff --git a/e2e/ambassador/src/background/index.js b/e2e/ambassador/src/background/index.js
index 9e64986..f9fda7e 100644
--- a/e2e/ambassador/src/background/index.js
+++ b/e2e/ambassador/src/background/index.js
@@ -1,5 +1,6 @@
import {
- WINDOWS_CREATE, WINDOWS_REMOVE, TABS_CREATE,
+ WINDOWS_CREATE, WINDOWS_REMOVE, WINDOWS_GET,
+ TABS_CREATE,
EVENT_KEYPRESS, EVENT_KEYDOWN, EVENT_KEYUP,
} from '../shared/messages';
import * as tabs from './tabs';
@@ -11,6 +12,8 @@ receiveContentMessage((message) => {
return browser.windows.create({ url: message.url });
case WINDOWS_REMOVE:
return browser.windows.remove(message.windowId);
+ case WINDOWS_GET:
+ return browser.windows.get(message.windowId, { populate: true });
case TABS_CREATE:
return tabs.create({
url: message.url,
diff --git a/e2e/ambassador/src/client/windows.js b/e2e/ambassador/src/client/windows.js
index c6ba37a..f92405a 100644
--- a/e2e/ambassador/src/client/windows.js
+++ b/e2e/ambassador/src/client/windows.js
@@ -1,4 +1,6 @@
-import { WINDOWS_CREATE, WINDOWS_REMOVE } from '../shared/messages';
+import {
+ WINDOWS_CREATE, WINDOWS_REMOVE, WINDOWS_GET
+} from '../shared/messages';
import * as ipc from './ipc';
const create = (url) => {
@@ -15,4 +17,11 @@ const remove = (windowId) => {
});
};
-export { create, remove };
+const get = (windowId) => {
+ return ipc.send({
+ type: WINDOWS_GET,
+ windowId,
+ });
+};
+
+export { create, remove, get };
diff --git a/e2e/ambassador/src/content/index.js b/e2e/ambassador/src/content/index.js
index 0931f93..8573d66 100644
--- a/e2e/ambassador/src/content/index.js
+++ b/e2e/ambassador/src/content/index.js
@@ -1,5 +1,6 @@
import {
- WINDOWS_CREATE, WINDOWS_REMOVE, TABS_CREATE,
+ WINDOWS_CREATE, WINDOWS_REMOVE, WINDOWS_GET,
+ TABS_CREATE,
EVENT_KEYPRESS, EVENT_KEYDOWN, EVENT_KEYUP,
} from '../shared/messages';
import * as ipc from './ipc';
@@ -8,6 +9,7 @@ ipc.receivePageMessage((message) => {
switch (message.type) {
case WINDOWS_CREATE:
case WINDOWS_REMOVE:
+ case WINDOWS_GET:
case TABS_CREATE:
case EVENT_KEYPRESS:
case EVENT_KEYDOWN:
diff --git a/e2e/ambassador/src/shared/messages.js b/e2e/ambassador/src/shared/messages.js
index 1369260..32b7aa2 100644
--- a/e2e/ambassador/src/shared/messages.js
+++ b/e2e/ambassador/src/shared/messages.js
@@ -2,6 +2,7 @@ const METHOD_REQUEST = 'request';
const METHOD_RESPONSE = 'response';
const WINDOWS_CREATE = 'windows.create';
const WINDOWS_REMOVE = 'windows.remove';
+const WINDOWS_GET = 'windows.get';
const TABS_CREATE = 'tabs.create';
const EVENT_KEYPRESS = 'event.keypress';
const EVENT_KEYDOWN = 'event.keydown';
@@ -13,6 +14,7 @@ export {
WINDOWS_CREATE,
WINDOWS_REMOVE,
+ WINDOWS_GET,
TABS_CREATE,
diff --git a/e2e/contents/tab.test.js b/e2e/contents/tab.test.js
index d33a35f..dda572f 100644
--- a/e2e/contents/tab.test.js
+++ b/e2e/contents/tab.test.js
@@ -5,7 +5,7 @@ import * as keys from "../ambassador/src/client/keys";
const SERVER_URL = "localhost:11111";
-describe("tab test", function() {
+describe("tab test", () => {
let targetWindow;
let targetTab;
@@ -22,14 +22,13 @@ describe("tab test", function() {
return windows.remove(targetWindow.id);
});
- it('delete tab', (done) => {
- let before = window.document.documentElement.scrollTop;
- keys.press(targetTab.id, 'j').then((r) => {
+ it('delete tab', () => {
+ return Promise.resolve().then(() => {
+ return keys.press(targetTab.id, 'd');
+ }).then(() => {
+ return windows.get(targetWindow.id);
+ }).then((after) => {
+ expect(after.tabs).to.have.lengthOf(1);
});
- keys.press(targetTab.id, 'j').then((r) => {
- });
- keys.press(targetTab.id, 'G').then((r) => {
- });
- let after = window.document.documentElement.scrollTop;
});
});