Commit bca4d433 authored by Rafael Ostertag's avatar Rafael Ostertag
Browse files

Wrote first two inputmodeswitcher selenium test

parent 0777b098
......@@ -91,6 +91,11 @@
<script src="../js/EventEmitter.min.js"></script>
<script src="../js/qfq.debug.js"></script>
<script type="text/javascript">
// Do not remove, or selenium tests will fail.
QfqNS.QfqPage.prototype.beforeUnloadHandler = function (evt) {
};
$(function () {
var qfqPage = new QfqNS.QfqPage({
tabsId: 'myTabs',
......
/**
* @author Rafael Ostertag <rafael.ostertag@math.uzh.ch>
*/
'use strict';
const {Builder, By, until} = require('selenium-webdriver'),
test = require('selenium-webdriver/testing'),
assert = require('assert'),
should = require('should');
const MOCK_PATH = "/mockup/inputmodeswitcher.html";
const BASE_URL = process.env.SELENIUM_BASE_URL || "http://qfq.math.uzh.ch/selenium";
const URL = BASE_URL + MOCK_PATH;
console.log("Use URL: " + URL);
test.describe('Typeahead', function () {
var driver;
test.before(function () {
driver = new Builder().forBrowser('chrome').build();
});
test.after(function () {
driver.quit();
});
test.it("should switch to readonly", function (done) {
driver.get(URL)
.then(
() => driver.findElement(By.id('input1'))
.then(
(textinput) => textinput.sendKeys('typing some text')
.then(
driver.findElement(By.css('#input1 + div > button'))
.then(
(button) => button.click()
)
)
).then(
driver.findElement(By.id('input1'))
.then(
(textinput) => textinput.sendKeys('typing in readonly field')
)
).then(
driver.findElement(By.id('input1'))
.then(
(textinput) => (textinput.getAttribute('value'))
.then(
text => {
should(text).be.exactly('typing some text');
done();
}
)
)
)
)
});
test.it("should switch back from readonly", function (done) {
driver.get(URL)
.then(
() => driver.findElement(By.css('#input1 + div > button'))
.then(
(button) => button.click()
.then(
() => button.click()
)
)
).then(
driver.findElement(By.id('input1'))
.then(
(textinput) => textinput.clear()
.then(
() => textinput.sendKeys('This should now be typed')
).then(
() => textinput.getAttribute('value')
.then(
text => {
should(text).be.exactly('This should now be typed');
done();
}
)
)
)
)
});
});
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment