mardi 6 septembre 2016

SAPUI5 OPA Test - Message box - Error

I am facing issues while pressing different buttons on message-boxes on javascript views of my SAPUI5 application. Other item seems to work fine like inserting text in text boxes, pressing buttons, selecting a row of table, etc.

I found out that every messagebox has a type/class like sapMDialogSuccess or sapMDialogError or sapMDialogWarning, etc. Do we have a similar type/class for OK, Cancel, Abort buttons (displayed on messagebox)?

I am able to get exact text which appears on my messagebox using:

ok(true, "This success message is displayed:- " + sap.ui.test.Opa5.getJQuery()(".sapMDialogSuccess").find(".sapMText").text());

But when I try following code to select (and then press) OK button, it does not work. Here is the code I am using:

            //OK Button - Find & Press OK button 
            Then.waitFor({
                pollingInterval: 5,
                searchOpenDialogs : true,
                controlType: "sap.m.Button",

                check : function(aButton) {
                if(aButton.text() === "OK")
                {
                    return !!sap.ui.test.Opa5.getJQuery()(".sapMDialogSuccess").length;
                }
                },
                success : function() {
                    ok(true, "OK button found - SUCCESS");
                },
                errorMessage : "OK Button not found - ERROR"
            });

Here is the error I am getting:

OK Button not found - ERROR Callstack: at Object. (http: //<>:50000/XMII/CM/Opa-LineGroupMaintenance.html:152:22) at Object.f (https:// http://ift.tt/2cjGGKA) at Object.run (https:// http://ift.tt/2cvKtXE) at eval (https:// http://ift.tt/2cjGTxA) at C (https:// http://ift.tt/2cvKniu) at E (https:// http://ift.tt/2cjGD1G) at eval (https:// http://ift.tt/2cvJQgy)@ 3618 ms Expected:
true Result:
false Diff:
trufalse Source:
at Object.eval [as ok] (https:// http://ift.tt/2cjHeQC) Script error.@ 3623 ms Source:
:0

Appreciate your support!!

Aucun commentaire:

Enregistrer un commentaire