Commit ea1d2742 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Titouan Soulard

erp5_ui_test_core: Add typeReact to type in field managed by reactJS

parent 485583a3
...@@ -95,6 +95,20 @@ Selenium.prototype.doSetFile = function(locator, url_filename_mimetype) { ...@@ -95,6 +95,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`. * Checks the element referenced by `locator` is a float equals to `text`.
...@@ -138,6 +152,7 @@ Selenium.prototype.assertPortalStatusMessage = function(text) { ...@@ -138,6 +152,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