2022-11-11 00:07:14 -08:00
|
|
|
import { WorkflowsPage as WorkflowsPageClass } from '../pages/workflows';
|
|
|
|
import { WorkflowPage as WorkflowPageClass } from '../pages/workflow';
|
|
|
|
import { v4 as uuid } from 'uuid';
|
|
|
|
|
|
|
|
const WorkflowsPage = new WorkflowsPageClass();
|
|
|
|
const WorkflowPage = new WorkflowPageClass();
|
|
|
|
|
2023-01-30 04:28:59 -08:00
|
|
|
const multipleWorkflowsCount = 5;
|
|
|
|
|
2022-11-22 01:37:26 -08:00
|
|
|
describe('Workflows', () => {
|
2022-11-28 09:11:33 -08:00
|
|
|
beforeEach(() => {
|
2023-03-09 06:26:27 -08:00
|
|
|
cy.visit(WorkflowsPage.url);
|
2022-11-11 00:07:14 -08:00
|
|
|
});
|
|
|
|
|
2023-03-09 06:26:27 -08:00
|
|
|
it('should create a new workflow using empty state card', () => {
|
|
|
|
WorkflowsPage.getters.newWorkflowButtonCard().should('be.visible');
|
|
|
|
WorkflowsPage.getters.newWorkflowButtonCard().click();
|
|
|
|
|
2022-11-11 00:07:14 -08:00
|
|
|
cy.createFixtureWorkflow('Test_workflow_1.json', `Empty State Card Workflow ${uuid()}`);
|
|
|
|
|
2022-11-22 01:37:26 -08:00
|
|
|
WorkflowPage.getters.workflowTags().should('contain.text', 'some-tag-1');
|
|
|
|
WorkflowPage.getters.workflowTags().should('contain.text', 'some-tag-2');
|
2022-12-15 07:39:59 -08:00
|
|
|
});
|
2022-11-11 00:07:14 -08:00
|
|
|
|
2023-01-30 04:28:59 -08:00
|
|
|
it('should create multiple new workflows using add workflow button', () => {
|
|
|
|
[...Array(multipleWorkflowsCount).keys()].forEach(() => {
|
|
|
|
cy.visit(WorkflowsPage.url);
|
|
|
|
WorkflowsPage.getters.createWorkflowButton().click();
|
|
|
|
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_2.json', `My New Workflow ${uuid()}`);
|
2022-11-11 00:07:14 -08:00
|
|
|
|
2023-01-30 04:28:59 -08:00
|
|
|
WorkflowPage.getters.workflowTags().should('contain.text', 'other-tag-1');
|
|
|
|
WorkflowPage.getters.workflowTags().should('contain.text', 'other-tag-2');
|
|
|
|
});
|
2022-12-15 07:39:59 -08:00
|
|
|
});
|
2022-11-11 00:07:14 -08:00
|
|
|
|
|
|
|
it('should search for a workflow', () => {
|
2023-01-30 04:28:59 -08:00
|
|
|
// One Result
|
2022-11-22 01:37:26 -08:00
|
|
|
WorkflowsPage.getters.searchBar().type('Empty State Card Workflow');
|
|
|
|
WorkflowsPage.getters.workflowCards().should('have.length', 1);
|
2022-12-15 07:39:59 -08:00
|
|
|
WorkflowsPage.getters
|
|
|
|
.workflowCard('Empty State Card Workflow')
|
|
|
|
.should('contain.text', 'Empty State Card Workflow');
|
2022-11-11 00:07:14 -08:00
|
|
|
|
2023-01-30 04:28:59 -08:00
|
|
|
// Multiple Results
|
|
|
|
WorkflowsPage.getters.searchBar().clear().type('My New Workflow');
|
|
|
|
WorkflowsPage.getters.workflowCards().should('have.length', multipleWorkflowsCount);
|
|
|
|
WorkflowsPage.getters.workflowCard('My New Workflow').should('contain.text', 'My New Workflow');
|
2022-11-11 00:07:14 -08:00
|
|
|
|
2023-01-30 04:28:59 -08:00
|
|
|
// All Results
|
|
|
|
WorkflowsPage.getters.searchBar().clear().type('Workflow');
|
|
|
|
WorkflowsPage.getters.workflowCards().should('have.length', multipleWorkflowsCount + 1);
|
|
|
|
WorkflowsPage.getters.workflowCard('Workflow').should('contain.text', 'Workflow');
|
2022-11-22 01:37:26 -08:00
|
|
|
|
2023-01-30 04:28:59 -08:00
|
|
|
// No Results
|
2022-11-22 01:37:26 -08:00
|
|
|
WorkflowsPage.getters.searchBar().clear().type('Some non-existent workflow');
|
|
|
|
WorkflowsPage.getters.workflowCards().should('not.exist');
|
2022-11-11 00:07:14 -08:00
|
|
|
|
|
|
|
cy.contains('No workflows found').should('be.visible');
|
2022-12-15 07:39:59 -08:00
|
|
|
});
|
2022-11-11 00:07:14 -08:00
|
|
|
|
|
|
|
it('should delete all the workflows', () => {
|
2023-01-30 04:28:59 -08:00
|
|
|
WorkflowsPage.getters.workflowCards().should('have.length', multipleWorkflowsCount + 1);
|
2022-11-11 00:07:14 -08:00
|
|
|
|
2022-11-22 01:37:26 -08:00
|
|
|
WorkflowsPage.getters.workflowCards().each(($el) => {
|
2022-11-11 00:07:14 -08:00
|
|
|
const workflowName = $el.find('[data-test-id="workflow-card-name"]').text();
|
|
|
|
|
2022-11-22 01:37:26 -08:00
|
|
|
WorkflowsPage.getters.workflowCardActions(workflowName).click();
|
|
|
|
WorkflowsPage.getters.workflowDeleteButton().click();
|
|
|
|
|
2022-11-11 00:07:14 -08:00
|
|
|
cy.get('button').contains('delete').click();
|
2022-12-15 07:39:59 -08:00
|
|
|
});
|
2022-11-11 00:07:14 -08:00
|
|
|
|
2022-11-22 01:37:26 -08:00
|
|
|
WorkflowsPage.getters.newWorkflowButtonCard().should('be.visible');
|
2022-11-11 00:07:14 -08:00
|
|
|
});
|
|
|
|
});
|