Commit e95629af 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 c4c568e0
...@@ -92,6 +92,20 @@ Selenium.prototype.doSetFile = function(locator, url_and_filename) { ...@@ -92,6 +92,20 @@ Selenium.prototype.doSetFile = function(locator, url_and_filename) {
})); }));
}; };
/**
* 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`. * Checks the element referenced by `locator` is a float equals to `text`.
...@@ -135,6 +149,7 @@ Selenium.prototype.assertPortalStatusMessage = function(text) { ...@@ -135,6 +149,7 @@ Selenium.prototype.assertPortalStatusMessage = function(text) {
Assert.matches(text, actualValue); Assert.matches(text, actualValue);
}; };
/* /*
* Get the location of the current page. This function is missing in * Get the location of the current page. This function is missing in
* Selenium 0.8 or later. * 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