tests: use transform matrix to confirm node positions
This commit is contained in:
@@ -969,7 +969,7 @@ export function useActions(
|
|||||||
|
|
||||||
until(() => viewportHelper.value.initialized)
|
until(() => viewportHelper.value.initialized)
|
||||||
.toBe(true)
|
.toBe(true)
|
||||||
.then(async () => {
|
.then(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
state.hooks.paneReady.trigger({
|
state.hooks.paneReady.trigger({
|
||||||
id,
|
id,
|
||||||
|
|||||||
@@ -17,16 +17,23 @@ describe('Render Basic Example', () => {
|
|||||||
cy.get('.vue-flow__node').should('have.length', nodes.length)
|
cy.get('.vue-flow__node').should('have.length', nodes.length)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders edges', () => cy.get('.vue-flow__edge').should('have.length', edges.length))
|
it('renders edges', () => {
|
||||||
|
cy.get('.vue-flow__edge').should('have.length', edges.length)
|
||||||
|
})
|
||||||
|
|
||||||
it('renders correct node labels', () =>
|
it('renders correct node labels', () => {
|
||||||
cy.get('.vue-flow__node').each((node) => expect(nodes.some((el) => el.label === node.text())).to.be.true))
|
cy.get('.vue-flow__node').each((node) => expect(nodes.some((el) => el.label === node.text())).to.be.true)
|
||||||
|
})
|
||||||
|
|
||||||
it('renders nodes at correct position', () =>
|
it('renders nodes at correct position', () => {
|
||||||
cy
|
cy.get('.vue-flow__node').each((el) => {
|
||||||
.get('.vue-flow__node')
|
const node = nodes.find((node) => node.id === el.attr('data-id'))!
|
||||||
.each(
|
|
||||||
(node) =>
|
expect(node).to.exist
|
||||||
expect(nodes.some((el) => el.position.x === node.position().left && el.position.y === node.position().top)).to.be.true,
|
|
||||||
))
|
expect(el)
|
||||||
|
.to.have.css('transform')
|
||||||
|
.and.match(new RegExp(`matrix\\(1, 0, 0, 1, ${node.position.x}, ${node.position.y}\\)`))
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user