Commit ee346bb4 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_ui_test_core: Add typeReact to type in field managed by reactJS

parent 50e9ebfc
......@@ -94,6 +94,20 @@ Selenium.prototype.doSetFile = function(locator, url_filename_mimetype) {
}));
};
/**
* If used to type and active the onChange event in react forms.
* @param {string} locator the selenium locator
* @param {string} text the text to type in the field
*/
Selenium.prototype.doTypeReact = function(locator, newText) {
var input = this.page().findElement(locator);
var nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value").set;
nativeInputValueSetter.call(input, newText);
var ev2 = new Event('input', { bubbles: true});
input.dispatchEvent(ev2);
};
/**
* Checks the element referenced by `locator` is a float equals to `text`.
......@@ -137,6 +151,7 @@ Selenium.prototype.assertPortalStatusMessage = function(text) {
Assert.matches(text, actualValue);
};
/*
* Get the location of the current page. This function is missing in
* Selenium 0.8 or later.
......
Markdown is supported
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