Validating a toast popup on android.

Ask general questions here.
stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Validating a toast popup on android.

Post by stapes » Mon Sep 28, 2015 3:53 pm

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?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3949
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Validating a toast popup on android.

Post by odklizec » Tue Sep 29, 2015 8:08 am

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
SnapshotRecording.png (14.93 KiB) Viewed 923 times
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
Quotationmark.png (6.51 KiB) Viewed 923 times
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Re: Validating a toast popup on android.

Post by stapes » Tue Sep 29, 2015 10:16 am

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");
        }