Ow the cookie was to make it work on my machine, everytime i started the google page i get a cookie window that i have to accept or decline.
So I added it to the test to skip that screen on my machine.
The rest of the code you can use. Also yeah you need to upgrade to cypress 10+ if you want to use cy.origin.