aboutsummaryrefslogtreecommitdiff
path: root/e2e/contents
diff options
context:
space:
mode:
Diffstat (limited to 'e2e/contents')
-rw-r--r--e2e/contents/mark.test.js71
-rw-r--r--e2e/contents/zoom.test.js3
2 files changed, 74 insertions, 0 deletions
diff --git a/e2e/contents/mark.test.js b/e2e/contents/mark.test.js
new file mode 100644
index 0000000..85566bd
--- /dev/null
+++ b/e2e/contents/mark.test.js
@@ -0,0 +1,71 @@
+import * as windows from "../ambassador/src/client/windows";
+import * as tabs from "../ambassador/src/client/tabs";
+import * as keys from "../ambassador/src/client/keys";
+import * as scrolls from "../ambassador/src/client/scrolls";
+import { CLIENT_URL } from '../web-server/url';
+
+describe("mark test", () => {
+ let targetWindow;
+
+ before(async () => {
+ targetWindow = await windows.create();
+ });
+
+ after(async () => {
+ await windows.remove(targetWindow.id);
+ });
+
+ it('set a local mark and jump to it', async () => {
+ let tab = await tabs.create(targetWindow.id, CLIENT_URL + '/mark#local');
+ await scrolls.set(tab.id, 100, 100);
+ await keys.press(tab.id, 'm');
+ await keys.press(tab.id, 'a');
+
+ await scrolls.set(tab.id, 200, 200);
+ await keys.press(tab.id, "'");
+ await keys.press(tab.id, 'a');
+
+ let scroll = await scrolls.get(tab.id);
+ expect(scroll.x).to.be.equals(100);
+ expect(scroll.y).to.be.equals(100);
+ });
+
+ it('set a global mark and jump to it', async () => {
+ let tab1 = await tabs.create(targetWindow.id, CLIENT_URL + '/mark#global1');
+ await scrolls.set(tab1.id, 100, 100);
+ await keys.press(tab1.id, 'm');
+ await keys.press(tab1.id, 'A');
+ await new Promise(resolve => { setTimeout(() => resolve(), 100) });
+ await scrolls.set(tab1.id, 200, 200);
+
+ let tab2 = await tabs.create(targetWindow.id, CLIENT_URL + '/mark#global2');
+ await keys.press(tab2.id, "'");
+ await keys.press(tab2.id, 'A');
+ await new Promise(resolve => { setTimeout(() => resolve(), 100) });
+
+ tab1 = await tabs.get(tab1.id);
+ expect(tab1.active).to.be.true;
+ let scroll = await scrolls.get(tab1.id);
+ expect(scroll.x).to.be.equals(100);
+ expect(scroll.y).to.be.equals(100);
+ });
+
+ it('set a global mark and creates new tab from gone', async () => {
+ let tab1 = await tabs.create(targetWindow.id, CLIENT_URL + '/mark#gone');
+ await scrolls.set(tab1.id, 100, 100);
+ await keys.press(tab1.id, 'm');
+ await keys.press(tab1.id, 'A');
+ await tabs.remove(tab1.id);
+ await new Promise(resolve => { setTimeout(() => resolve(), 100) });
+
+ let tab2 = await tabs.create(targetWindow.id, CLIENT_URL + '/mark#newtab');
+ await keys.press(tab2.id, "'");
+ await keys.press(tab2.id, 'A');
+ await new Promise(resolve => { setTimeout(() => resolve(), 100) });
+
+ let win = await windows.get(targetWindow.id);
+ let found = win.tabs.find(tab => tab.url === CLIENT_URL + '/mark#gone')
+ expect(found).to.be.an('object');
+ expect(found.id).to.not.equal(tab1.id);
+ });
+});
diff --git a/e2e/contents/zoom.test.js b/e2e/contents/zoom.test.js
index 2d90e28..74d4f56 100644
--- a/e2e/contents/zoom.test.js
+++ b/e2e/contents/zoom.test.js
@@ -23,6 +23,7 @@ describe("zoom test", () => {
let before = await tabs.getZoom(targetTab.id);
await keys.press(targetTab.id, 'z');
await keys.press(targetTab.id, 'i');
+ await new Promise(resolve => setTimeout(resolve, 100));
let actual = await tabs.getZoom(targetTab.id);
expect(actual).to.be.greaterThan(before);
@@ -32,6 +33,7 @@ describe("zoom test", () => {
let before = await tabs.getZoom(targetTab.id);
await keys.press(targetTab.id, 'z');
await keys.press(targetTab.id, 'o');
+ await new Promise(resolve => setTimeout(resolve, 100));
let actual = await tabs.getZoom(targetTab.id);
expect(actual).to.be.lessThan(before);
@@ -42,6 +44,7 @@ describe("zoom test", () => {
let before = await tabs.getZoom(targetTab.id);
await keys.press(targetTab.id, 'z');
await keys.press(targetTab.id, 'z');
+ await new Promise(resolve => setTimeout(resolve, 100));
let actual = await tabs.getZoom(targetTab.id);
expect(actual).to.be.lessThan(before);