In TestCafe, is there a way to run an assertion that passes if the selector matches if 1 of 2 possible values?

Right now have I a test with an assertion that checks for today’s date. However, because of time zone issues, it will start failing at a certain time of day, because the report correctly shows "tomorrow’s" date while TestCafe is looking for what it has as today’s date.

Basically, I would like to write an assertion that passes if it shows either today or tomorrow’s date, but fail for all other values.

Is there a way to write an assertion that checks for 1 of 2 values? Is there some way to use an OR operator in an assertion?

Something along the lines of:

await t
    .expect(Site.reportValues.reportHeaderInfo.innerText)
    .contains({ todaysDate || tomorrowsDate }, 
    "Report header should show either today's date or tomorrow's date",
    );

211 thoughts on “In TestCafe, is there a way to run an assertion that passes if the selector matches if 1 of 2 possible values?”

  1. With havin so much content and articles do you ever run into any problems of plagorism or copyright violation? My
    website has a lot of completely unique content I’ve either authored myself or outsourced but it
    appears a lot of it is popping it up all over the internet without my
    agreement. Do you know any ways to help reduce content from being
    ripped off? I’d genuinely appreciate it. http://droga5.net/

    Reply
  2. I really like your blog.. very nice colors & theme. Did you design this website yourself or did you hire someone
    to do it for you? Plz reply as I’m looking to design my
    own blog and would like to find out where u got this
    from. thanks a lot

    Reply
  3. It’s really a cool and helpful piece of info. I’m happy
    that you shared this useful info with us. Please stay us up
    to date like this. Thank you for sharing.

    Reply
  4. Hello There. I discovered your blog the usage of msn. This is a really well
    written article. I’ll be sure to bookmark it and come back
    to learn more of your helpful info. Thank you for the post.
    I’ll certainly return.

    Reply
  5. Greetings from Carolina! I’m bored to death at work so I decided to check out your website on my iphone during lunch break.
    I love the knowledge you present here and can’t
    wait to take a look when I get home. I’m amazed at how fast your blog loaded on my phone ..
    I’m not even using WIFI, just 3G .. Anyhow, wonderful blog!
    scoliosis surgery https://0401mm.tumblr.com/ scoliosis surgery

    Reply
  6. I have been surfing online greater than 3 hours today, but I by no means discovered any interesting article like yours.
    It is lovely price sufficient for me. In my view, if all site owners and bloggers
    made just right content as you probably did, the net shall be
    much more helpful than ever before.

    Reply