You're approaching this backwards. Firstly, this is invalid:
\define ('COOKIE_DOMAIN', 'https://static.mydomain.com');
You enter a domain, not a fully qualified URL. So something like "static.mydomain.com". BUT, that would break your site entirely - it would tell browsers to only set and read the cookie from the domain you entered (which wouldn't work because the primary domain would be trying to set and read the cookies).
What the test suite you are using is recommending is to store your images and other static assets somewhere like "static.separatedomain.com" and serve the files from there, without changing how cookies work on your main domain. You can already do this by using the built in S3 integration in the AdminCP under System > Files > Storage Settings.