1.0.0 • Published 8 months ago

aucoll-player v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

aucoll player

事件回放器

安装

npm i aucoll-player@latest -g
auplayer replay --f=./record.json

事件播放器接口

METHOD
  POST

PATH
  /player/task/run

BODY
  {
    "task_id": string,
    "event": Event,
    "capture": boolean,
  }

事件播放器指引

接收到 action 为 start_up_record 的事件后,会创建一个 task_id,并响应。

后续其他事件需要通过 task_id 来追踪任务,所以后续事件需要一并带上 task_id。

capture属性表示是否截图,如果传递了 true,则会在事件执行后截图并响应。

支持的事件及依赖属性

播放器接口接收的event结构和录制结果的每个event一致,但每个事件需要的参数不一样,数量也不多,所以只需要包含依赖属性即可。

start_up_record

  • detail.current_tab_full_path
  • context.view_port.width
  • context.view_port.height
{
  "action": "start_up_record",
  "detail": {
    "current_tab_full_path": "https://stackoverflow.com/"
  },
  "context": {
    "view_port": {
      "width": 1519,
      "height": 715
    }
  }
}

focus

  • dom.path
{
  "action": "focus",
  "dom": {
    "path": "id(\"search\")/DIV[1]/INPUT[1]"
  }
}

blur

  • dom.path
  • detail.current_value
{
  "action": "blur",
  "detail": {
    "current_value": "c++",
  },
  "dom": {
    "path": "id(\"search\")/DIV[1]/INPUT[1]"
  }
}

input

  • dom.path
  • detail.full_value
{
  "action": "input",
  "detail": {
    "full_value": "c++"
  },
  "dom": {
    "path": "id(\"search\")/DIV[1]/INPUT[1]"
  }
}

enter_keyup

无依赖属性

{
  "action": "enter_keyup"
}

click

  • dom.cursor
{
  "action": "click",
  "dom": {
    "cursor": {
      "x": 844,
      "y": 22
    }
  }
}

scroll_end_by_mouse_wheel

  • dom.path
  • detail.scroll_top
  • detail.scroll_left
{
  "action": "scroll_end_by_mouse_wheel",
  "detail": {
    "scroll_top": 0,
    "scroll_left": 0,
    "direction": "up"
  },
  "dom": {
    "path": "id(\"undefined\")",
  }
}

close_tab

无依赖属性

{
  "action": "close_tab"
}

stop_record

无依赖属性

{
  "action": "stop_record"
}