# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import subprocess
from pathlib import Path
def create_banner_html(lang="en"):
html_template = """
✓
__STEP_1__
✓
__STEP_2__
🎵
Coldplay - Yellow
Pixel Buds Pro
▶
"""
if lang == "cn":
replacements = {
"__TAGLINE__": "让 AI 助手与测试套件像人一样直接操作真机",
"__PROMPT_LABEL__": "🎯 测试指令",
"__PROMPT_STATUS__": "真机运行中",
"__PROMPT_TEXT__": "连接蓝牙耳机播放音乐,断言 CPU 占用 < 5%",
"__CONSOLE_TITLE__": "真机测试执行引擎",
"__CONSOLE_BADGE__": "通过",
"__STEP_1__": "连接蓝牙耳机",
"__STEP_2__": "打开播放器并播放歌曲",
"__STEP_3_TITLE__": "▶ 断言性能指标",
"__STEP_3_TAG__": "实时验证",
"__SCREEN_TITLE__": "正在播放",
"__MOCK_BTN__": "音频输出控制",
}
else:
replacements = {
"__TAGLINE__": "Let AI assistants and test suites use real phones like a human",
"__PROMPT_LABEL__": "🎯 TEST PROMPT",
"__PROMPT_STATUS__": "RUNNING",
"__PROMPT_TEXT__": "Connect Bluetooth earbuds, play song, and assert CPU < 5%",
"__CONSOLE_TITLE__": "Test Runner",
"__CONSOLE_BADGE__": "PASSED",
"__STEP_1__": "Connect Bluetooth earbuds",
"__STEP_2__": "Launch player & play song",
"__STEP_3_TITLE__": "▶ Assert Performance SLA",
"__STEP_3_TAG__": "VERIFYING",
"__SCREEN_TITLE__": "Now Playing",
"__MOCK_BTN__": "Audio Output",
}
for key, val in replacements.items():
html_template = html_template.replace(key, val)
return html_template
def render_image(html_str, output_path):
temp_html = f"/tmp/banner_{os.path.basename(output_path)}.html"
with open(temp_html, "w", encoding="utf-8") as f:
f.write(html_str)
cmd = [
"google-chrome",
"--headless",
"--disable-gpu",
"--no-sandbox",
"--disable-dev-shm-usage",
"--window-size=1280,480",
"--hide-scrollbars",
f"--screenshot={output_path}",
f"file://{temp_html}",
]
res = subprocess.run(cmd, capture_output=True, text=True)
if os.path.exists(output_path):
print(f"Rendered {output_path} ({os.path.getsize(output_path)} bytes)")
else:
print(f"Error rendering {output_path}: {res.stderr}")
if __name__ == "__main__":
assets_dir = Path(__file__).resolve().parent
os.makedirs(assets_dir, exist_ok=True)
# Generate English main banner and en banner
en_html = create_banner_html(lang="en")
render_image(en_html, str(assets_dir / "artemis-banner.png"))
render_image(en_html, str(assets_dir / "artemis-banner-en.png"))
# Generate Chinese banner
cn_html = create_banner_html(lang="cn")
render_image(cn_html, str(assets_dir / "artemis-banner-cn.png"))