so we’re trying to reliably post messages to the agent desktop iframe from our playwright tests - basically automating some ui interactions that can’t be done via the architect api. it’s… not going great.
the setup is pretty standard - we have a playwright test that navigates to a gc page with the agent desktop embedded, gets the iframe handle, and then tries to send a message. we’re on client_app_sdk@4.2.1. typescript, page object model, the whole deal.
the message is a simple string - just “testmessage” - and we’re sending it with iframe.postMessage('testmessage', '*'). the desktop should be listening for messages. and it is… sometimes.
most of the time it just does jack all. no errors in the console, no sign that the message even arrived. it’s like it’s being swallowed. occasionally (like 1 in 10 runs) it works fine. which makes it even more annoying.
we’ve checked the obvious stuff - iframe is loaded, we’re getting a valid iframe handle, the targetOrigin is correct (* for now, just trying to get it working at all). the desktop app doesn’t seem to be blocking anything in the console.
what’s weird is when it does work, the console shows the usual postMessage log. when it fails, nothing. absolutely nothing.
the architect flow is just a basic call control flow. it doesn’t have anything fancy going on. we don’t think it’s the flow itself, because the desktop loads and sometimes responds. it’s the consistency that’s the problem.
also, running the tests locally vs in ci (github actions) makes no difference. same flaky behavior. i even tried adding a page.waitForTimeout(500) before the postMessage call, thinking it might be a timing issue. still no good.
anyone else running into this? is there some weird race condition or hidden setting i’m missing? i swear it’s not the test, and it’s not the network. i’ve been down those rabbit holes already.
maybe the sdk is doing something under the hood that’s interfering? it’s just a hunch.
the tests are all failing consistently now.