aboutsummaryrefslogtreecommitdiff
path: root/e2e/mark.test.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-09-29 01:06:01 +0000
committerGitHub <noreply@github.com>2019-09-29 01:06:01 +0000
commit4f4396d0a69d33541844e723cad033b0a927333b (patch)
treef3a75c0b41d8fe2b1e6ca730501e36cee5701705 /e2e/mark.test.js
parent0fc2eea7431649f85c6e5d57cca66457f24bb14d (diff)
parent9f0bc5732823505c91ce6b5ba3aa8e4b60ac93f6 (diff)
Merge pull request #648 from ueokande/migrate-to-latest-lanthan
Clean E2E tests
Diffstat (limited to 'e2e/mark.test.js')
-rw-r--r--e2e/mark.test.js121
1 files changed, 0 insertions, 121 deletions
diff --git a/e2e/mark.test.js b/e2e/mark.test.js
deleted file mode 100644
index 8716c1e..0000000
--- a/e2e/mark.test.js
+++ /dev/null
@@ -1,121 +0,0 @@
-const express = require('express');
-const lanthan = require('lanthan');
-const path = require('path');
-const assert = require('assert');
-const eventually = require('./eventually');
-
-const Key = lanthan.Key;
-
-const newApp = () => {
- let app = express();
- app.get('/', (req, res) => {
- res.send(`<!DOCTYPEhtml>
-<html lang="en">
- <body style="width:10000px; height:10000px"></body>
-</html">`);
- });
- return app;
-};
-
-describe("mark test", () => {
-
- const port = 12321;
- let http;
- let firefox;
- let session;
- let browser;
-
- before(async() => {
- http = newApp().listen(port);
-
- firefox = await lanthan.firefox();
- await firefox.session.installAddonFromPath(path.join(__dirname, '..'));
- session = firefox.session;
- browser = firefox.browser;
- });
-
- after(async() => {
- if (firefox) {
- await firefox.close();
- }
- http.close();
- });
-
- it('should set a local mark and jump to it', async () => {
- await session.navigateTo(`http://127.0.0.1:${port}`);
- let body = await session.findElementByCSS('body');
-
- await session.executeScript(() => window.scrollTo(200, 200));
- await body.sendKeys('m', 'a');
- await session.executeScript(() => window.scrollTo(500, 500));
- await body.sendKeys('\'', 'a');
-
- await eventually(async() => {
- let pageXOffset = await session.executeScript(() => window.pageXOffset);
- let pageYOffset = await session.executeScript(() => window.pageYOffset);
- assert.equal(pageXOffset, 200);
- assert.equal(pageYOffset, 200);
- });
- });
-
- it('should set a global mark and jump to it', async () => {
- await session.navigateTo(`http://127.0.0.1:${port}#first`);
- let body = await session.findElementByCSS('body');
-
- await session.executeScript(() => window.scrollTo(200, 200));
- await body.sendKeys('m', 'A');
- await session.executeScript(() => window.scrollTo(500, 500));
- await body.sendKeys('\'', 'A');
-
- await eventually(async() => {
- let pageXOffset = await session.executeScript(() => window.pageXOffset);
- let pageYOffset = await session.executeScript(() => window.pageYOffset);
- assert.equal(pageXOffset, 200);
- assert.equal(pageYOffset, 200);
- });
-
- await browser.tabs.create({ url: `http://127.0.0.1:${port}#second` });
- body = await session.findElementByCSS('body');
- await body.sendKeys('\'', 'A');
-
- await eventually(async() => {
- let tab = (await browser.tabs.query({ active: true }))[0];
- let url = new URL(tab.url);
- assert.equal(url.hash, '#first');
-
- let pageXOffset = await session.executeScript(() => window.pageXOffset);
- let pageYOffset = await session.executeScript(() => window.pageYOffset);
- assert.equal(pageXOffset, 200);
- assert.equal(pageYOffset, 200);
- });
- });
-
- it('set a global mark and creates new tab from gone', async () => {
- await session.navigateTo(`http://127.0.0.1:${port}#first`);
- await session.executeScript(() => window.scrollTo(500, 500));
- let body = await session.findElementByCSS('body');
- await body.sendKeys('m', 'A');
-
- let tab = (await browser.tabs.query({ active: true }))[0];
- await browser.tabs.create({ url: `http://127.0.0.1:${port}#second` });
- await browser.tabs.remove(tab.id);
-
- let handles;
- await eventually(async() => {
- handles = await session.getWindowHandles();
- assert.equal(handles.length, 2);
- });
- await session.switchToWindow(handles[0]);
- await session.navigateTo(`http://127.0.0.1:${port}#second`);
- body = await session.findElementByCSS('body');
- await body.sendKeys('\'', 'A');
-
- await eventually(async() => {
- let tab = (await browser.tabs.query({ active: true }))[0];
- let url = new URL(tab.url);
- assert.equal(url.hash, '#first');
- });
- });
-});
-
-