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:
- successblock not synchronized xhr requests- actionis.
- 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 matchersblock , abstract custom matcher. waysuccessblock cleaner , reuse matcher in several places in test.
Comments
Post a Comment