Page 1 of 1

Repository Item name has been prefixed with hh:mm

Posted: Tue Sep 22, 2015 12:55 pm
by stapes
I am trying to write a Test Project using Evernote.

After adding a new note, the note content has been automatically prefixed with the time, so the Repository Item has been called
Text1244ThisNoteWasAddedUsingRano
and the match value has been saved as
12:44 This note was added using Ranorex.
How do i validate this or locate it on repeated tests, as the time and the hence name of the Repository Item is going to change every time?

Re: Repository Item name has been prefixed with hh:mm

Posted: Tue Sep 22, 2015 2:20 pm
by odklizec
Hi,

Do I understand you right that the string "Text1244ThisNoteWasAddedUsingRano" is used as Repository item name? Or is this string used also somewhere in the element xpath? If it's just the repo item name, you can freely rename it to whatever you want. Repo item name is not used for element identification. It's also highly recommended to give repository elements more sensible names (after recording steps).

As for the match value, it depends if you need to validate the time, its format or if it's just enough to validate the text after the time prefix? The easiest way is to use Validate AttributeContains and validate only the partial string, eventually use AttributeRegEx with carefully constructed reg ex. If you want to check if the validated string contains time, but you don't really care about the exact time value, using RegEx is probably the best way?

Could you please be more specific about your needs? Ranorex Snapshot and/or sample project would be very helpful here. It's just easier to provide adequate help with available snapshot/sample solution ;)

Re: Repository Item name has been prefixed with hh:mm

Posted: Tue Sep 22, 2015 3:58 pm
by stapes
Hi

When I first recorded my test, I did Validate, and pointed the selection to the Element on screen that I wanted to validate. Ranorex chose to name it Text1244ThisNoteWasAddedUsingRano, based on the text it contains.
I have tried to change this to a variable name - TextCommentEntry, but Ranorex cannot find this!

This is what it tries to do:
Validating AttributeContains (Text=$varMatchValue) on item 'ComEvernote.AndroidWidgetAbsoluteLayout.TextCommentEntry'.
I added some code to the activity of touching the Save button:

Code: Select all

public void Touch_Done()
        {
            Report.Log(ReportLevel.Info, "Touch", "Touch item 'ComEvernote.LoginActivity.Done' at Center", repo.ComEvernote.LoginActivity.DoneInfo);
            repo.ComEvernote.LoginActivity.Done.Touch();
            
            varMatchValue=varMatchValue.Remove(0,6);
         	// display new value of varMatchValue
        	Report.Log(ReportLevel.Info, "varMatchValue=", varMatchValue );
        }
and also converted the Validate activity to code:

Code: Select all

public void Validate_NoteCommentEntry()
        {        	
            Report.Log(ReportLevel.Info, "Validation", "Validating AttributeContains (Text=$varMatchValue) on item 'ComEvernote.AndroidWidgetAbsoluteLayout.TextCommentEntry'.", repo.ComEvernote.AndroidWidgetAbsoluteLayout.TextCommentEntryInfo);
            Validate.Attribute(repo.ComEvernote.AndroidWidgetAbsoluteLayout.TextCommentEntryInfo, "Text", varMatchValue);
        }


Here are the last few lines of the Report:
01:08.167 Info Validation

Validating AttributeContains (Text=$varMatchValue) on item 'ComEvernote.AndroidWidgetAbsoluteLayout.TextCommentEntry'.
Screenshot
02:38.339 Failure Validation

Attribute 'Text' of element for item 'EvernoteAndroidTestsRepository.ComEvernote.AndroidWidgetAbsoluteLayout.TextCommentEntry' does not match the specified value (Failed to find item 'EvernoteAndroidTestsRepository.ComEvernote.AndroidWidgetAbsoluteLayout.TextCommentEntry'. No element found for path '/mobileapp[@title='com.evernote']/form[@title='TabletMainActivity']/container[@rid='content']/androidelement/androidelement[3]/androidelement[2]/androidelement/container[3]/androidelement[5]/container[2]/container[@containertype='Linear']/text[@selectiontext<'This note was added using Ranorex.']' within 1.5m.).

Re: Repository Item name has been prefixed with hh:mm

Posted: Wed Sep 23, 2015 8:26 am
by odklizec
Could you please post a sample solution? It does not have to be entire test project. Just create a new one, with the problematic part. It would be much easier to track the problem down and suggest a reasonable solution.

Re: Repository Item name has been prefixed with hh:mm

Posted: Wed Sep 23, 2015 6:15 pm
by Support Team
Hi,

Thanks odklizec for your help :).

I just wanted to add, that it seems to be a RxPath problem, since the element cannot be found.
It would be therefore great if you could also post a Ranorex snapshot file of the specific element.
Here you can see how to create a snapshot: How to create a Ranorex Snapshot.

Thnaks,
Markus

Re: Repository Item name has been prefixed with hh:mm

Posted: Thu Sep 24, 2015 7:23 am
by odklizec
Support Team wrote:Hi,

Thanks odklizec for your help :).
You are welcome ;) Just returning a bit back to the community after all that great help I received (and still receiving) from you and other guys at this forum in my beginnings.

Re: Repository Item name has been prefixed with hh:mm

Posted: Thu Sep 24, 2015 9:57 am
by stapes
Thanks guys. I seem to have got past this now, by validating the Note Title instead, which does not have the time added.

Here is my working code:

Code: Select all

public void Validate_RanorexTestAddNote()
        {
            Report.Log(ReportLevel.Info, "Validation", "Validating AttributeEqual (Text='Ranorex test - add note') on item 'ComEvernote.AndroidWidgetAbsoluteLayout.RanorexTestAddNote'.", repo.ComEvernote.AndroidWidgetAbsoluteLayout.RanorexTestAddNoteInfo);
            Validate.Attribute(repo.ComEvernote.AndroidWidgetAbsoluteLayout.RanorexTestAddNoteInfo, "Text", "Ranorex test - add note");
        }