mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-03 23:55:04 +08:00
* Fix node reference when changing elements * Fix ScriptVariables parsing * Fix invariant text and niagara types * Niagara convert nodes * Move node tests to own files * More Niagara tests * Niagara float and smaller fixes * More Decoding * More decoding * WIP * Float is real * WIP * More types and colors * Test case and small polish * WIP * WIP * Fix niagara script variables merging * Fix Niagara variables * Fixing mirrored ExportPath * Fix Export paths name adjustments * Simplify arc calculation * Simplify a bit arc calculation * source / destionation => origin / target * Minor refactoring * Fix switched link position * Rename some properties for uniformity * Fix input escape * Simplify test * About window * Dialog backdrop style * About dialog touches * Remove dependency and minot improvement * Light mode * Fix link location and css small improvement * Link direction and minor fixes * Some minor fixes and refactoring * Refactoring WIP * Shorting repetitive bits * More tests * Simplify linking tests
72 lines
2.2 KiB
JavaScript
Executable File
72 lines
2.2 KiB
JavaScript
Executable File
/**
|
|
* @typedef {{
|
|
* name: String,
|
|
* title?: String,
|
|
* subtitle?: String,
|
|
* value: String,
|
|
* size?: Number[],
|
|
* color?: CSSResult,
|
|
* icon?: TemplateResult,
|
|
* pins?: Number,
|
|
* pinNames?: String[],
|
|
* delegate: Boolean,
|
|
* development: Boolean,
|
|
* variadic?: Boolean,
|
|
* additionalTest?: (node: Locator<NodeElement>, pins: Locator<PinElement>[], blueprintPage: BlueprintFixture) => void,
|
|
* }} TestData
|
|
*/
|
|
|
|
export default class NodeTests {
|
|
/** @type {TestData[]} */
|
|
static testsData
|
|
|
|
/** @param {TestData[]} testsData */
|
|
static set(testsData) {
|
|
this.testsData = testsData
|
|
}
|
|
static get() {
|
|
return this.testsData
|
|
}
|
|
}
|
|
|
|
async function highlightClickPosition(page, x, y) {
|
|
await page.evaluate((elem, { x, y }) => {
|
|
const highlightElement = document.createElement('div')
|
|
highlightElement.style.position = 'absolute'
|
|
highlightElement.style.border = '2px solid red'
|
|
highlightElement.style.borderRadius = '50%'
|
|
highlightElement.style.width = '10px'
|
|
highlightElement.style.height = '10px'
|
|
highlightElement.style.transform = 'translate(-50%, -50%)'
|
|
highlightElement.style.pointerEvents = 'none' // Ensures click-through
|
|
highlightElement.style.zIndex = '9999'
|
|
highlightElement.style.left = `${x}px`
|
|
highlightElement.style.top = `${y}px`
|
|
|
|
document.body.appendChild(highlightElement)
|
|
|
|
// Automatically remove the highlight after a delay
|
|
setTimeout(() => document.body.removeChild(highlightElement), 100000) // Adjust delay as needed
|
|
}, { x, y })
|
|
}
|
|
|
|
/**
|
|
* @param {import("@playwright/test").Mouse} mouse
|
|
* @param {Locator<HTMLElement>} element
|
|
* @param {Coordinates} offset
|
|
*/
|
|
export async function dragAndDrop(mouse, element, offset) {
|
|
let { x, y } = await element.boundingBox()
|
|
x += 5
|
|
y += 5
|
|
await mouse.move(x, y)
|
|
await element.hover({ position: { x: 5, y: 5 } })
|
|
await highlightClickPosition(element, x, y)
|
|
await mouse.down()
|
|
x += offset[0]
|
|
y += offset[1]
|
|
await mouse.move(x, y, { steps: 10 })
|
|
await highlightClickPosition(element, x, y)
|
|
await mouse.up()
|
|
}
|