fix: fix sticky component and inline text edit

This commit is contained in:
Alex Grozav 2023-07-26 10:02:12 +03:00
parent 5dec9d32b6
commit dcc013e7a5
15 changed files with 210 additions and 197 deletions

View file

@ -81,7 +81,7 @@ describe('Workflow tags', () => {
wf.getters.tagPills().should('have.length', TEST_TAGS.length - 1);
});
it.only('should detach a tag inline by clicking on dropdown list item', () => {
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();

View file

@ -58,19 +58,19 @@ describe('User Management', { disableAutoLogin: true }, () => {
it('should delete user and their data', () => {
usersSettingsPage.actions.loginAndVisit(INSTANCE_OWNER.email, INSTANCE_OWNER.password, true);
usersSettingsPage.actions.opedDeleteDialog(INSTANCE_MEMBERS[0].email);
usersSettingsPage.getters.deleteDataRadioButton().realClick();
usersSettingsPage.getters.deleteDataRadioButton().click();
usersSettingsPage.getters.deleteDataInput().type('delete all data');
usersSettingsPage.getters.deleteUserButton().realClick();
usersSettingsPage.getters.deleteUserButton().click();
workflowPage.getters.successToast().should('contain', 'User deleted');
});
it('should delete user and transfer their data', () => {
usersSettingsPage.actions.loginAndVisit(INSTANCE_OWNER.email, INSTANCE_OWNER.password, true);
usersSettingsPage.actions.opedDeleteDialog(INSTANCE_MEMBERS[1].email);
usersSettingsPage.getters.transferDataRadioButton().realClick();
usersSettingsPage.getters.userSelectDropDown().realClick();
usersSettingsPage.getters.userSelectOptions().first().realClick();
usersSettingsPage.getters.deleteUserButton().realClick();
usersSettingsPage.getters.transferDataRadioButton().click();
usersSettingsPage.getters.userSelectDropDown().click();
usersSettingsPage.getters.userSelectOptions().first().click();
usersSettingsPage.getters.deleteUserButton().click();
workflowPage.getters.successToast().should('contain', 'User deleted');
});

View file

@ -4,6 +4,7 @@ import { CredentialsModal, WorkflowPage } from '../pages';
import CustomNodeWithN8nCredentialFixture from '../fixtures/Custom_node_n8n_credential.json';
import CustomNodeWithCustomCredentialFixture from '../fixtures/Custom_node_custom_credential.json';
import CustomCredential from '../fixtures/Custom_credential.json';
import { getVisibleSelect } from '../utils';
const credentialsModal = new CredentialsModal();
const nodeCreatorFeature = new NodeCreator();
@ -20,9 +21,13 @@ describe('Community Nodes', () => {
req.on('response', (res) => {
const nodes = res.body || [];
nodes.push(CustomNodeFixture, CustomNodeWithN8nCredentialFixture, CustomNodeWithCustomCredentialFixture);
nodes.push(
CustomNodeFixture,
CustomNodeWithN8nCredentialFixture,
CustomNodeWithCustomCredentialFixture,
);
});
})
});
cy.intercept('/types/credentials.json', { middleware: true }, (req) => {
req.headers['cache-control'] = 'no-cache, no-store';
@ -31,8 +36,8 @@ describe('Community Nodes', () => {
const credentials = res.body || [];
credentials.push(CustomCredential);
})
})
});
});
workflowPage.actions.visit();
});
@ -45,7 +50,7 @@ describe('Community Nodes', () => {
nodeCreatorFeature.getters
.getCreatorItem(customNode)
.findChildByTestId('node-creator-item-tooltip')
.find('.el-tooltip__trigger')
.should('exist');
nodeCreatorFeature.actions.selectNode(customNode);
@ -65,16 +70,9 @@ describe('Community Nodes', () => {
secondParameter().find('label').contains('Resource').should('exist');
secondParameter().find('input.el-input__inner').should('have.value', 'option2');
secondParameter().find('.el-select').click();
secondParameter().find('.el-select-dropdown__list').should('exist');
// Check if all options are rendered and select the fourth one
secondParameter().find('.el-select-dropdown__list').children().should('have.length', 4);
secondParameter()
.find('.el-select-dropdown__list')
.children()
.eq(3)
.contains('option4')
.should('exist')
.click();
getVisibleSelect().find('li').should('have.length', 4);
getVisibleSelect().find('li').eq(3).contains('option4').should('exist').click();
secondParameter().find('input.el-input__inner').should('have.value', 'option4');
});

View file

@ -28,59 +28,36 @@ describe('NDV', () => {
ndv.actions.switchOutputMode('Table');
// input to output
ndv.getters.inputTableRow(1)
ndv.getters
.inputTableRow(1)
.should('exist')
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(1)
.realHover();
ndv.getters.outputTableRow(4)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).realHover();
ndv.getters.outputTableRow(4).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.inputTableRow(2)
.realHover();
ndv.getters.outputTableRow(2)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(3)
.realHover();
ndv.getters.outputTableRow(6)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(2).realHover();
ndv.getters.outputTableRow(2).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.inputTableRow(3).realHover();
ndv.getters.outputTableRow(6).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
// output to input
ndv.getters.outputTableRow(1)
.realHover();
ndv.getters.inputTableRow(4)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.outputTableRow(1).realHover();
ndv.getters.inputTableRow(4).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.outputTableRow(4)
.realHover();
ndv.getters.inputTableRow(1)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.outputTableRow(4).realHover();
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.outputTableRow(2)
.realHover();
ndv.getters.inputTableRow(2)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.outputTableRow(6)
.realHover();
ndv.getters.inputTableRow(3)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.outputTableRow(2).realHover();
ndv.getters.inputTableRow(2).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.outputTableRow(1)
.realHover();
ndv.getters.inputTableRow(4)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.outputTableRow(6).realHover();
ndv.getters.inputTableRow(3).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.outputTableRow(1).realHover();
ndv.getters.inputTableRow(4).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
});
it('maps paired input and output items based on selected input node', () => {
@ -92,9 +69,11 @@ describe('NDV', () => {
workflowPage.actions.openNode('Set2');
ndv.getters.inputPanel().contains('6 items').should('exist');
ndv.getters.outputRunSelector()
ndv.getters
.outputRunSelector()
.find('input')
.should('exist')
.should('include.text', '2 of 2 (6 items)');
.should('have.value', '2 of 2 (6 items)');
ndv.actions.switchInputMode('Table');
ndv.actions.switchOutputMode('Table');
@ -106,7 +85,8 @@ describe('NDV', () => {
ndv.actions.selectInputNode('Set1');
ndv.getters.backToCanvas().realHover(); // reset to default hover
ndv.getters.inputTableRow(1)
ndv.getters
.inputTableRow(1)
.should('have.text', '1000')
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
@ -119,7 +99,8 @@ describe('NDV', () => {
ndv.actions.changeOutputRunSelector('1 of 2 (6 items)');
ndv.getters.backToCanvas().realHover(); // reset to default hover
ndv.getters.inputTableRow(1)
ndv.getters
.inputTableRow(1)
.should('have.text', '1111')
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
@ -137,11 +118,13 @@ describe('NDV', () => {
workflowPage.actions.executeWorkflow();
workflowPage.actions.openNode('Set3');
ndv.getters.inputRunSelector()
ndv.getters
.inputRunSelector()
.should('exist')
.find('input')
.should('include.value', '2 of 2 (6 items)');
ndv.getters.outputRunSelector()
ndv.getters
.outputRunSelector()
.should('exist')
.find('input')
.should('include.value', '2 of 2 (6 items)');
@ -150,23 +133,19 @@ describe('NDV', () => {
ndv.actions.switchOutputMode('Table');
ndv.actions.changeOutputRunSelector('1 of 2 (6 items)');
ndv.getters.inputRunSelector().find('input')
.should('include.value', '1 of 2 (6 items)');
ndv.getters.outputRunSelector().find('input')
.should('include.value', '1 of 2 (6 items)');
ndv.getters.inputRunSelector().find('input').should('include.value', '1 of 2 (6 items)');
ndv.getters.outputRunSelector().find('input').should('include.value', '1 of 2 (6 items)');
ndv.getters.inputTableRow(1)
ndv.getters
.inputTableRow(1)
.should('have.text', '1111')
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.outputTableRow(1)
.should('have.text', '1111')
.realHover();
ndv.getters.outputTableRow(1).should('have.text', '1111').realHover();
ndv.getters.outputTableRow(3)
.should('have.text', '4444')
.realHover();
ndv.getters.inputTableRow(3)
ndv.getters.outputTableRow(3).should('have.text', '4444').realHover();
ndv.getters
.inputTableRow(3)
.should('have.text', '4444')
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
@ -174,18 +153,16 @@ describe('NDV', () => {
ndv.actions.changeOutputRunSelector('2 of 2 (6 items)');
cy.wait(50);
ndv.getters.inputTableRow(1)
.should('have.text', '1000')
.realHover();
ndv.getters.outputTableRow(1)
ndv.getters.inputTableRow(1).should('have.text', '1000').realHover();
ndv.getters
.outputTableRow(1)
.should('have.text', '1000')
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.outputTableRow(3)
.should('have.text', '2000')
.realHover();
ndv.getters.inputTableRow(3)
ndv.getters.outputTableRow(3).should('have.text', '2000').realHover();
ndv.getters
.inputTableRow(3)
.should('have.text', '2000')
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
@ -200,15 +177,18 @@ describe('NDV', () => {
workflowPage.actions.openNode('Set2');
ndv.getters.inputPanel().contains('6 items').should('exist');
ndv.getters.outputRunSelector()
ndv.getters
.outputRunSelector()
.find('input')
.should('exist')
.should('include.text', '2 of 2 (6 items)');
.should('have.value', '2 of 2 (6 items)');
ndv.actions.switchInputMode('Table');
ndv.actions.switchOutputMode('Table');
ndv.getters.backToCanvas().realHover(); // reset to default hover
ndv.getters.inputTableRow(1)
ndv.getters
.inputTableRow(1)
.should('have.text', '1111')
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
@ -218,28 +198,32 @@ describe('NDV', () => {
ndv.actions.selectInputNode('Code1');
ndv.getters.inputTableRow(1).realHover();
ndv.getters.inputTableRow(1)
ndv.getters
.inputTableRow(1)
.should('have.text', '1000')
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.outputTableRow(1)
.should('have.text', '1000');
ndv.getters.outputTableRow(1).should('have.text', '1000');
ndv.getters.parameterExpressionPreview('value').should('include.text', '1000');
ndv.actions.selectInputNode('Code');
ndv.getters.inputTableRow(1).realHover();
ndv.getters.inputTableRow(1)
.should('have.text', '6666')
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters
.inputTableRow(1)
.should('have.text', '6666')
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.outputHoveringItem().should('not.exist');
ndv.getters.parameterExpressionPreview('value').should('include.text', '1000');
ndv.actions.selectInputNode('When clicking');
ndv.getters.inputTableRow(1).realHover();
ndv.getters.inputTableRow(1).should('have.text', "This is an item, but it's empty.").realHover();
ndv.getters
.inputTableRow(1)
.should('have.text', "This is an item, but it's empty.")
.realHover();
ndv.getters.outputHoveringItem().should('have.length', 6);
ndv.getters.parameterExpressionPreview('value').should('include.text', '1000');
});
@ -256,18 +240,16 @@ describe('NDV', () => {
ndv.actions.switchOutputMode('Table');
ndv.actions.switchOutputBranch('False Branch (2 items)');
ndv.getters.outputTableRow(1)
.should('have.text', '8888')
.realHover();
ndv.getters.inputTableRow(5)
ndv.getters.outputTableRow(1).should('have.text', '8888').realHover();
ndv.getters
.inputTableRow(5)
.should('have.text', '8888')
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.outputTableRow(2)
.should('have.text', '9999')
.realHover();
ndv.getters.inputTableRow(6)
ndv.getters.outputTableRow(2).should('have.text', '9999').realHover();
ndv.getters
.inputTableRow(6)
.should('have.text', '9999')
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
@ -277,31 +259,21 @@ describe('NDV', () => {
workflowPage.actions.openNode('Set5');
ndv.actions.switchInputBranch('True Branch');
ndv.actions.changeOutputRunSelector('1 of 2 (2 items)')
ndv.getters.outputTableRow(1)
.should('have.text', '8888')
.realHover();
ndv.actions.changeOutputRunSelector('1 of 2 (2 items)');
ndv.getters.outputTableRow(1).should('have.text', '8888').realHover();
ndv.getters.inputHoveringItem().should('not.exist');
ndv.getters.inputTableRow(1)
.should('have.text', '1111')
.realHover();
ndv.getters.inputTableRow(1).should('have.text', '1111').realHover();
ndv.getters.outputHoveringItem().should('not.exist');
ndv.actions.switchInputBranch('False Branch');
ndv.getters.inputTableRow(1)
.should('have.text', '8888')
.realHover();
ndv.getters.inputTableRow(1).should('have.text', '8888').realHover();
ndv.actions.changeOutputRunSelector('2 of 2 (4 items)')
ndv.getters.outputTableRow(1)
.should('have.text', '1111')
.realHover();
ndv.actions.changeOutputRunSelector('2 of 2 (4 items)');
ndv.getters.outputTableRow(1).should('have.text', '1111').realHover();
ndv.actions.changeOutputRunSelector('1 of 2 (2 items)')
ndv.getters.inputTableRow(1)
.should('have.text', '8888')
.realHover();
ndv.actions.changeOutputRunSelector('1 of 2 (2 items)');
ndv.getters.inputTableRow(1).should('have.text', '8888').realHover();
ndv.getters.outputHoveringItem().should('have.text', '8888');
// todo there's a bug here need to fix ADO-534
// ndv.getters.outputHoveringItem().should('not.exist');

View file

@ -2,7 +2,13 @@ import { WorkflowPage as WorkflowPageClass } from '../pages/workflow';
const workflowPage = new WorkflowPageClass();
function checkStickiesStyle( top: number, left: number, height: number, width: number, zIndex?: number) {
function checkStickiesStyle(
top: number,
left: number,
height: number,
width: number,
zIndex?: number,
) {
workflowPage.getters.stickies().should(($el) => {
expect($el).to.have.css('top', `${top}px`);
expect($el).to.have.css('left', `${left}px`);
@ -18,22 +24,23 @@ describe('Canvas Actions', () => {
beforeEach(() => {
workflowPage.actions.visit();
cy.window().then(
(win) => {
// @ts-ignore
win.preventNodeViewBeforeUnload = true;
},
);
cy.window().then((win) => {
// @ts-ignore
win.preventNodeViewBeforeUnload = true;
});
});
it('adds sticky to canvas with default text and position', () => {
workflowPage.getters.addStickyButton().should('not.be.visible');
addDefaultSticky()
workflowPage.getters.stickies().eq(0)
addDefaultSticky();
workflowPage.getters
.stickies()
.eq(0)
.should('have.text', 'Im a note\nDouble click to edit me. Guide\n')
.find('a').contains('Guide').should('have.attr', 'href');
.find('a')
.contains('Guide')
.should('have.attr', 'href');
});
it('drags sticky around to top left corner', () => {
@ -57,18 +64,19 @@ describe('Canvas Actions', () => {
it('deletes sticky', () => {
workflowPage.actions.addSticky();
workflowPage.getters.stickies().should('have.length', 1)
workflowPage.getters.stickies().should('have.length', 1);
workflowPage.actions.deleteSticky();
workflowPage.getters.stickies().should('have.length', 0)
workflowPage.getters.stickies().should('have.length', 0);
});
it('edits sticky and updates content as markdown', () => {
workflowPage.actions.addSticky();
workflowPage.getters.stickies()
.should('have.text', 'Im a note\nDouble click to edit me. Guide\n')
workflowPage.getters
.stickies()
.should('have.text', 'Im a note\nDouble click to edit me. Guide\n');
workflowPage.getters.stickies().dblclick();
workflowPage.actions.editSticky('# hello world \n ## text text');
@ -159,32 +167,41 @@ describe('Canvas Actions', () => {
cy.drag('[data-test-id="sticky"] [data-dir="topLeft"]', [-150, -150]);
checkStickiesStyle(124, 256, 316, 384, -121);
workflowPage.getters.canvasNodes().eq(0)
workflowPage.getters
.canvasNodes()
.eq(0)
.should(($el) => {
expect($el).to.have.css('z-index', 'auto');
});
workflowPage.actions.addSticky();
workflowPage.getters.stickies().eq(0)
workflowPage.getters
.stickies()
.eq(0)
.should(($el) => {
expect($el).to.have.css('z-index', '-121');
});
workflowPage.getters.stickies().eq(1)
workflowPage.getters
.stickies()
.eq(1)
.should(($el) => {
expect($el).to.have.css('z-index', '-38');
});
cy.drag('[data-test-id="sticky"] [data-dir="topLeft"]', [-200, -200], { index: 1 });
workflowPage.getters.stickies().eq(0)
workflowPage.getters
.stickies()
.eq(0)
.should(($el) => {
expect($el).to.have.css('z-index', '-121');
});
workflowPage.getters.stickies().eq(1)
workflowPage.getters
.stickies()
.eq(1)
.should(($el) => {
expect($el).to.have.css('z-index', '-158');
});
});
});
@ -198,15 +215,20 @@ type BoundingBox = {
width: number;
top: number;
left: number;
}
};
function dragRightEdge(curr: BoundingBox, move: number) {
workflowPage.getters.stickies().first().then(($el) => {
const { left, top, height, width } = curr;
cy.drag(`[data-test-id="sticky"] [data-dir="right"]`, [left + width + move, 0], { abs: true });
stickyShouldBePositionedCorrectly({ top, left });
stickyShouldHaveCorrectSize([height, width * 1.5 + move]);
});
workflowPage.getters
.stickies()
.first()
.then(($el) => {
const { left, top, height, width } = curr;
cy.drag(`[data-test-id="sticky"] [data-dir="right"]`, [left + width + move, 0], {
abs: true,
});
stickyShouldBePositionedCorrectly({ top, left });
stickyShouldHaveCorrectSize([height, width * 1.5 + move]);
});
}
function shouldHaveOneSticky() {
@ -214,17 +236,20 @@ function shouldHaveOneSticky() {
}
function shouldBeInDefaultLocation() {
workflowPage.getters.stickies().eq(0).should(($el) => {
expect($el).to.have.css('height', '160px');
expect($el).to.have.css('width', '240px');
})
workflowPage.getters
.stickies()
.eq(0)
.should(($el) => {
expect($el).to.have.css('height', '160px');
expect($el).to.have.css('width', '240px');
});
}
function shouldHaveDefaultSize() {
workflowPage.getters.stickies().should(($el) => {
expect($el).to.have.css('height', '160px');
expect($el).to.have.css('width', '240px');
})
});
}
function addDefaultSticky() {
@ -237,21 +262,19 @@ function addDefaultSticky() {
function stickyShouldBePositionedCorrectly(position: Position) {
const yOffset = -100;
const xOffset = -180;
workflowPage.getters.stickies()
.should(($el) => {
expect($el).to.have.css('top', `${yOffset + position.top}px`);
expect($el).to.have.css('left', `${xOffset + position.left}px`);
});
workflowPage.getters.stickies().should(($el) => {
expect($el).to.have.css('top', `${yOffset + position.top}px`);
expect($el).to.have.css('left', `${xOffset + position.left}px`);
});
}
function stickyShouldHaveCorrectSize(size: [number, number]) {
const yOffset = 0;
const xOffset = 0;
workflowPage.getters.stickies()
.should(($el) => {
expect($el).to.have.css('height', `${yOffset + size[0]}px`);
expect($el).to.have.css('width', `${xOffset + size[1]}px`);
});
workflowPage.getters.stickies().should(($el) => {
expect($el).to.have.css('height', `${yOffset + size[0]}px`);
expect($el).to.have.css('width', `${xOffset + size[1]}px`);
});
}
function moveSticky(target: Position) {

View file

@ -1,4 +1,5 @@
import { WorkflowPage, NDV, CredentialsModal } from '../pages';
import { getVisibleSelect } from '../utils';
const workflowPage = new WorkflowPage();
const ndv = new NDV();
@ -32,7 +33,7 @@ describe('Resource Locator', () => {
workflowPage.actions.addNodeToCanvas('Google Sheets', true, true);
workflowPage.getters.nodeCredentialsSelect().click();
// Add oAuth credentials
workflowPage.getters.nodeCredentialsSelect().find('li').last().click();
getVisibleSelect().find('li').last().click();
credentialsModal.getters.credentialsEditModal().should('be.visible');
credentialsModal.getters.credentialAuthTypeRadioButtons().should('have.length', 2);
credentialsModal.getters.credentialAuthTypeRadioButtons().first().click();

View file

@ -160,7 +160,7 @@ export class NDV extends BasePage {
},
setRLCValue: (paramName: string, value: string) => {
this.getters.resourceLocatorModeSelector(paramName).click();
this.getters.resourceLocatorModeSelector(paramName).find('li').last().click();
getVisibleSelect().find('li').last().click();
this.getters.resourceLocatorInput(paramName).type(value);
},
validateExpressionPreview: (paramName: string, value: string) => {

View file

@ -11,7 +11,7 @@ export class PersonalSettingsPage extends BasePage {
lastNameInput: () => cy.getByTestId('lastName').find('input').first(),
emailInputContainer: () => cy.getByTestId('email'),
emailInput: () => cy.getByTestId('email').find('input').first(),
changePasswordLink: () => cy.getByTestId('change-password-link').find('a').first(),
changePasswordLink: () => cy.getByTestId('change-password-link').first(),
saveSettingsButton: () => cy.getByTestId('save-settings-button'),
};
actions = {
@ -34,7 +34,10 @@ export class PersonalSettingsPage extends BasePage {
},
tryToSetWeakPassword: (oldPassword: string, newPassword: string) => {
this.actions.updatePassword(oldPassword, newPassword);
changePasswordModal.getters.newPasswordInputContainer().find('div[class^="_errorInput"]').should('exist');
changePasswordModal.getters
.newPasswordInputContainer()
.find('div[class^="_errorInput"]')
.should('exist');
},
updateEmail: (newEmail: string) => {
this.getters.emailInput().type('{selectall}').type(newEmail).type('{enter}');

View file

@ -4,8 +4,8 @@ import { WorkflowPage } from './workflow';
import { WorkflowsPage } from './workflows';
import { BasePage } from './base';
const workflowPage = new WorkflowPage();
const workflowsPage = new WorkflowsPage();
const workflowPage = new WorkflowPage();
const workflowsPage = new WorkflowsPage();
const mainSidebar = new MainSidebar();
const settingsSidebar = new SettingsSidebar();
@ -18,11 +18,15 @@ export class SettingsUsersPage extends BasePage {
inviteUsersModalEmailsInput: () => cy.getByTestId('emails').find('input').first(),
userListItems: () => cy.get('[data-test-id^="user-list-item"]'),
userItem: (email: string) => cy.getByTestId(`user-list-item-${email.toLowerCase()}`),
userActionsToggle: (email: string) => this.getters.userItem(email).find('[data-test-id="action-toggle"]'),
deleteUserAction: () => cy.getByTestId('action-toggle-dropdown').find('li:contains("Delete"):visible'),
userActionsToggle: (email: string) =>
this.getters.userItem(email).find('[data-test-id="action-toggle"]'),
deleteUserAction: () =>
cy.getByTestId('action-toggle-dropdown').find('li:contains("Delete"):visible'),
confirmDeleteModal: () => cy.getByTestId('deleteUser-modal').last(),
transferDataRadioButton: () => this.getters.confirmDeleteModal().find('[role="radio"]').first(),
deleteDataRadioButton: () => this.getters.confirmDeleteModal().find('[role="radio"]').last(),
transferDataRadioButton: () =>
this.getters.confirmDeleteModal().find('.el-radio .el-radio__input').first(),
deleteDataRadioButton: () =>
this.getters.confirmDeleteModal().find('.el-radio .el-radio__input').last(),
userSelectDropDown: () => this.getters.confirmDeleteModal().find('.n8n-select'),
userSelectOptions: () => cy.get('.el-select-dropdown:visible .el-select-dropdown__item'),
deleteUserButton: () => this.getters.confirmDeleteModal().find('button:contains("Delete")'),

View file

@ -10,7 +10,7 @@ export class VariablesPage extends BasePage {
goToUpgrade: () => cy.getByTestId('go-to-upgrade'),
actionBox: () => cy.getByTestId('action-box'),
emptyResourcesListNewVariableButton: () => this.getters.emptyResourcesList().find('button'),
searchBar: () => cy.getByTestId('resources-list-search').find('input'),
searchBar: () => cy.getByTestId('resources-list-search'),
createVariableButton: () => cy.getByTestId('resources-list-add'),
variablesRows: () => cy.getByTestId('variables-row'),
variablesEditableRows: () =>

View file

@ -53,12 +53,12 @@ Cypress.Commands.add('signin', ({ email, password }) => {
});
Cypress.Commands.add('signout', () => {
cy.request('POST', '/rest/logout');
cy.request('POST', `${BACKEND_BASE_URL}/rest/logout`);
cy.getCookie(N8N_AUTH_COOKIE).should('not.exist');
});
Cypress.Commands.add('interceptREST', (method, url) => {
cy.intercept(method, `http://localhost:5678/rest${url}`);
cy.intercept(method, `${BACKEND_BASE_URL}/rest${url}`);
});
const setFeature = (feature: string, enabled: boolean) =>

View file

@ -19,7 +19,7 @@
<div v-show="!editMode" :class="$style.wrapper" @dblclick.stop="onDoubleClick">
<n8n-markdown
theme="sticky"
:content="content"
:content="modelValue"
:withMultiBreaks="true"
@markdown-click="onMarkdownClick"
/>
@ -35,11 +35,11 @@
:class="{ 'full-height': !shouldShowFooter, 'sticky-textarea': true }"
>
<n8n-input
:modelValue="content"
:modelValue="modelValue"
type="textarea"
:rows="5"
@blur="onInputBlur"
@update:modelValue="onInput"
@update:modelValue="onUpdateModelValue"
ref="input"
/>
</div>
@ -64,7 +64,7 @@ export default defineComponent({
name: 'n8n-sticky',
mixins: [Locale],
props: {
content: {
modelValue: {
type: String,
},
height: {
@ -152,8 +152,8 @@ export default defineComponent({
this.$emit('edit', false);
}
},
onInput(value: string) {
this.$emit('input', value);
onUpdateModelValue(value: string) {
this.$emit('update:modelValue', value);
},
onMarkdownClick(link: string, event: Event) {
this.$emit('markdown-click', link, event);
@ -175,7 +175,7 @@ export default defineComponent({
setTimeout(() => {
if (newMode && !prevMode && this.$refs.input) {
const textarea = this.$refs.input as HTMLTextAreaElement;
if (this.defaultText === this.content) {
if (this.defaultText === this.modelValue) {
textarea.select();
}
textarea.focus();

View file

@ -1,6 +1,6 @@
<template>
<span @keydown.stop class="inline-edit">
<span v-if="isEditEnabled && !disabled">
<span v-if="isEditEnabled && !isDisabled">
<ExpandableInputEdit
:placeholder="placeholder"
:modelValue="newValue"
@ -57,6 +57,7 @@ export default defineComponent({
},
data() {
return {
isDisabled: this.disabled,
newValue: '',
escPressed: false,
inputBus: createEventBus(),
@ -94,15 +95,15 @@ export default defineComponent({
}
const onSubmit = (updated: boolean) => {
this.disabled = false;
this.isDisabled = false;
if (!updated) {
this.inputBus.emit('focus');
}
};
this.disabled = true;
this.$emit('submit', this.newValue, onSubmit);
this.isDisabled = true;
this.$emit('submit', { name: this.newValue, onSubmit });
},
onEscape() {
if (this.disabled) {
@ -113,6 +114,11 @@ export default defineComponent({
this.$emit('toggle');
},
},
watch: {
disabled(value) {
this.isDisabled = value;
},
},
});
</script>

View file

@ -411,7 +411,13 @@ export default defineComponent({
this.isTagsEditEnabled = false;
}
},
async onNameSubmit(name: string, cb: (saved: boolean) => void) {
async onNameSubmit({
name,
onSubmit: cb,
}: {
name: string;
onSubmit: (saved: boolean) => void;
}) {
const newName = name.trim();
if (!newName) {
this.showMessage({

View file

@ -23,7 +23,7 @@
v-touch:end="touchEnd"
>
<n8n-sticky
:content="node.parameters.content"
:modelValue="node.parameters.content"
:height="node.parameters.height"
:width="node.parameters.width"
:scale="nodeViewScale"
@ -32,12 +32,12 @@
:defaultText="defaultText"
:editMode="isActive && !isReadOnly"
:gridSize="gridSize"
@input="onInputChange"
@edit="onEdit"
@resizestart="onResizeStart"
@resize="onResize"
@resizeend="onResizeEnd"
@markdown-click="onMarkdownClick"
@update:modelValue="onInputChange"
/>
</div>