Skip to main content

Waiting For Content

TV Labs provides several tools for waiting and detecting content changes on the screen. These tools are essential for creating robust automated tests that can handle varying loading times and transitions in TV user interfaces.

Available Wait Tools​

  • Wait For Screen - Waits for specific screens to appear or disappear
  • Wait For Text - Waits for specific text to appear on screen
  • Wait For Motion - Detects start or end of motion/animation
  • Wait For Region - Waits for specific UI elements to match defined conditions

Wait For Screen​

The Wait For Screen tool allows you to wait for specific screens to appear or disappear. It's particularly useful for handling navigation and screen transitions.

While the examples below show XML definitions, you can create and edit screens using the visual Designer tool in TV Labs.

Screen Definition Example​

<App name="MyApp">
<Screen name="ProfileSelection">
<Text name="Title" required="true" match="Choose Profile" />
<Button name="Profile1" match="User 1" />
<Button name="Profile2" match="User 2" />
</Screen>
</App>

Transition Types​

Enter Transition​

Waits for a screen to appear. The tool will return when the specified screen is detected.

Before:                    After:
+--------------------+ +--------------------+
| | | Choose Profile |
| Loading | | [User 1] |
| | | [User 2] |
| | | |
+--------------------+ +--------------------+

Exit Transition​

Waits for a screen to disappear. The tool will return when the specified screen is no longer detected.

Before:                    After:
+--------------------+ +--------------------+
| Choose Profile | | |
| [User 1] | | Loading |
| [User 2] | | |
| | | |
+--------------------+ +--------------------+

Options​

  • Screens - One or more screens to wait for. When multiple screens are selected, it will wait for any of them to appear/disappear.
  • Timeout - Maximum time to wait (default: 10 seconds)
  • Stable Frames - Number of consecutive frames where the condition must be met (default: 3)
  • Transition Type - Whether to wait for screen to enter or exit (default: Enter)

Wait For Motion​

Detects motion or animation on screen. Can be used to wait for animations to start or complete.

Motion Detection Types​

Start Detection​

Frame 1                   Frame 2                   Frame 3
+--------------------+ +--------------------+ +--------------------+
| [â– ] | | [â–  ] | | [ â– ] |
| | | | | |
+--------------------+ +--------------------+ +--------------------+
Static Motion Motion
Detected!

End Detection​

Frame 1                   Frame 2                   Frame 3
+--------------------+ +--------------------+ +--------------------+
| [ â– ] | | [â–  ] | | [â– ] |
| | | | | |
+--------------------+ +--------------------+ +--------------------+
Motion Motion Static
Detected!

Region Masking​

Region masking allows you to focus motion detection on specific areas of the screen or exclude areas from detection. This is particularly useful when:

  • Dealing with constantly updating UI elements (like clocks or animations)
  • Focusing on specific interface elements
  • Ignoring known animated elements

Region Definition Example​

<App name="MyApp">
<Screen name="MainMenu">
<Component name="MenuCarousel" left="100" top="200" width="800" height="300">
<Text name="Title" match="Featured Content" />
</Component>
<Component name="Clock" left="900" top="0" width="100" height="50" />
</Screen>
</App>

Using "Only" Option​

Focuses motion detection exclusively on the specified region:

+----------------------------------------+
| [Clock] |
| |
| +-------------------------+ |
| | | |
| | Only Region | |
| | (MenuCarousel) | |
| | | |
| +-------------------------+ |
| |
+----------------------------------------+

Using "Ignore" Option​

Excludes the specified region from motion detection:

+----------------------------------------+
| XXXXXXXXX |
| X Clock X |
| XXXXXXXXX |
| |
| +-------------------------+ |
| | | |
| | MenuCarousel | |
| | | |
| +-------------------------+ |
+----------------------------------------+

Options​

  • Type - Whether to detect motion start or end
  • Timeout - Maximum time to wait
  • Stable Frames - Number of consecutive stable frames required
  • Threshold - Minimum pixel change percentage to consider as motion (0.0-1.0)
  • Include Audio - Also detect audio changes above -70dB
  • Ignore - Region to exclude from motion detection
  • Only - Region to exclusively monitor for motion

Wait For Text​

Waits for specific text to appear on screen. Useful for detecting loading states, error messages, or specific content.

Options​

  • Text - Text string(s) to wait for
  • Timeout - Maximum time to wait

Example:

Wait for: "Profile"

+--------------------+ +--------------------+
| | | Profile |
| Loading... | | Select |
| | | Screen |
| | | |
+--------------------+ +--------------------+

Wait For Region​

Waits for specific UI elements to match defined conditions. This is useful for waiting for specific components to appear in their expected state.

Region Definition Example​

<App name="MyApp">
<Screen name="MainMenu">
<Text name="PlayButton"
left="100" top="200"
width="200" height="50"
match="Choose Profile" />
</Screen>
</App>

Options​

  • Match - Region to monitor
  • Timeout - Maximum time to wait

Example waiting for a button to become selected:

Region: "PlayButton"
Match Condition: "Selected"

Before: After:
+--------------------+ +--------------------+
| [Profile] | | [PROFILE] |
+--------------------+ +--------------------+
Normal Selected