tests: use transform matrix to confirm node positions
This commit is contained in:
@@ -969,7 +969,7 @@ export function useActions(
|
||||
|
||||
until(() => viewportHelper.value.initialized)
|
||||
.toBe(true)
|
||||
.then(async () => {
|
||||
.then(() => {
|
||||
setTimeout(() => {
|
||||
state.hooks.paneReady.trigger({
|
||||
id,
|
||||
|
||||
@@ -17,16 +17,23 @@ describe('Render Basic Example', () => {
|
||||
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', () =>
|
||||
cy.get('.vue-flow__node').each((node) => expect(nodes.some((el) => el.label === node.text())).to.be.true))
|
||||
it('renders correct node labels', () => {
|
||||
cy.get('.vue-flow__node').each((node) => expect(nodes.some((el) => el.label === node.text())).to.be.true)
|
||||
})
|
||||
|
||||
it('renders nodes at correct position', () =>
|
||||
cy
|
||||
.get('.vue-flow__node')
|
||||
.each(
|
||||
(node) =>
|
||||
expect(nodes.some((el) => el.position.x === node.position().left && el.position.y === node.position().top)).to.be.true,
|
||||
))
|
||||
it('renders nodes at correct position', () => {
|
||||
cy.get('.vue-flow__node').each((el) => {
|
||||
const node = nodes.find((node) => node.id === el.attr('data-id'))!
|
||||
|
||||
expect(node).to.exist
|
||||
|
||||
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