Home > Blockchain >  How can we test the fromDate and toDate in integration testing. following are the code for the Date
How can we test the fromDate and toDate in integration testing. following are the code for the Date

Time:03-15

Following are the code for the Date. How can we test the fromDate and toDate. On the transaction history page there are two button one is OLDER, and another one is NEWER, after taping on NEWER button it shows the current 3 month trasactions details. With the current month date like that(01 January 2022 to 31 March 2022) viceversa for OLDER.

    I just need to verify when I tap on NEWER button the date should be change.

  

    RichText(
                        text: TextSpan(children: [
                          TextSpan(
                              text: DateTimeHelper.getFormattedDateTime(fromDate,
                                  dateFormat: DateTimeHelper.dateOnlyText),
                              style: TextStyle(
                                  fontSize: 16, fontWeight: FontWeight.w600)),
                          TextSpan(text: " to "),
                          TextSpan(
                              text: DateTimeHelper.getFormattedDateTime(toDate,
                                  dateFormat: DateTimeHelper.dateOnlyText),
                              style: TextStyle(
                                  fontSize: 16, fontWeight: FontWeight.w600)),
                        ]),
                      ),


  

CodePudding user response:

Comparing two dates:

var today = DateTime.now();
var date = DateTime.fromMillisecondsSinceEpoch(some_date); // Suppose your stored date is in Milliseconds Epoch format.
bool isSame = date.day == today.day;

CodePudding user response:

I can add to the previous answer that it is possible to assign a key to some widget and use the key to get the value from it. Smth like this

await driver.tap(find.text(lifeStyle)

  • Related