2024-04-04 02:15:37 -07:00
|
|
|
import { WorkflowPage } from '../pages';
|
|
|
|
import { MessageBox as MessageBoxClass } from '../pages/modals/message-box';
|
2024-06-11 01:23:30 -07:00
|
|
|
import { errorToast, successToast } from '../pages/notifications';
|
2024-04-04 02:15:37 -07:00
|
|
|
|
|
|
|
const workflowPage = new WorkflowPage();
|
|
|
|
const messageBox = new MessageBoxClass();
|
|
|
|
|
|
|
|
before(() => {
|
|
|
|
cy.fixture('Onboarding_workflow.json').then((data) => {
|
|
|
|
cy.intercept('GET', '/rest/workflows/from-url*', {
|
|
|
|
body: { data },
|
|
|
|
}).as('downloadWorkflowFromURL');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Import workflow', () => {
|
|
|
|
describe('From URL', () => {
|
|
|
|
it('should import workflow', () => {
|
|
|
|
workflowPage.actions.visit(true);
|
|
|
|
workflowPage.getters.workflowMenu().click();
|
|
|
|
workflowPage.getters.workflowMenuItemImportFromURLItem().click();
|
|
|
|
|
|
|
|
messageBox.getters.modal().should('be.visible');
|
|
|
|
|
|
|
|
messageBox.getters.content().type('https://fakepage.com/workflow.json');
|
|
|
|
|
|
|
|
messageBox.getters.confirm().click();
|
|
|
|
|
|
|
|
workflowPage.actions.zoomToFit();
|
|
|
|
|
|
|
|
workflowPage.getters.canvasNodes().should('have.length', 4);
|
|
|
|
|
2024-06-11 01:23:30 -07:00
|
|
|
errorToast().should('not.exist');
|
2024-04-04 02:15:37 -07:00
|
|
|
|
2024-06-11 01:23:30 -07:00
|
|
|
successToast().should('not.exist');
|
2024-04-04 02:15:37 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
it('clicking outside modal should not show error toast', () => {
|
|
|
|
workflowPage.actions.visit(true);
|
|
|
|
|
|
|
|
workflowPage.getters.workflowMenu().click();
|
|
|
|
workflowPage.getters.workflowMenuItemImportFromURLItem().click();
|
|
|
|
|
|
|
|
cy.get('body').click(0, 0);
|
|
|
|
|
2024-06-11 01:23:30 -07:00
|
|
|
errorToast().should('not.exist');
|
2024-04-04 02:15:37 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
it('canceling modal should not show error toast', () => {
|
|
|
|
workflowPage.actions.visit(true);
|
|
|
|
|
|
|
|
workflowPage.getters.workflowMenu().click();
|
|
|
|
workflowPage.getters.workflowMenuItemImportFromURLItem().click();
|
|
|
|
messageBox.getters.cancel().click();
|
|
|
|
|
2024-06-11 01:23:30 -07:00
|
|
|
errorToast().should('not.exist');
|
2024-04-04 02:15:37 -07:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('From File', () => {
|
|
|
|
it('should import workflow', () => {
|
|
|
|
workflowPage.actions.visit(true);
|
|
|
|
|
|
|
|
workflowPage.getters.workflowMenu().click();
|
|
|
|
workflowPage.getters.workflowMenuItemImportFromFile().click();
|
|
|
|
workflowPage.getters
|
|
|
|
.workflowImportInput()
|
2024-06-10 06:49:50 -07:00
|
|
|
.selectFile('fixtures/Test_workflow-actions_paste-data.json', { force: true });
|
2024-04-04 02:15:37 -07:00
|
|
|
cy.waitForLoad(false);
|
|
|
|
workflowPage.actions.zoomToFit();
|
|
|
|
workflowPage.getters.canvasNodes().should('have.length', 5);
|
|
|
|
workflowPage.getters.nodeConnections().should('have.length', 5);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|