Generative AI-Based Testing Certification
Generative AI-Based Testing Certification
Dealing with Dates and Times
In some tests, you will need to specify the current date/time of when the test is being run.
testRigor supports the following pre-defined variables:
- nowHour
- nowMinute
- nowMonth
- nowYear
- todayYear
- todayYearShort
- todayMonthNumber
- todayMonthNumberTwoDigits
- todayMonth
- todayMonthShort
- todayDayOfMonth
- todayDayOfMonthTwoDigits
- todayDayOfWeek
- todayDayOfWeekShort
Note: Time is always generated based on the time zone indicated in the suite settings. In Settings -> Advanced, select the the desired location from the time zone dropdown.
If you need to calculate a date in the future or past – for example, check that a year from 30 days ago is present on the screen – use ECMAScript 5.1 compatible expressions.
check that page contains expression "var aDate=new Date();aDate.setDate(aDate.getDate()-30);''+aDate.getFullYear()"
For selecting dates on a calendar, just use click and select:
click "4" in the context of "July"
click "next month" until page contains "August"
For selecting dates on a date picker (), just use click and select:
click "4" in the context of "July"
click "next month" until page contains "August"
Getting dates dynamically
Using JavaScript, like this:
check that page contains expression "var aDate=new Date();aDate.setDate(aDate.getDate()-30);''+aDate.getFullYear()"
Various date format snippets
Use string with parameters command, for example:
string with parameters"${todayMonth} ${todayDayOfMonth}, ${todayYear}"
The above command will get a result like: August 15, 2024