"""Continue the recorded Android reproduction after expanding the long user bubble.
Usage: python3 drive-collapse.py SESSION
Precondition: paired Pixel 9, Demo / Message folding, long message expanded.
The exact message sent through the composer is generated below.
"""
import subprocess
import sys

LONG_MESSAGE = ' '.join(
    f'Paragraph {i}: this is a long pasted requirement that should collapse on mobile, preserving room to read the following reply.'
    for i in range(1, 19)
) + ' END OF LONG MESSAGE'

def device(*args):
    return subprocess.run(['agent-device', *args, '--session', sys.argv[1]], check=True)

device('scroll', 'down', '0.7', '--settle')
device('scroll', 'bottom', '--settle')
device('press', 'label="Show less"', '--settle')
device('record', 'stop')
