mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
fix(editor): Properly set active project in new canvas (#12810)
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
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
This commit is contained in:
parent
663dfb48de
commit
648c6f9315
|
@ -1,3 +1,5 @@
|
||||||
|
import { setCredentialValues } from '../composables/modals/credential-modal';
|
||||||
|
import { clickCreateNewCredential, selectResourceLocatorItem } from '../composables/ndv';
|
||||||
import * as projects from '../composables/projects';
|
import * as projects from '../composables/projects';
|
||||||
import {
|
import {
|
||||||
INSTANCE_ADMIN,
|
INSTANCE_ADMIN,
|
||||||
|
@ -534,6 +536,65 @@ describe('Projects', { disableAutoLogin: true }, () => {
|
||||||
workflowPage.getters.canvasNodeByName(NOTION_NODE_NAME).should('be.visible').dblclick();
|
workflowPage.getters.canvasNodeByName(NOTION_NODE_NAME).should('be.visible').dblclick();
|
||||||
ndv.getters.credentialInput().find('input').should('be.enabled');
|
ndv.getters.credentialInput().find('input').should('be.enabled');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should create sub-workflow and credential in the sub-workflow in the same project', () => {
|
||||||
|
cy.signinAsOwner();
|
||||||
|
cy.visit(workflowsPage.url);
|
||||||
|
|
||||||
|
projects.createProject('Dev');
|
||||||
|
projects.getProjectTabWorkflows().click();
|
||||||
|
workflowsPage.getters.newWorkflowButtonCard().click();
|
||||||
|
workflowPage.actions.addNodeToCanvas(MANUAL_TRIGGER_NODE_NAME);
|
||||||
|
workflowPage.actions.saveWorkflowOnButtonClick();
|
||||||
|
workflowPage.actions.addNodeToCanvas('Execute Workflow', true, true);
|
||||||
|
|
||||||
|
cy.window().then((win) => {
|
||||||
|
cy.stub(win, 'open').callsFake((url) => {
|
||||||
|
cy.visit(url);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
selectResourceLocatorItem('workflowId', 0, 'Create a');
|
||||||
|
|
||||||
|
workflowPage.actions.addNodeToCanvas(NOTION_NODE_NAME, true, true);
|
||||||
|
clickCreateNewCredential();
|
||||||
|
setCredentialValues({
|
||||||
|
apiKey: 'abc123',
|
||||||
|
});
|
||||||
|
ndv.actions.close();
|
||||||
|
workflowPage.actions.saveWorkflowOnButtonClick();
|
||||||
|
|
||||||
|
projects.getMenuItems().last().click();
|
||||||
|
workflowsPage.getters.workflowCards().should('have.length', 2);
|
||||||
|
|
||||||
|
projects.getProjectTabCredentials().click();
|
||||||
|
credentialsPage.getters.credentialCards().should('have.length', 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create credential from workflow in the correct project after editor page refresh', () => {
|
||||||
|
cy.signinAsOwner();
|
||||||
|
cy.visit(workflowsPage.url);
|
||||||
|
|
||||||
|
projects.createProject('Dev');
|
||||||
|
projects.getProjectTabWorkflows().click();
|
||||||
|
workflowsPage.getters.newWorkflowButtonCard().click();
|
||||||
|
workflowPage.actions.addNodeToCanvas(MANUAL_TRIGGER_NODE_NAME);
|
||||||
|
workflowPage.actions.saveWorkflowOnButtonClick();
|
||||||
|
|
||||||
|
cy.reload();
|
||||||
|
|
||||||
|
workflowPage.actions.addNodeToCanvas(NOTION_NODE_NAME, true, true);
|
||||||
|
clickCreateNewCredential();
|
||||||
|
setCredentialValues({
|
||||||
|
apiKey: 'abc123',
|
||||||
|
});
|
||||||
|
ndv.actions.close();
|
||||||
|
workflowPage.actions.saveWorkflowOnButtonClick();
|
||||||
|
|
||||||
|
projects.getMenuItems().last().click();
|
||||||
|
projects.getProjectTabCredentials().click();
|
||||||
|
credentialsPage.getters.credentialCards().should('have.length', 1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set and update project icon', () => {
|
it('should set and update project icon', () => {
|
||||||
|
|
|
@ -396,9 +396,7 @@ async function initializeWorkspaceForExistingWorkflow(id: string) {
|
||||||
trackOpenWorkflowFromOnboardingTemplate();
|
trackOpenWorkflowFromOnboardingTemplate();
|
||||||
}
|
}
|
||||||
|
|
||||||
await projectsStore.setProjectNavActiveIdByWorkflowHomeProject(
|
await projectsStore.setProjectNavActiveIdByWorkflowHomeProject(workflowData.homeProject);
|
||||||
editableWorkflow.value.homeProject,
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.showError(error, i18n.baseText('openWorkflow.workflowNotFoundError'));
|
toast.showError(error, i18n.baseText('openWorkflow.workflowNotFoundError'));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue