New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@antcube/wpt

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antcube/wpt

wpt test case to cube test case tool

latest
npmnpm
Version
0.0.6
Version published
Maintainers
1
Created
Source

本项目为转化 wpt case 的工具.

命令安装

tnpm install @antcube/wpt -g

帮助以及参数说明

查看帮助

acwpt -h

参数说明

  • -w 要转化的 wpt 的 case 的根目录.
  • -o 输出的 Cube 工程以及其他产物的根目录
  • -i wpt case 中需要缓存的图片的路径(可选)

输出

输出有两个文件夹

  • 一个文件夹将每一个可用的 html 转化成一个对应的 Cube App 工程, 放在该文件夹的根目录下. 并编译一遍. 这个给 Rubik 自动化测试用
  • 另一个文件夹将所有的 html 导出成一个工程, 可以直接编译, 扫码运行

主要功能点

  • 如果输入的参数中有 wpt 的 case 的图片地址. 那么将该目录下的所有图片, 都上传到 basement, 并把结果以map形式保存到本地. map 的key 为 该图片的相对路径, value 为图片上传后的 url
  • 将需要转化的 wpt 的 case 的根目录下的所有的 html 文件都遍历一下, 解析里面的标签以及 css style, 过滤掉 Cube 不支持的 case. 将里面的 css style 以及 body 内的 标签转化成 Cube 的 Vue 页面. 并编译通过
  • 保存每一个页面对应的 SQL 语句
  • 生成 Rubik 自动化测试的 Runner && Method
  • 增量处理的逻辑. 如果检测到 图片已经上传(html文件没变化/SQL已经导出) 等则不在进行该操作

代码结构说明

  • Parser -- 用来解析 html / css / JS 的
  • Model -- 存放解析结果的数据模型
  • Cache -- 缓存文件相关信息以及已经处理的文件信息(doing)
  • Image -- 图片上传模块, 以及保存结果
  • CubeMaker -- 解析结果转化为Cube工程以及其他产物的逻辑
  • Utils -- 工具类方法
  • index -- 工具入口

注意事项:

  • 因为依赖了basement模块所以需要用 tnpm install
  • HtmlParser2 的接口文档缺少一个方法. 需要在 DomHandler 的声明中增加一个方法
    onattribute(name:string, value:string):void;

FAQs

Package last updated on 13 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts