Ask a Question

Selecting different area on a calendar at each run of keyword test to create a reservation.

shahid24
Contributor

Selecting different area on a calendar at each run of keyword test to create a reservation.

Hi, I have a keyword test. I recorded the keyword test in which you schedule a reservation by dragging the mouse over dates and time on a calendar which displays a weekly view.

 

According to my test case I have to schedule a reservation on the calendar in a future date.

 

As my keyword test always books the reservation on the same date as originally recorded, if i run the test some days later it will not be able to create a reservation on the calendar.

 

When  i recorded the keyword test I selected a region on the calendar and dragged the mouse to make a reservation. This region cannot be then found after a few days as the calendar gets updated

 

Attached is a video snippet of my problem.

 

https://www.screencast.com/t/rdjTwAD7

2 REPLIES 2
tristaanogre
Esteemed Contributor

What you'll need to do is change your keyword test to be more dynamic.... rather than dragging to a set region based upon co-ordinates that are hardcoded in your test, you need to find the desired region every time and then use that for the drag.

 

So, the way you're going to have to do this:

 

1) Use some sort of finding methodology (FindChild, Find, etc. or even some custom code), find the region in your calendar that contains the desired dates.

2) Calculate, based upon that found object, the co-ordinates for your drag

3) Pass those co-ordinates into your Drag method.

 

There's any number of ways to do a lot of this, but step 1 is going to depend a LOT upon the calendar component itself.  That's the dynamic piece that you'll need to work around.  You MIGHT need to dive into Script code to do a bit of this and then call that code from within your keyword test.


Robert Martin
[Hall of Fame]
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
AlexKaras
Champion Level 3

Hi,

 

I would suggest to assign the required date directly but not via drop-down visual selection.

Quite often the following worked for me:

-- Assign required date to some calendar's property (it may be .Value, .wText or some other one);

-- Click the calendar to open drop-down. If you are lucky, drop-down will be opened with the required date been pre-selected;

-- Press Enter (Sys.Desktop.Keys("[Enter]") ) to emulate date selection and make all linked jscript code to do its job.

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
cancel
Showing results for 
Search instead for 
Did you mean: