integration testing - SAPUI5 OPA5 How to trigger a select event -
below typical action test if sap.m.select contains item name xyz , select it.
success: function(oselect) { var oitems = oselect.getitems(); $.each(oitems, function(i,v) { if(oitems[i].gettext() === "testitemnameiliketoselect") { otestopa5testitem = oitems[i]; } }); if(otestopa5testitem !== null) { oselect.setselectedkey(otestopa5testitem.getkey()); otestopa5testitem.$().trigger("tap"); } },
when start test run correctly select proper item list , sets visibly in browser, not trigger attached event behind (e.g. change="onlistitemchanged"). application works fine, don't find way create working test it.
thanks in advance
opa5 has 'action' interface , 2 default implementations e.g. 'entertext' , 'press'. recommended usage define action
block on waitfor()
options this:
when.waitfor({ id: "mybutton", actions: new press() });
what use 'old way' has shortcomings:
success
block not synchronized xhr requestsaction
is.- sending click/tap event control require selecting internal element. imagine click nav container - there several places click actually. actions handle details , define standard behavior depend on.
- it better encapsulate selection logic inside
matchers
block , abstract custom matcher. waysuccess
block cleaner , reuse matcher in several places in test.
Comments
Post a Comment