test: Add e2e workflow tags (no-changelog) (#5411)
* 🧪 Add workflow tags tests * ⚡ Create `openTagManagerModal` * ⚡ Add wait to prevent detached DOM element * ⚡ Add wait to mirror other tests
This commit is contained in:
96
cypress/e2e/17-workflow-tags.cy.ts
Normal file
96
cypress/e2e/17-workflow-tags.cy.ts
Normal file
@@ -0,0 +1,96 @@
|
||||
import { WorkflowPage } from '../pages';
|
||||
|
||||
const wf = new WorkflowPage();
|
||||
|
||||
const TEST_TAGS = ['Tag 1', 'Tag 2', 'Tag 3'];
|
||||
|
||||
describe('Workflow tags', () => {
|
||||
beforeEach(() => {
|
||||
cy.resetAll();
|
||||
cy.skipSetup();
|
||||
wf.actions.visit();
|
||||
cy.waitForLoad();
|
||||
});
|
||||
|
||||
it('should create and attach tags inline', () => {
|
||||
wf.getters.createTagButton().click();
|
||||
wf.actions.addTags(TEST_TAGS);
|
||||
wf.getters.tagPills().should('have.length', TEST_TAGS.length);
|
||||
wf.getters.nthTagPill(1).click();
|
||||
wf.actions.addTags('Tag 4');
|
||||
wf.getters.tagPills().should('have.length', TEST_TAGS.length + 1);
|
||||
wf.getters.isWorkflowSaved();
|
||||
});
|
||||
|
||||
it('should create tags via modal', () => {
|
||||
wf.actions.openTagManagerModal();
|
||||
|
||||
const [first, second] = TEST_TAGS;
|
||||
|
||||
cy.contains('Create a tag').click();
|
||||
cy.getByTestId('tags-table').find('input').type(first).type('{enter}');
|
||||
cy.contains('Add new').click();
|
||||
cy.wait(300);
|
||||
cy.getByTestId('tags-table').find('input').type(second).type('{enter}');
|
||||
cy.contains('Done').click();
|
||||
|
||||
wf.getters.createTagButton().click();
|
||||
wf.getters.tagsInDropdown().should('have.length', 2); // two stored
|
||||
wf.getters.tagPills().should('have.length', 0); // none attached
|
||||
});
|
||||
|
||||
it('should delete a tag via modal', () => {
|
||||
wf.actions.openTagManagerModal();
|
||||
|
||||
const [first] = TEST_TAGS;
|
||||
|
||||
cy.contains('Create a tag').click();
|
||||
cy.getByTestId('tags-table').find('input').type(first).type('{enter}');
|
||||
cy.getByTestId('delete-tag-button').click({ force: true });
|
||||
cy.wait(300);
|
||||
cy.contains('Delete tag').click();
|
||||
cy.contains('Done').click();
|
||||
wf.getters.createTagButton().click();
|
||||
wf.getters.tagsInDropdown().should('have.length', 0); // none stored
|
||||
wf.getters.tagPills().should('have.length', 0); // none attached
|
||||
});
|
||||
|
||||
it('should update a tag via modal', () => {
|
||||
wf.actions.openTagManagerModal();
|
||||
|
||||
const [first] = TEST_TAGS;
|
||||
|
||||
cy.contains('Create a tag').click();
|
||||
cy.getByTestId('tags-table').find('input').type(first).type('{enter}');
|
||||
cy.getByTestId('edit-tag-button').click({ force: true });
|
||||
cy.wait(300);
|
||||
cy.getByTestId('tags-table')
|
||||
.find('.el-input--large')
|
||||
.should('be.visible')
|
||||
.type(' Updated')
|
||||
.type('{enter}');
|
||||
cy.contains('Done').click();
|
||||
wf.getters.createTagButton().click();
|
||||
wf.getters.tagsInDropdown().should('have.length', 1); // one stored
|
||||
wf.getters.tagsInDropdown().contains('Updated').should('exist');
|
||||
wf.getters.tagPills().should('have.length', 0); // none attached
|
||||
});
|
||||
|
||||
it('should detach a tag inline by clicking on X on tag pill', () => {
|
||||
wf.getters.createTagButton().click();
|
||||
wf.actions.addTags(TEST_TAGS);
|
||||
wf.getters.nthTagPill(1).click();
|
||||
wf.getters.tagsDropdown().find('.el-tag__close').first().click();
|
||||
cy.get('body').type('{enter}');
|
||||
wf.getters.tagPills().should('have.length', TEST_TAGS.length - 1);
|
||||
});
|
||||
|
||||
it('should detach a tag inline by clicking on dropdown list item', () => {
|
||||
wf.getters.createTagButton().click();
|
||||
wf.actions.addTags(TEST_TAGS);
|
||||
wf.getters.nthTagPill(1).click();
|
||||
wf.getters.tagsDropdown().find('li.selected').first().click();
|
||||
cy.get('body').type('{enter}');
|
||||
wf.getters.tagPills().should('have.length', TEST_TAGS.length - 1);
|
||||
});
|
||||
});
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
import { WorkflowPage as WorkflowPageClass } from '../pages/workflow';
|
||||
|
||||
const NEW_WORKFLOW_NAME = 'Something else';
|
||||
const TEST_WF_TAGS = ['Tag 1', 'Tag 2', 'Tag 3'];
|
||||
const IMPORT_WORKFLOW_URL = 'https://www.jsonkeeper.com/b/FNB0#.json';
|
||||
const DUPLICATE_WORKFLOW_NAME = 'Duplicated workflow';
|
||||
const DUPLICATE_WORKFLOW_TAG = 'Duplicate';
|
||||
@@ -66,40 +65,6 @@ describe('Workflow Actions', () => {
|
||||
.should('eq', NEW_WORKFLOW_NAME);
|
||||
});
|
||||
|
||||
it('should add tags', () => {
|
||||
WorkflowPage.getters.newTagLink().click();
|
||||
WorkflowPage.actions.addTags(TEST_WF_TAGS);
|
||||
WorkflowPage.getters.isWorkflowSaved();
|
||||
WorkflowPage.getters.workflowTagElements().should('have.length', TEST_WF_TAGS.length);
|
||||
});
|
||||
|
||||
it('should add more tags', () => {
|
||||
WorkflowPage.getters.newTagLink().click();
|
||||
WorkflowPage.actions.addTags(TEST_WF_TAGS);
|
||||
WorkflowPage.getters.isWorkflowSaved();
|
||||
WorkflowPage.getters.firstWorkflowTagElement().click();
|
||||
WorkflowPage.actions.addTags(['Another one']);
|
||||
WorkflowPage.getters.workflowTagElements().should('have.length', TEST_WF_TAGS.length + 1);
|
||||
});
|
||||
|
||||
it('should remove tags by clicking X in tag', () => {
|
||||
WorkflowPage.getters.newTagLink().click();
|
||||
WorkflowPage.actions.addTags(TEST_WF_TAGS);
|
||||
WorkflowPage.getters.firstWorkflowTagElement().click();
|
||||
WorkflowPage.getters.workflowTagsContainer().find('.el-tag__close').first().click();
|
||||
cy.get('body').type('{enter}');
|
||||
WorkflowPage.getters.workflowTagElements().should('have.length', TEST_WF_TAGS.length - 1);
|
||||
});
|
||||
|
||||
it('should remove tags from dropdown', () => {
|
||||
WorkflowPage.getters.newTagLink().click();
|
||||
WorkflowPage.actions.addTags(TEST_WF_TAGS);
|
||||
WorkflowPage.getters.firstWorkflowTagElement().click();
|
||||
WorkflowPage.getters.workflowTagsDropdown().find('li.selected').first().click();
|
||||
cy.get('body').type('{enter}');
|
||||
WorkflowPage.getters.workflowTagElements().should('have.length', TEST_WF_TAGS.length - 1);
|
||||
});
|
||||
|
||||
it('should copy nodes', () => {
|
||||
WorkflowPage.actions.addNodeToCanvas(SCHEDULE_TRIGGER_NODE_NAME);
|
||||
WorkflowPage.actions.addNodeToCanvas(CODE_NODE_NAME);
|
||||
|
||||
Reference in New Issue
Block a user