mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-13 15:27:30 +08:00
Small refactoring, several tests added
This commit is contained in:
57
cypress/e2e/hid/debugKey0.cy.js
Normal file
57
cypress/e2e/hid/debugKey0.cy.js
Normal file
@@ -0,0 +1,57 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
import Blueprint from "../../../js/Blueprint"
|
||||
import Configuration from "../../../js/Configuration"
|
||||
import getFirstWordOrder from "../../fixtures/getFirstWordOrder"
|
||||
import NodeElement from "../../../js/element/NodeElement"
|
||||
import SVGIcon from "../../../js/SVGIcon"
|
||||
import Utility from "../../../js/Utility"
|
||||
|
||||
describe("Debug Key 0", () => {
|
||||
|
||||
context("Tests", () => {
|
||||
/** @type {NodeElement} */
|
||||
let node
|
||||
/** @type {Blueprint} */
|
||||
let blueprint
|
||||
|
||||
before(() => {
|
||||
cy.visit(`http://127.0.0.1:${Cypress.env("UEBLUEPRINT_TEST_SERVER_PORT")}/empty.html`)
|
||||
cy.get("ueb-blueprint")
|
||||
.then(b => blueprint = b[0])
|
||||
.click(100, 300)
|
||||
.then(() => Utility.paste(blueprint, String.raw`
|
||||
Begin Object Class=/Script/InputBlueprintNodes.K2Node_InputDebugKey Name="K2Node_InputDebugKey_0"
|
||||
InputKey=Zero
|
||||
NodePosX=-144
|
||||
NodePosY=80
|
||||
NodeGuid=19AE58B8CA2B46D3A77778B76B90409B
|
||||
CustomProperties Pin (PinId=3683ED6F41234C5591A0440A16CC2B11,PinName="Pressed",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=7516E2FD930C43E78D2DDD51926717BE,PinName="Released",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=FC2EB521E8C74DC3938DFAF237926C03,PinName="Key",Direction="EGPD_Output",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/InputCore.Key"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="None",AutogeneratedDefaultValue="None",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=A9B2A265B31D44A098000F58CF0D9809,PinName="ActionValue",Direction="EGPD_Output",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/EnhancedInput.InputActionValue"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
End Object
|
||||
`))
|
||||
.then(() => node = blueprint.querySelector("ueb-node"))
|
||||
})
|
||||
it("is red", () => expect(Configuration.nodeColor(node)).to.be.equal(Configuration.nodeColors.red))
|
||||
it("has no delegate", () => expect(node.querySelector('.ueb-node-top ueb-pin[data-type="delegate"]')).to.be.null)
|
||||
it("is called Debug Key 0", () => expect(node.getNodeDisplayName()).to.be.equal("Debug Key 0"))
|
||||
it("has a keyboard icon", () => expect(Configuration.nodeIcon(node)).to.be.equal(SVGIcon.keyboard))
|
||||
it("has 3 pins", () => expect(node.querySelectorAll("ueb-pin")).to.be.lengthOf(4))
|
||||
it("is development only", () => expect(node.entity.isDevelopmentOnly()).to.be.true)
|
||||
it("maintains the order of attributes", () => {
|
||||
blueprint.selectAll()
|
||||
const value = blueprint.template.getCopyInputObject().getSerializedText()
|
||||
expect(value).to.match(getFirstWordOrder([
|
||||
"InputKey",
|
||||
"NodePosX",
|
||||
"NodePosY",
|
||||
"NodeGuid",
|
||||
"CustomProperties",
|
||||
"CustomProperties",
|
||||
"CustomProperties",
|
||||
]))
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user