-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Added cypress and drag handle, drag to connect, drag to reassig…
…n tests
- Loading branch information
1 parent
bfe5bb8
commit 3513d63
Showing
17 changed files
with
317 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Cypress Tests | ||
on: [push] | ||
jobs: | ||
cypress-run: | ||
runs-on: ubuntu-latest | ||
# Runs tests in parallel with matrix strategy https://docs.cypress.io/guides/guides/parallelization | ||
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs | ||
# Also see warning here https://github.com/cypress-io/github-action#parallel | ||
strategy: | ||
fail-fast: false # https://github.com/cypress-io/github-action/issues/48 | ||
matrix: | ||
containers: [1, 2] # Uses 2 parallel instances | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Cypress run | ||
# Uses the official Cypress GitHub action https://github.com/cypress-io/github-action | ||
uses: cypress-io/github-action@v6 | ||
with: | ||
# Starts web server for E2E tests - replace with your own server invocation | ||
# https://docs.cypress.io/guides/continuous-integration/introduction#Boot-your-server | ||
start: npm start | ||
wait-on: 'http://localhost:3000' # Waits for above | ||
# Records to Cypress Cloud | ||
# https://docs.cypress.io/guides/cloud/projects#Set-up-a-project-to-record | ||
record: true | ||
parallel: true # Runs test in parallel using settings above | ||
env: | ||
# For recording and parallelization to work you must set your CYPRESS_RECORD_KEY | ||
# in GitHub repo → Settings → Secrets → Actions | ||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | ||
# Creating a token https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineConfig } from "cypress"; | ||
|
||
export default defineConfig({ | ||
projectId: "7b1oh6", | ||
e2e: { | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
describe('DragHandleComponent', () => { | ||
beforeEach(() => { | ||
cy.visit('http://localhost:4200/examples/drag-handle'); | ||
}); | ||
|
||
it('should drag fNode element and update its transform translate', function() { | ||
|
||
cy.get('.f-node.f-drag-handle').invoke('css', 'transform') | ||
.should('equal', 'matrix(1, 0, 0, 1, 0, 0)'); | ||
|
||
cy.get('.f-node.f-drag-handle') | ||
.trigger('mousedown', { button: 0, force: true }) | ||
.trigger('mousemove', { clientX: -150, clientY: 0 }) | ||
.trigger('mouseup', { clientX: 0, clientY: 0 }); | ||
|
||
cy.get('.f-node.f-drag-handle').invoke('css', 'transform') | ||
.should('equal', 'matrix(1, 0, 0, 1, 150, 0)'); | ||
}); | ||
|
||
it('should click fNode element and update its selection state', function() { | ||
|
||
cy.get('.f-node.f-drag-handle') | ||
.should('not.have.class', 'f-selected'); | ||
|
||
cy.get('.f-node.f-drag-handle').click(); | ||
|
||
cy.get('.f-node.f-drag-handle').should('have.class', 'f-selected'); | ||
}); | ||
|
||
it('should drag fCanvas element and update its transform translate', function () { | ||
cy.get('.f-canvas').invoke('css', 'transform') | ||
.should('equal', 'matrix(1, 0, 0, 1, -15.1484, 103.5)'); | ||
|
||
cy.get('#f-flow-0') | ||
.trigger('mousedown', { clientX: 10, clientY: 10, button: 0, force: true }) | ||
.trigger('mousemove', { clientX: 0, clientY: 0 }) | ||
.trigger('mousemove', { clientX: 20, clientY: 0 }) | ||
.trigger('mouseup', { clientX: 30, clientY: 0 }); | ||
|
||
cy.get('.f-canvas').invoke('css', 'transform') | ||
.should('not.equal', 'matrix(1, 0, 0, 1, -15.1484, 103.5)'); | ||
}); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
describe('DragToConnectComponent', () => { | ||
beforeEach(() => { | ||
cy.visit('http://localhost:4200/examples/drag-to-connect') | ||
}) | ||
|
||
it('should start creating a connection and show connection-for-create element', function () { | ||
cy.get('.f-connection-for-create').should('exist') | ||
.invoke('css', 'display').should('equal', 'none'); | ||
|
||
cy.get('.f-node-output') | ||
.trigger('mousedown', { button: 0, force: true }) | ||
.trigger('mousemove', { clientX: 0, clientY: 0 }) | ||
.trigger('mousemove', { clientX: 140, clientY: 10 }) | ||
.get('.f-connection-for-create').should('exist') | ||
.invoke('css', 'display').should('equal', 'block') | ||
.get('.f-node-output') | ||
.trigger('mouseup'); | ||
|
||
cy.get('.f-connection-for-create').should('exist') | ||
.invoke('css', 'display').should('equal', 'none'); | ||
}); | ||
|
||
it('should drag from output to input and create a connection', function () { | ||
cy.get('#f-connection-0').should('not.exist'); | ||
|
||
cy.get('.f-node-output') | ||
.trigger('mousedown', { button: 0, force: true }) | ||
.trigger('mousemove', { clientX: 0, clientY: 0 }) | ||
.trigger('mousemove', { clientX: 140, clientY: 10 }) | ||
.get('.f-node-input') | ||
.trigger('mousemove', { clientX: 140, clientY: 10 }) | ||
.trigger('mouseup'); | ||
|
||
cy.get('#f-connection-0').should('exist'); | ||
}); | ||
}) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
describe('DragToReassignComponent', () => { | ||
beforeEach(() => { | ||
cy.visit('http://localhost:4200/examples/drag-to-reassign') | ||
}) | ||
|
||
it('should drag from input to anoyher input and reassign the connection', function() { | ||
cy.get('#connection_f-connection-012').should('exist'); | ||
|
||
cy.get('.f-connection-drag-handle') | ||
.trigger('mousedown', { button: 0, force: true }) | ||
.trigger('mousemove', { clientX: 0, clientY: 0 }) | ||
.trigger('mousemove', { clientX: 20, clientY: 10 }) | ||
.get('div[data-f-input-id=\'f-node-input-1\']') | ||
.trigger('mousemove', { clientX: 20, clientY: 10 }) | ||
.trigger('mouseup'); | ||
|
||
cy.get('#connection_f-connection-012').should('not.exist'); | ||
cy.get('#connection_for_selection_f-connection-11f-node-input-1').should('exist'); | ||
}); | ||
}) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
describe('ResizeHandleComponent', () => { | ||
beforeEach(() => { | ||
cy.visit('http://localhost:4200/examples/resize-handle'); | ||
}); | ||
|
||
it('should drag fNode ResizeHandle and update node size', function() { | ||
|
||
cy.get('div[data-f-node-id=\'f-node-0\']').invoke('css', 'transform') | ||
.should('equal', 'matrix(1, 0, 0, 1, 0, 0)'); | ||
|
||
cy.get('div[data-f-node-id=\'f-node-0\']').invoke('css', 'width') | ||
.should('equal', '120px'); | ||
|
||
cy.get('div[data-f-node-id=\'f-node-0\'] div[data-f-resize-handle-type$=\'TOP\']') | ||
.trigger('mousedown', { button: 0, force: true }) | ||
.trigger('mousemove', { clientX: 0, clientY: 0 }) | ||
.trigger('mousemove', { clientX: -50, clientY: -50 }) | ||
.trigger('mouseup'); | ||
|
||
cy.get('div[data-f-node-id=\'f-node-0\']').invoke('css', 'transform') | ||
.should('equal', 'matrix(1, 0, 0, 1, -50, -50)'); | ||
|
||
cy.get('div[data-f-node-id=\'f-node-0\']').invoke('css', 'width') | ||
.should('equal', '170px'); | ||
}); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// *********************************************************** | ||
// This example support/e2e.ts is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.