# xhs_publish.py — efflora_run social task (mobile) # stack: efflora_lab · android_world · Claude opus 4.7 PKG = "com.xingin.xhs" controller = Controller() @controller.action(description="Open compose sheet via FAB") async def open_compose(env): await ui.find(resource_id=f"{PKG}:id/h2y").click() await ui.wait_for(text="What would you like to share today?") return "compose_open" @controller.action(description="Pick first photo from gallery") async def pick_photo(env, index=0): await ui.find(resource_id=f"{PKG}:id/g0p").click() grid = ui.find(class_="recyclerview.widget.RecyclerView") await grid.child(index=index).click() await ui.find(resource_id=f"{PKG}:id/d2k", text="Next").click() return f"photo_attached: {index}" @controller.action(description="Type title and body via IME") async def type_note(env, title, body): await ui.find(resource_id=f"{PKG}:id/et_title").set_text(title) await ui.find(resource_id=f"{PKG}:id/post_text_view").set_text(body) return f"typed: {len(title)}+{len(body)}" @controller.action(description="Submit and verify post lands") async def submit_post(env): await ui.find(resource_id=f"{PKG}:id/d12", text="Post").click() await ui.wait_for(text="Note published") assert EXPECTED_TITLE in await ui.find_first_post().text() return "post_visible"