Skip to content
Snippets Groups Projects
Commit 2143ff7a authored by Loic Huder's avatar Loic Huder
Browse files

Merge branch 'reorg-cypress' into 'main'

Reorganize Cypress tests and remove duplicate tests

See merge request !389
parents 7604c059 78b8562f
No related branches found
No related tags found
1 merge request!389Reorganize Cypress tests and remove duplicate tests
Pipeline #136723 passed
Showing
with 312 additions and 571 deletions
describe('structure and basics for edit workflows', () => {
before(() => {
cy.loadApp();
});
it('displays the canvas', () => {
cy.get('.react-flow').should('be.visible');
cy.get('.react-flow__controls').should('be.visible');
cy.get('.react-flow__background').should('be.visible');
cy.get('.react-flow__attribution').should('be.visible');
});
it('opens the tutorial_Graph on the canvas', () => {
cy.contains('tutorial_Graph');
cy.get('h1').should('include.text', 'tutorial_Graph');
});
it('displays the number of nodes the tutorial_Graph has', () => {
cy.get('.react-flow__node').should('have.length', 17);
});
it('displays the number of links the tutorial_Graph has', () => {
cy.get('.react-flow__edge').should('have.length', 13);
});
});
describe('clicks on canvas and elements', () => {
before(() => {
cy.loadApp();
cy.findByRole('button', { name: 'Close task drawer' }).click();
});
it('selects a node with click', () => {
cy.get('.react-flow__node')
.first()
.click({ force: true })
.should('include.class', 'selected');
cy.waitForStableDOM();
cy.contains('Label').should('exist').should('be.visible');
cy.contains('Comment').should('exist').should('be.visible');
cy.findByRole('heading', { name: 'Default Inputs' }).should('be.visible');
cy.contains('Default Error Node').should('exist').should('be.visible');
cy.contains('Inputs Complete').should('exist').should('be.visible');
cy.findByRole('heading', { name: 'Task Info' })
.should('exist')
.should('be.visible');
cy.findByRole('heading', { name: 'Appearance' }).should('exist');
});
it('selects a link with click', () => {
cy.contains('on_error').should('not.exist');
cy.contains('Conditions').should('not.exist');
cy.contains('Map all Data').should('not.exist');
cy.contains('Required').should('not.exist');
cy.contains('Source').should('not.exist');
cy.contains('Target').should('not.exist');
cy.get('.react-flow__edge')
.first()
.click({ force: true })
.should('include.class', 'selected');
cy.contains('Map all Data').should('exist').should('be.visible');
cy.contains('On Error condition').should('exist').should('be.visible');
cy.contains('Conditions').should('exist').should('be.visible');
cy.contains('Required').should('exist').should('be.visible');
cy.contains('Comment').should('exist').should('be.visible');
});
it('doubleclick on graph node', () => {
cy.get('.react-flow__node-graph')
.should('have.length', 7)
.last()
.dblclick();
cy.get('.react-flow__node').should('not.have.length', 17);
cy.get('h1')
.get('.MuiBreadcrumbs-li')
.should('have.length', 2)
.first()
.contains('tutorial_Graph')
.click();
cy.get('.react-flow__node').should('have.length', 17);
});
});
describe('change link attributes', () => {
before(() => {
cy.loadApp();
cy.get('.react-flow').contains('if you do then...').parent().click();
});
it('changes links label and is reflected on the canvas', () => {
cy.findByRole('textbox', { name: 'Label' })
.contains('if you do then...')
.should('have.value', 'if you do then...')
.click()
.type('Always and forever...');
cy.get('.react-flow')
.contains('if you do then...Always and forever...')
.should('be.visible');
});
it('changes links animated property to true and is shown on the canvas', () => {
cy.findByRole('heading', { name: 'Appearance' }).click({ force: true });
cy.contains('Animated').siblings().click();
cy.get('.react-flow')
.contains('if you do then...')
.parent()
.parent()
.should('include.class', 'animated');
});
it('changes links arrowHead property to arrowclosed and is shown on the canvas', () => {
cy.get('.react-flow')
.contains('if you do then...Always and forever...')
.parent()
.siblings()
.should('have.attr', 'marker-end', 'url(#)');
cy.contains('none').click({ force: true });
cy.contains('arrowclosed').click({ force: true });
cy.get('.react-flow')
.contains('if you do then...Always and forever...')
.parent()
.siblings()
.should('have.attr', 'marker-end', 'url(#1__type=arrowclosed)');
});
});
describe('select visualize links', () => {
before(() => {
cy.loadApp();
});
it('link has the default style', () => {
cy.get('.react-flow')
.contains('if you do then...')
.should(
'have.attr',
'style',
'fill: rgb(206, 92, 0); font-weight: 500; font-size: 14px; color: rgb(206, 92, 0);'
)
.siblings('rect')
.should(
'have.attr',
'style',
'fill: rgb(223, 226, 247); fill-opacity: 1; stroke-width: 3px; stroke: rgb(206, 92, 0);'
);
});
it('selects a link and adds selected class and sidebar shows details', () => {
cy.get('.react-flow')
.contains('if you do then...')
.parent()
.click()
.parent()
.should('include.class', 'selected');
cy.contains('Map all Data').should('be.visible');
cy.findByRole('textbox', { name: 'Label' })
.contains('if you do then...')
.should('have.value', 'if you do then...');
});
});
describe('test newGraph scenarios', () => {
before(() => {
cy.loadAppWithoutGraph();
});
it('Initially it displays the empty canvas', () => {
cy.get('.react-flow').should('be.visible');
cy.get('.react-flow__controls').should('be.visible');
cy.get('.react-flow__background').should('be.visible');
cy.get('.react-flow__attribution').should('be.visible');
});
it('...then open a graph and show graph details', () => {
cy.loadGraph('tutorial_Graph');
cy.contains('tutorial_Graph');
cy.get('h1').should('include.text', 'tutorial_Graph');
});
});
describe('drag and drop nodes', () => {
before(() => {
cy.loadApp();
});
it('should drag and drop a node from add nodes into canvas', () => {
cy.get('.react-flow__node').should('have.length', 17);
cy.findByRole('button', { name: 'ewokscore' }).click();
cy.dragNodeInCanvas('ewokscore.tests.examples.tasks.sumtask.SumTask');
cy.get('.react-flow__node').should('have.length', 18);
});
// TODO: move node - dragstart seems to grasp the inner and creates a ghost
it.skip('should move a node in the canvas', () => {
// const dataTransfer = new DataTransfer();
// cy.get('.react-flow__node-graph').last().trigger('dragstart', {
// dataTransfer,
// });
// cy.get('.react-flow').last().trigger('drop', {
// dataTransfer,
// });
cy.get('.react-flow__node-graph')
.last()
.click()
.trigger('mousedown', { button: 0 })
.wait(100)
.then(($node) => {
const initialPosition = $node.position();
const startX = initialPosition.left;
const startY = initialPosition.top;
cy.get('.react-flow__node-graph')
.last()
.trigger('mousemove', {
clientX: startX - 100,
clientY: startY - 100,
force: true,
})
.wait(100)
.trigger('mouseup', { force: true })
.wait(100);
cy.get('.react-flow__node-graph')
.last()
.then(($movedNode) => {
const newPosition = $movedNode.position();
const movedX = newPosition.left;
const movedY = newPosition.top;
expect(movedX).to.not.equal(startX);
expect(movedY).to.not.equal(startY);
});
cy.get('.react-flow__node').should('have.length', 19);
});
});
});
import { nanoid } from 'nanoid';
describe('create workflow and save', () => {
before(() => {
cy.loadAppWithoutGraph();
});
// Skip this test until unsaved modifications can be properly tracked
it.skip('will not open the dialog for name after clicking new', () => {
cy.findByRole('dialog').should('not.exist');
cy.get('[aria-controls="navbar-dropdown-menu"]').click();
cy.get('#navbar-dropdown-menu').within(() => {
cy.contains('[role="menuitem"]', 'New workflow').click();
});
cy.findByRole('dialog').should('not.exist');
cy.get('body').click();
cy.waitForStableDOM();
});
it('gives a new unique name creates and deletes workflow', () => {
cy.findByRole('button', { name: 'Save workflow to server' }).click();
cy.findByRole('dialog').should('be.visible');
const id = nanoid();
cy.findByRole('textbox', {
name: 'Identifier',
}).type(id);
cy.findByRole('button', { name: 'Save workflow' }).click();
cy.get('.react-flow__edge').should('have.length', 0);
cy.get('.react-flow__node').should('have.length', 0);
cy.loadGraph(id);
cy.get(`[data-cy="${id}"]`).contains(id);
cy.get(`[data-cy="tutorial_Graph"]`).should('not.exist');
cy.get('[aria-controls="editSidebar-dropdown-menu"]').click();
cy.contains(`Delete Workflow`).click();
cy.contains(`Delete workflow with id: "${id}"?`);
cy.findByRole('button', { name: 'Yes' }).click();
cy.get(`[data-cy="${id}"]`).should('not.exist');
cy.get('p').should(
'include.text',
'Drag and drop tasks here to start building your workflow,or use Quick Open to open an existing workflow.'
);
});
});
describe('undo-redo functionality', () => {
before(() => {
cy.loadApp();
});
it.skip('initially there is no back or forth', () => {
cy.get('[data-cy="undoButton"]').click();
cy.contains('No more back or forth!').should('be.visible');
cy.get('[data-cy="redoButton"]').click();
cy.contains('No more back or forth!').should('be.visible');
});
it.skip('type and undo/redo sidebar label', () => {
cy.get('.react-flow').contains('if you do then...').parent().click();
cy.findByRole('textbox', { name: 'Label' })
.contains('if you do then...')
.should('have.value', 'if you do then...')
.click()
.type('Always and forever...');
cy.get('.react-flow')
.contains('if you do then...Always and forever...')
.should('be.visible');
// cy.get('[data-cy="undoButton"]').click();
// cy.get('.react-flow').contains('if you do then...').should('be.visible');
// cy.findByRole('textbox', { name: 'Label' })
// .contains('if you do then...')
// .should('have.value', 'if you do then...');
// cy.get('[data-cy="redoButton"]').click();
// cy.get('.react-flow')
// .contains('if you do then...Always and forever...')
// .should('be.visible');
// cy.findByRole('textbox', { name: 'Label' })
// .contains('if you do then...')
// .should('have.value', 'if you do then...Always and forever...');
});
});
describe('edit nodes defaultInputs', () => {
before(() => {
cy.loadApp();
});
it('click on a node and see Default Inputs', () => {
cy.get('.react-flow').contains('ewoksweb').parent().click({ force: true });
cy.contains('Default Inputs').should('be.visible');
});
it('insert a new Default Input', () => {
cy.findAllByRole('row').should('have.length', 2); // Header + Button
cy.findByRole('button', { name: 'Add row' }).click();
cy.findAllByRole('row').should('have.length', 3); // Header + New Row + Button
});
it('type and undo/redo a new Default Input', () => {
cy.get('[data-cy="inputInEditableCell"]')
.should('exist')
.should('be.visible');
cy.get('[data-cy="deleteButtonEditableTable"]').should('be.visible');
cy.get('[data-cy="inputInEditableCell"]').should('have.length', 2);
cy.get('[data-cy="inputInEditableCell"]').first().type('Always');
cy.get('[data-cy="inputInEditableCell"]').last().type('and forever');
cy.get('[data-cy="deleteButtonEditableTable"]').should('be.visible');
// cy.get('[data-cy="undoButton"]').click();
// cy.get('[data-cy="deleteButtonEditableTable"]').should('be.visible');
// cy.get('[data-cy="editButtonEditableTable"]').should('be.visible');
// cy.get('[data-cy="inputInEditableCell"]').should('not.exist');
// cy.get('[data-cy="redoButton"]').click();
// cy.get('[data-cy="deleteButtonEditableTable"]').click();
// cy.get('[data-cy="undoButton"]').click();
// cy.get('[data-cy="undoButton"]').click();
// cy.get('[data-cy="undoButton"]').click();
});
});
describe('edit links dataMapping', () => {
before(() => {
cy.loadApp();
});
it('change the canvas color', () => {
cy.findByLabelText('Canvas Background Color').should(
'have.attr',
'value',
'#e9ebf7'
);
cy.get('.react-flow__background')
.should('be.visible')
.should('have.css', 'background-color', 'rgb(233, 235, 247)');
cy.findByLabelText('Canvas Background Color')
.invoke('val', '#ff0000')
.trigger('input')
.should('have.attr', 'value', '#ff0000');
cy.get('.react-flow__background')
.should('be.visible')
.should('have.css', 'background-color', 'rgb(255, 0, 0)');
});
});
describe('sidebar menu', () => {
before(() => {
cy.loadAppWithoutGraph();
});
// Stays until decide on the initial screen
it('Cannot delete or clone a workflow with an empty canvas', () => {
cy.get('[aria-controls="editSidebar-dropdown-menu"]').click();
cy.get('#editSidebar-dropdown-menu').within(() => {
cy.contains('[role="sidebarMenuItem"]', 'Clone Workflow').should(
'have.class',
'Mui-disabled'
);
});
cy.get('#editSidebar-dropdown-menu').within(() => {
cy.contains('[role="sidebarMenuItem"]', 'Delete Workflow').should(
'have.class',
'Mui-disabled'
);
});
cy.get('body').click();
});
it('opens the clone Graph form with new workflow name', () => {
cy.loadApp();
cy.get('[aria-controls="editSidebar-dropdown-menu"]').click();
cy.get('#editSidebar-dropdown-menu').within(() => {
cy.contains('[role="sidebarMenuItem"]', 'Clone Workflow').click();
});
cy.waitForStableDOM();
cy.contains('Give the new workflow identifier')
.parent()
.should('have.class', 'MuiDialogTitle-root')
.siblings()
.first()
.as('dialogContent')
.should('have.class', 'MuiDialogContent-root');
cy.loadApp();
});
it('opens the clone Task form when node is selected', () => {
cy.get('.react-flow').contains('ewoksweb').parent().click({ force: true });
cy.waitForStableDOM();
cy.get('[aria-controls="editSidebar-dropdown-menu"]').click();
cy.get('.MuiListItem-button')
.contains('Create Task from Node')
.parent()
.click();
cy.contains('Create task')
.parent()
.should('have.class', 'MuiDialogTitle-root')
.siblings()
.first()
.as('dialogContent')
.should('have.class', 'MuiDialogContent-root');
cy.findByRole('button', { name: 'Cancel' }).click({ force: true });
cy.get('body').click();
});
});
before(() => {
cy.loadApp();
cy.findByRole('button', { name: 'Close task drawer' }).click();
});
it('selects a node with click', () => {
cy.get('.react-flow__node')
.first()
.click({ force: true })
.should('include.class', 'selected');
cy.waitForStableDOM();
cy.contains('Label').should('exist').should('be.visible');
cy.contains('Comment').should('exist').should('be.visible');
cy.findByRole('heading', { name: 'Default Inputs' }).should('be.visible');
cy.contains('Default Error Node').should('exist').should('be.visible');
cy.contains('Inputs Complete').should('exist').should('be.visible');
cy.findByRole('heading', { name: 'Task Info' })
.should('exist')
.should('be.visible');
cy.findByRole('heading', { name: 'Appearance' }).should('exist');
});
it('selects a link with click', () => {
cy.contains('on_error').should('not.exist');
cy.contains('Conditions').should('not.exist');
cy.contains('Map all Data').should('not.exist');
cy.contains('Required').should('not.exist');
cy.contains('Source').should('not.exist');
cy.contains('Target').should('not.exist');
cy.get('.react-flow__edge')
.first()
.click({ force: true })
.should('include.class', 'selected');
cy.contains('Map all Data').should('exist').should('be.visible');
cy.contains('On Error condition').should('exist').should('be.visible');
cy.contains('Conditions').should('exist').should('be.visible');
cy.contains('Required').should('exist').should('be.visible');
cy.contains('Comment').should('exist').should('be.visible');
});
it('doubleclick on graph node', () => {
cy.get('.react-flow__node-graph').should('have.length', 7).last().dblclick();
cy.get('.react-flow__node').should('not.have.length', 17);
cy.get('h1')
.get('.MuiBreadcrumbs-li')
.should('have.length', 2)
.first()
.contains('tutorial_Graph')
.click();
cy.get('.react-flow__node').should('have.length', 17);
});
before(() => {
cy.loadApp();
});
it('changes the canvas color', () => {
cy.findByLabelText('Canvas Background Color').should(
'have.attr',
'value',
'#e9ebf7'
);
cy.get('.react-flow__background')
.should('be.visible')
.should('have.css', 'background-color', 'rgb(233, 235, 247)');
cy.findByLabelText('Canvas Background Color')
.invoke('val', '#ff0000')
.trigger('input')
.should('have.attr', 'value', '#ff0000');
cy.get('.react-flow__background')
.should('be.visible')
.should('have.css', 'background-color', 'rgb(255, 0, 0)');
});
describe('structure and basics for edit workflows', () => {
before(() => {
cy.visit('http://localhost:3000/edit');
});
it('displays the canvas', () => {
cy.get('.react-flow').should('be.visible');
cy.get('.react-flow__controls').should('be.visible');
cy.get('.react-flow__background').should('be.visible');
cy.get('.react-flow__attribution').should('be.visible');
});
it('displays the autocomplete dropdown', () => {
cy.findByRole('textbox', {
name: 'Quick open',
}).should('be.visible');
});
it('displays the Graph Details', () => {
cy.get('p').should(
'include.text',
'Drag and drop tasks here to start building your workflow,or use Quick Open to open an existing workflow.'
);
});
});
......@@ -5,14 +5,17 @@ before(() => {
it('makes icons appear on tasks correctly', () => {
cy.findByRole('button', { name: 'ewokscore' }).click();
cy.findByRole('img', {
name: 'ewokscore.tests.examples.tasks.sumtask.SumTask',
})
.should('have.attr', 'src')
.should(
'include',
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAAA7D'
);
cy.readFile(
'pysrc/ewoksweb/tests/resources/icons/default.png',
'base64'
).then((imgData) => {
console.log(imgData);
cy.findByRole('img', {
name: 'ewokscore.tests.examples.tasks.sumlist.SumList',
})
.should('have.attr', 'src')
.should('eq', `data:image/png;base64,${imgData}`);
});
});
it('should upload and delete icons', () => {
......
before(() => {
cy.loadApp();
cy.get('.react-flow').contains('if you do then...').parent().click();
});
it('link has the default style', () => {
cy.get('.react-flow')
.contains('if you do then...')
.should(
'have.attr',
'style',
'fill: rgb(206, 92, 0); font-weight: 500; font-size: 14px; color: rgb(206, 92, 0);'
)
.siblings('rect')
.should(
'have.attr',
'style',
'fill: rgb(223, 226, 247); fill-opacity: 1; stroke-width: 3px; stroke: rgb(206, 92, 0);'
);
});
it('selects a link and adds selected class and sidebar shows details', () => {
cy.get('.react-flow')
.contains('if you do then...')
.parent()
.parent()
.should('include.class', 'selected');
cy.contains('Map all Data').should('be.visible');
cy.findByRole('textbox', { name: 'Label' })
.contains('if you do then...')
.should('have.value', 'if you do then...');
});
it('changes links label and is reflected on the canvas', () => {
cy.findByRole('textbox', { name: 'Label' })
.contains('if you do then...')
.should('have.value', 'if you do then...')
.click()
.type('Always and forever...');
cy.get('.react-flow')
.contains('if you do then...Always and forever...')
.should('be.visible');
});
it('changes links animated property to true and is shown on the canvas', () => {
cy.findByRole('heading', { name: 'Appearance' }).click({ force: true });
cy.contains('Animated').siblings().click();
cy.get('.react-flow')
.contains('if you do then...')
.parent()
.parent()
.should('include.class', 'animated');
});
it('changes links arrowHead property to arrowclosed and is shown on the canvas', () => {
cy.get('.react-flow')
.contains('if you do then...Always and forever...')
.parent()
.siblings()
.should('have.attr', 'marker-end', 'url(#)');
cy.contains('none').click({ force: true });
cy.contains('arrowclosed').click({ force: true });
cy.get('.react-flow')
.contains('if you do then...Always and forever...')
.parent()
.siblings()
.should('have.attr', 'marker-end', 'url(#1__type=arrowclosed)');
});
describe('Monitor workflows', () => {
before(() => {
cy.visit('http://localhost:3000/monitor');
});
before(() => {
cy.visit('http://localhost:3000/monitor');
});
it('should display no execution event in the history', () => {
cy.findByText('No workflow was run!').should('exist');
cy.findByRole('list').should('not.exist');
});
it('should display no execution event in the history', () => {
cy.findByText('No workflow was run!').should('exist');
cy.findByRole('list').should('not.exist');
});
it('should redirect to monitor page and display "Success" when successfully executing a workflow', () => {
cy.visit('http://localhost:3000/edit');
cy.loadGraph('demo');
it('should redirect to monitor page and display "Success" when successfully executing a workflow', () => {
cy.visit('http://localhost:3000/edit');
cy.loadGraph('demo');
cy.findByRole('button', { name: 'Open menu with more actions' }).click();
cy.findByRole('menuitem', { name: 'Execute workflow' }).click();
cy.findByRole('button', { name: 'Open menu with more actions' }).click();
cy.findByRole('menuitem', { name: 'Execute workflow' }).click();
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/monitor');
});
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/monitor');
});
// Wait until socket messages are sent
cy.wait(1000);
// Wait until socket messages are sent
cy.wait(1000);
cy.findAllByRole('listitem').should('have.length', 1);
cy.findAllByRole('listitem').should('have.length', 1);
cy.findByRole('listitem', { name: 'demo' }).within(() => {
cy.findByText('Success').should('exist');
});
cy.findByRole('listitem', { name: 'demo' }).within(() => {
cy.findByText('Success').should('exist');
});
});
it('should be able to display the status of another workflow (even if it cannot be executed)', () => {
cy.visit('http://localhost:3000/edit');
cy.loadGraph('Ewoks-Tasks');
it('should be able to display the status of another workflow (even if it cannot be executed)', () => {
cy.visit('http://localhost:3000/edit');
cy.loadGraph('Ewoks-Tasks');
cy.findByRole('button', { name: 'Open menu with more actions' }).click();
cy.findByRole('menuitem', { name: 'Execute workflow' }).click();
cy.findByRole('button', { name: 'Open menu with more actions' }).click();
cy.findByRole('menuitem', { name: 'Execute workflow' }).click();
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/monitor');
});
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/monitor');
});
// Wait until socket messages are sent
cy.wait(1000);
// Wait until socket messages are sent
cy.wait(1000);
cy.findAllByRole('listitem').should('have.length', 2);
cy.findAllByRole('listitem').should('have.length', 2);
cy.findByRole('listitem', { name: 'Ewoks-Tasks' }).within(() => {
cy.findByText('Failed').should('exist');
});
cy.findByRole('listitem', { name: 'Ewoks-Tasks' }).within(() => {
cy.findByText('Failed').should('exist');
});
});
......@@ -190,3 +190,112 @@ it('changes the icon', () => {
);
});
});
it('should drag and drop a node from add nodes into canvas', () => {
cy.get('.react-flow__node').should('have.length', 17);
cy.findByRole('button', { name: 'Open task drawer' }).click();
cy.findByRole('button', { name: 'ewokscore' }).click();
cy.dragNodeInCanvas('ewokscore.tests.examples.tasks.sumtask.SumTask');
cy.get('.react-flow__node').should('have.length', 18);
});
it('adds and delete a new default input', () => {
cy.findByRole('heading', { name: 'Default Inputs' }).should('be.visible');
cy.findByRole('heading', { name: 'Default Inputs' })
.parent()
.as('defaultInputsSection');
cy.get('@defaultInputsSection').within(() => {
cy.findAllByRole('row').should('have.length', 2); // Header + Button
cy.findByRole('button', { name: 'Add row' }).click();
cy.findAllByRole('row').should('have.length', 3); // Header + New Row + Button
});
cy.get('[data-cy="inputInEditableCell"]')
.should('exist')
.should('be.visible');
cy.get('[data-cy="inputInEditableCell"]').should('have.length', 2);
cy.get('[data-cy="inputInEditableCell"]').first().type('Always');
cy.get('[data-cy="inputInEditableCell"]').last().type('and forever');
cy.get('@defaultInputsSection').within(() => {
cy.findAllByRole('row').should('have.length', 3);
cy.findByRole('button', { name: 'Remove row' }).click();
cy.findAllByRole('row').should('have.length', 2);
});
});
it('opens the clone Task form when node is selected', () => {
cy.get('.react-flow').contains('ewoksweb').parent().click({ force: true });
cy.waitForStableDOM();
cy.get('[aria-controls="editSidebar-dropdown-menu"]').click();
cy.get('.MuiListItem-button')
.contains('Create Task from Node')
.parent()
.click();
cy.contains('Create task')
.parent()
.should('have.class', 'MuiDialogTitle-root')
.siblings()
.first()
.as('dialogContent')
.should('have.class', 'MuiDialogContent-root');
cy.findByRole('button', { name: 'Cancel' }).click({ force: true });
cy.get('body').click();
});
// TODO: move node - dragstart seems to grasp the inner and creates a ghost
it.skip('should move a node in the canvas', () => {
// const dataTransfer = new DataTransfer();
// cy.get('.react-flow__node-graph').last().trigger('dragstart', {
// dataTransfer,
// });
// cy.get('.react-flow').last().trigger('drop', {
// dataTransfer,
// });
cy.get('.react-flow__node-graph')
.last()
.click()
.trigger('mousedown', { button: 0 })
.wait(100)
.then(($node) => {
const initialPosition = $node.position();
const startX = initialPosition.left;
const startY = initialPosition.top;
cy.get('.react-flow__node-graph')
.last()
.trigger('mousemove', {
clientX: startX - 100,
clientY: startY - 100,
force: true,
})
.wait(100)
.trigger('mouseup', { force: true })
.wait(100);
cy.get('.react-flow__node-graph')
.last()
.then(($movedNode) => {
const newPosition = $movedNode.position();
const movedX = newPosition.left;
const movedY = newPosition.top;
expect(movedX).to.not.equal(startX);
expect(movedY).to.not.equal(startY);
});
cy.get('.react-flow__node').should('have.length', 19);
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment