From 0bd33d6f00f135abfd2acd1cc981afcfb0a2f0a3 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Sat, 04 May 2019 13:08:27 +0000
Subject: [PATCH] Switch to Nightwatch.js for browser tests

---
 tests/index.js |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/tests/index.js b/tests/index.js
new file mode 100644
index 0000000..c9827b0
--- /dev/null
+++ b/tests/index.js
@@ -0,0 +1,31 @@
+module.exports = {
+	'Stop name autocompletion': function(browser) {
+		browser.url('http://127.0.0.1:8080/');
+		browser.getTitle(function(title) {
+			this.assert.ok(title.includes('TTSS'));
+		});
+
+		var autocomplete_pairs = [
+			['baga', 'Teatr Bagatela'],
+			['d g', 'Dworzec Główny'],
+			['świę', 'Plac Wszystkich Świętych'],
+			['św g', 'Św. Gertrudy'],
+			['św.g', 'Św. Gertrudy'],
+		];
+		autocomplete_pairs.forEach(function(value) {
+			browser.clearValue('#stop-name');
+			browser.setValue('#stop-name', value[0]);
+			browser.pause(200);
+			browser.expect.element('#stop-name-autocomplete > option:first-child').to.be.present.before(1000);
+			browser.expect.element('#stop-name-autocomplete > option:first-child').text.to.include(value[1]).before(1000);
+		});
+	},
+	'Translation engine': function(browser) {
+		browser.url('http://127.0.0.1:8080/#!en');
+		browser.pause(200);
+		browser.getTitle(function(title) {
+			this.assert.ok(title.includes('departures'));
+		});
+		browser.expect.element('[data-translate=header_line]').text.to.include('Line');
+	},
+};

--
Gitblit v1.9.1