Page 1 of 1

Validating a toast popup on android.

Posted: Mon Sep 28, 2015 3:53 pm
by stapes
I have got so far with validating my Toast popup. My Report log shows that the Toast message has been found. Howver, I am still getting an error:
Attribute 'Text' of element for item 'AgileMobileAppRepository.AgileMobileApp.ToastPopup' does not match the specified value (actual='Please enter a Profile namePlease enter a Service URLPlease enter a Username', expected='Please enter a Profile namePlease enter a Service URLPlease enter a Username'').
The actual message has line breaks at the end of each phrase, i.e.

Please enter a Profile name
Please enter a Service URL
Please enter a Username

How can I get round this?

Re: Validating a toast popup on android.

Posted: Tue Sep 29, 2015 8:08 am
by odklizec
Hi,

As I and others mentioned in your previous posts, please create and post a Ranorex snapshot of the element in question. This would make the things easier for us to understand the source of your problem and provide adequate help. If you are not able to create the snapshot manually, you can always create it from recording, by adding new action, select log action and then set the action parameters as described below...
SnapshotRecording.png
Once you run recording, there should be created new snapshot in report output dir.

In my opinion, the problem is in nonprintable characters at the end of each line. On windows, it's typically \r\n (return and new line). I don't know about Android. My guess is that there is either missing, different or redundant character in toast or validation text.

BTW, in the error message you posted, there seems to be a redundant quotation mark at the end of expected text. Please check the definition of validation step, if there is no such character included? And if here is such character, remove it ;)
Quotationmark.png

Re: Validating a toast popup on android.

Posted: Tue Sep 29, 2015 10:16 am
by stapes
Thank you. it was simpler than I thought. It was those stray quotation marks on the end that prevented it working.
00:15.228 Success Validation
Jump to item
Attribute 'Text' of element for item 'AgileMobileAppRepository.AgileMobileApp.ToastPopup' does match the specified value.

Code: Select all

public void Validate_ToastPopup()
        {
            Report.Log(ReportLevel.Info, "Validation", "Validating AttributeEqual (Text='Please enter') on item 'AgileMobileApp.ToastPopup'.", repo.AgileMobileApp.ToastPopupInfo);
            Validate.Exists(repo.AgileMobileApp.ToastPopupInfo);
           	Validate.Attribute(repo.AgileMobileApp.ToastPopupInfo, "Text", "Please enter a Profile namePlease enter a Service URLPlease enter a Username");
        }