feat(tests): add selection test

This commit is contained in:
moklick
2019-10-03 22:44:12 +02:00
parent a4e613e491
commit 22d2e62f9a
4 changed files with 24 additions and 2 deletions
+2
View File
@@ -2,3 +2,5 @@
.cache .cache
node_modules node_modules
examples/build examples/build
cypress/videos
cypress/screenshots
+3 -1
View File
@@ -1,3 +1,5 @@
{ {
"baseUrl": "http://localhost:1234" "baseUrl": "http://localhost:1234",
"viewportWidth": 1280,
"viewportHeight": 720
} }
+18
View File
@@ -15,6 +15,24 @@ describe('Basic Flow Rendering', () => {
cy.get('.react-graph__node:first').click().should('have.class', 'selected'); cy.get('.react-graph__node:first').click().should('have.class', 'selected');
}); });
it('deselects node', () => {
cy.get('.react-graph__renderer').click(0, 0);
cy.get('.react-graph__node:first').should('not.have.class', 'selected');
});
it('select all nodes', () => {
// @FIX: why is there no selection__pane visible?
// https://docs.cypress.io/api/commands/type.html#Do-a-shift-click
cy.get('body')
.type('{shift}', { release: false })
.get('.react-graph__selectionpane')
.trigger('mousedown', 'topLeft', { which: 1, force: true })
.trigger('mousemove', 'bottomRight', { which: 1 })
.trigger('mouseup', 'bottomRight', { force: true });
cy.get('.react-graph__node').should('have.class', 'selected');
});
it('selects an edge', () => { it('selects an edge', () => {
cy.get('.react-graph__edge:first').click().should('have.class', 'selected'); cy.get('.react-graph__edge:first').click().should('have.class', 'selected');
}); });
Binary file not shown.