UNPKG

askui

Version:

Reliable, automated end-to-end-testing that depends on what is shown on your screen instead of the technology you are running on

22 lines (21 loc) 849 B
import { BoundingBox } from './boundary-box'; /** * * @param {string} name - The element type e.g text, button * @param {string} text - The detected text inside the element * @param {BoundingBox} bndbox - The element bounding box * @param {string[]} colors - An optional, the element top 3 dominate colors * */ export class DetectedElement { constructor(name, text, bndbox, colors, similarityScore) { this.name = name; this.text = text; this.bndbox = bndbox; this.colors = colors; this.similarityScore = similarityScore; } static fromJson(detectedElement, resizeRatio = 1) { return new DetectedElement(detectedElement.name, detectedElement.text, BoundingBox.fromJson(detectedElement.bndbox, resizeRatio), detectedElement.colors || undefined, detectedElement.similarityScore || 0); } }