I am new to Testcafé and working on a Testcase to check if no Cookies exist beforehand and if there is a cookie, to delete the Cookie. I have checked this and this post but don´t see any option on how to check if a cookie does exist or does not exist, as the posts describe on how to set a Cookie.
My first implementation would look like this:
    import { ClientFunction } from 'testcafe';
    
    const setCookie = ClientFunction(() => {
      if (document.cookie.length!==0)
{
document.cookie = 'COOKIE_NAME=; Max-Age=0; path=/; domain=' + location.host;
}
    });
    
    fixture `fixture`
        .page `http://google.com`;
    
    test(`1`, async t => {
        await setCookie();
    
        await t.typeText('input[type=text]', 'test');
    
        await t.debug();
    });
I checked the Testcafé API but didn't find any corresponding method; hence, any help or hints would be very much appreciated, thanks.
 
     
     
    