-
Notifications
You must be signed in to change notification settings - Fork 79
Open
Description
Motivation
Introduce regression testing PUC not rendering certain creatives (uncovered as part of #275)
Background
Detailed postmortem doc is shared in the Slack channel (let me know if you want a link either via slack or email), but it comes down to this:
- creatives often contain
document.writebecause they expect to be rendered in an iframe not plainly output into the document - unlike web on mobile PUC actually dumps content directly into the document, not iframe
- script tags contained in this rendered content after being dynamically added are thus treated as async loaded
- script loading and execution happens after document stream is closed
- if the script contains a document.write - it is blocked by the WebView because it otherwise would overwrite the document content
- we get an effect of the ad not rendering as described in iOS Mobile Ads not rendering since v1.17 #275
- this is why we needed postscribe that was removed as part of the Remove postscribe dependency #179, PRs: Replace PostScribe in the PUC #246 and Resolve issue where scripts in markup never execute on mobile #274
- postscribe actually kept the document stream open and replaced document.write calls in the async scripts so that the content is appended to the document, not overwriting it - this allowed such dynamically added scripts render nested content properly
- thus for now we need to restore postscribe as part of Restore Postscribe #278 but an automated test would be good to justify that the ads are rendering on iOS in the future when we try to replace it again :)
Essential Components
- You need to build and serve (or proxy-replace) a locally built PUC
- You need to serve (or proxy-replace) a cache response (mobile uses cache)
- The minimum
admfor the cache response
<script src=\"https://example.com/test-creative.js\"></script>- Map
example.comto127.0.0.1via /etc/hosts - Serve this script using caddy or other server with tls (iOS wants https:// otherwise won't load) Caddyfile:
example.com {
root * .
file_server
tls internal
}
- you must serve this as a
test-creative.js: (a distilled version):
document.write("<h1>Test</h1>")- Once you are able to render this injected PUC and injected adm on mobile as part of the iOS Mobile Demo App - you can setup an automation via
XCUITest - testing should be done on macos-latest (arm64) github runner (ask ChatGPT how to set it up)
Objectives
- Setup a creative on a GAM account used for Prebid Mobile Apps testing that would point at a localhost URL for PUC and a localhost URL for cache response - you can hardcode those - you will be serving them.
- Write a XCUITest that would verify the creative rendered.
- Implement a script that starts all the localhost servers and starts an xcuitest.
- Create a github action that would setup the environment and run the script on a macos-latest github runner.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Triage