// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
{
  pages: {
    TikTok: {
      blocks: {
        tiktok-page-load: {
          template: ../../../common-action-blocks/basic/page-load.hjson
          args: {
            READY_STATE: complete
            PAGE_LOAD_TIMEOUT: 2m
            TARGET: _self
          }
          unbound_args: [
            PAGE_URL
          ]
        }
        before-watch: [
          {
            action: wait
            duration: 5s
          }
          {
            action: click
            source: touch
            pos: {
              selector: "#captcha_close_button"
              wait: true
              required: false
            }
            timeout: 5s
          }
          $[...SCREEN_SETTINGS]
        ]
        watch-video: [
          {
            action: wait_for_condition
            condition: return document.querySelector('video').currentTime > 0.5
            timeout: 60s
          }
          {
            action: js
            script: performance.mark('video-started')
          }
          {
            action: wait
            duration: $[PLAYBACK_DURATION]
          }
          {
            action: js
            path: ../../../common-action-blocks/video-streaming/scripts/streaming-stats.js
            replacements: {
              PLAYBACK_DURATION: $[PLAYBACK_DURATION]
            }
          }
        ]
      }
    }
  }
}
