cancel
Showing results for 
Search instead for 
Did you mean: 

How to Compare Unread Messages on top of web page with Center Panel

SOLVED
Highlighted
Contributor

How to Compare Unread Messages on top of web page with Center Panel

Hello Team,

I have a Securing Messaging Inbox Page

Under this page,

1. Top right of web page, where it says New Messages, a number is displayed as 4 unread messages.Highlighted in the screenshot

2. Middle section of Page has those 4 unread messages with icon as red present next to them before From section, Highlighted in the screenshot.

I need code to compare whatever number of unread messages are displayed on top of Page under Point 1 New Messages section, are equal to number of unread messages in the middle section , before From column.

Please share the code.

Attached is the screenshot

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: How to Compare Unread Messages on top of web page with Center Panel

Note:

 

We cannot give you code because code in TestComplete requires object identification parameters (NameMapping) of the objects in question.  I can give you how I would do it.

1) The object in the upper right with the number of unread messages.  I would capture the value of whatever property on that object contains that number and store it in a variable within the test.

2) I would create a for-loop on the table of messages itself from top to bottom, indexed against the number of rows on the table.

3) Initialied before the forloop would be another variable that will be used to store the count of records with the red envelope

4) Inside the loop, for each iteration of the loop, I'd look at the properties or values in that column containing the envelope.  Perhaps there's osmething in the innerHTML or an image name or something that indicates what type of indicator is there.  For each red envolope found, increment the counter from #3 by one.

5) Once the for-loop is complete, compare the two variable values.  If they are equal, do nothing -> Test passed.  If they are un-equal, log a message (error or warning) indicate that they are not equal and include the values for each variable.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

3 REPLIES 3
Community Hero

Re: How to Compare Unread Messages on top of web page with Center Panel

What code did you try and what happened when you tried it?

Community Hero

Re: How to Compare Unread Messages on top of web page with Center Panel

Note:

 

We cannot give you code because code in TestComplete requires object identification parameters (NameMapping) of the objects in question.  I can give you how I would do it.

1) The object in the upper right with the number of unread messages.  I would capture the value of whatever property on that object contains that number and store it in a variable within the test.

2) I would create a for-loop on the table of messages itself from top to bottom, indexed against the number of rows on the table.

3) Initialied before the forloop would be another variable that will be used to store the count of records with the red envelope

4) Inside the loop, for each iteration of the loop, I'd look at the properties or values in that column containing the envelope.  Perhaps there's osmething in the innerHTML or an image name or something that indicates what type of indicator is there.  For each red envolope found, increment the counter from #3 by one.

5) Once the for-loop is complete, compare the two variable values.  If they are equal, do nothing -> Test passed.  If they are un-equal, log a message (error or warning) indicate that they are not equal and include the values for each variable.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

Community Leader

Re: How to Compare Unread Messages on top of web page with Center Panel

Variation on @tristaanogre :

 

Step 1 remains unchanged.

2. Find something unique to the red envelope image e.g.

//Assumes you have the grid name mapped

var Properties = ["ObjectType","namePropStr"];
var Values = ["Image","redenvelope.png"];

var envelopes = mygrid.FindAllChildren(Properties, Values).toArray();
var linesWithEnvelopes = envelopes.length; //This is the actual count

 move on to step 5 to compare expected value with actual


-------------------------------------------------
Standard syntax disclaimers apply
Regards,