mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
59c5ff6135
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Waiting to run
101 lines
3.6 KiB
TypeScript
101 lines
3.6 KiB
TypeScript
import { WorkflowPage as WorkflowPageClass } from '../pages/workflow';
|
|
import { WorkflowsPage as WorkflowsPageClass } from '../pages/workflows';
|
|
import { getUniqueWorkflowName } from '../utils/workflowUtils';
|
|
|
|
const WorkflowsPage = new WorkflowsPageClass();
|
|
const WorkflowPage = new WorkflowPageClass();
|
|
|
|
const multipleWorkflowsCount = 5;
|
|
|
|
describe('Workflows', () => {
|
|
beforeEach(() => {
|
|
cy.visit(WorkflowsPage.url);
|
|
});
|
|
|
|
it('should create a new workflow using empty state card', () => {
|
|
WorkflowsPage.getters.newWorkflowButtonCard().should('be.visible');
|
|
WorkflowsPage.getters.newWorkflowButtonCard().click();
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_1.json', 'Empty State Card Workflow');
|
|
|
|
WorkflowPage.getters.workflowTags().should('contain.text', 'some-tag-1');
|
|
WorkflowPage.getters.workflowTags().should('contain.text', 'some-tag-2');
|
|
});
|
|
|
|
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', getUniqueWorkflowName('My New Workflow'));
|
|
|
|
WorkflowPage.getters.workflowTags().should('contain.text', 'other-tag-1');
|
|
WorkflowPage.getters.workflowTags().should('contain.text', 'other-tag-2');
|
|
});
|
|
});
|
|
|
|
it('should search for a workflow', () => {
|
|
// One Result
|
|
WorkflowsPage.getters.searchBar().type('Empty State Card Workflow');
|
|
WorkflowsPage.getters.workflowCards().should('have.length', 1);
|
|
WorkflowsPage.getters
|
|
.workflowCard('Empty State Card Workflow')
|
|
.should('contain.text', 'Empty State Card Workflow');
|
|
|
|
// 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');
|
|
|
|
// All Results
|
|
WorkflowsPage.getters.searchBar().clear().type('Workflow');
|
|
WorkflowsPage.getters.workflowCards().should('have.length', multipleWorkflowsCount + 1);
|
|
WorkflowsPage.getters.workflowCard('Workflow').should('contain.text', 'Workflow');
|
|
|
|
// No Results
|
|
WorkflowsPage.getters.searchBar().clear().type('Some non-existent workflow');
|
|
WorkflowsPage.getters.workflowCards().should('not.exist');
|
|
|
|
cy.contains('No workflows found').should('be.visible');
|
|
});
|
|
|
|
it('should delete all the workflows', () => {
|
|
WorkflowsPage.getters.workflowCards().should('have.length', multipleWorkflowsCount + 1);
|
|
|
|
WorkflowsPage.getters.workflowCards().each(($el) => {
|
|
const workflowName = $el.find('[data-test-id="workflow-card-name"]').text();
|
|
|
|
WorkflowsPage.getters.workflowCardActions(workflowName).click();
|
|
WorkflowsPage.getters.workflowDeleteButton().click();
|
|
|
|
cy.get('button').contains('delete').click();
|
|
});
|
|
|
|
WorkflowsPage.getters.newWorkflowButtonCard().should('be.visible');
|
|
});
|
|
|
|
it('should respect tag querystring filter when listing workflows', () => {
|
|
WorkflowsPage.getters.newWorkflowButtonCard().click();
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_2.json', getUniqueWorkflowName('My New Workflow'));
|
|
|
|
cy.visit(WorkflowsPage.url);
|
|
|
|
WorkflowsPage.getters.createWorkflowButton().click();
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_1.json', 'Empty State Card Workflow');
|
|
|
|
cy.visit(WorkflowsPage.url);
|
|
|
|
WorkflowsPage.getters.workflowFilterButton().click();
|
|
|
|
WorkflowsPage.getters.workflowTagsDropdown().click();
|
|
|
|
WorkflowsPage.getters.workflowTagItem('some-tag-1').click();
|
|
|
|
cy.reload();
|
|
|
|
WorkflowsPage.getters.workflowCards().should('have.length', 1);
|
|
});
|
|
});
|