mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
test: Update template credentials setup e2e test for new canvas (no-changelog) (#12487)
This commit is contained in:
parent
ac6b244c71
commit
f7eb901489
|
@ -3,6 +3,7 @@ import * as formStep from '../composables/setup-template-form-step';
|
||||||
import { getSetupWorkflowCredentialsButton } from '../composables/setup-workflow-credentials-button';
|
import { getSetupWorkflowCredentialsButton } from '../composables/setup-workflow-credentials-button';
|
||||||
import TestTemplate1 from '../fixtures/Test_Template_1.json';
|
import TestTemplate1 from '../fixtures/Test_Template_1.json';
|
||||||
import TestTemplate2 from '../fixtures/Test_Template_2.json';
|
import TestTemplate2 from '../fixtures/Test_Template_2.json';
|
||||||
|
import { clearNotifications } from '../pages/notifications';
|
||||||
import {
|
import {
|
||||||
clickUseWorkflowButtonByTitle,
|
clickUseWorkflowButtonByTitle,
|
||||||
visitTemplateCollectionPage,
|
visitTemplateCollectionPage,
|
||||||
|
@ -111,16 +112,19 @@ describe('Template credentials setup', () => {
|
||||||
templateCredentialsSetupPage.fillInDummyCredentialsForAppWithConfirm('X (Formerly Twitter)');
|
templateCredentialsSetupPage.fillInDummyCredentialsForAppWithConfirm('X (Formerly Twitter)');
|
||||||
templateCredentialsSetupPage.fillInDummyCredentialsForApp('Telegram');
|
templateCredentialsSetupPage.fillInDummyCredentialsForApp('Telegram');
|
||||||
|
|
||||||
|
clearNotifications();
|
||||||
|
|
||||||
templateCredentialsSetupPage.finishCredentialSetup();
|
templateCredentialsSetupPage.finishCredentialSetup();
|
||||||
|
|
||||||
workflowPage.getters.canvasNodes().should('have.length', 3);
|
workflowPage.getters.canvasNodes().should('have.length', 3);
|
||||||
|
|
||||||
|
cy.grantBrowserPermissions('clipboardReadWrite', 'clipboardSanitizedWrite');
|
||||||
|
|
||||||
// Focus the canvas so the copy to clipboard works
|
// Focus the canvas so the copy to clipboard works
|
||||||
workflowPage.getters.canvasNodes().eq(0).realClick();
|
workflowPage.getters.canvasNodes().eq(0).realClick();
|
||||||
workflowPage.actions.hitSelectAll();
|
workflowPage.actions.hitSelectAll();
|
||||||
workflowPage.actions.hitCopy();
|
workflowPage.actions.hitCopy();
|
||||||
|
|
||||||
cy.grantBrowserPermissions('clipboardReadWrite', 'clipboardSanitizedWrite');
|
|
||||||
// Check workflow JSON by copying it to clipboard
|
// Check workflow JSON by copying it to clipboard
|
||||||
cy.readClipboard().then((workflowJSON) => {
|
cy.readClipboard().then((workflowJSON) => {
|
||||||
const workflow = JSON.parse(workflowJSON);
|
const workflow = JSON.parse(workflowJSON);
|
||||||
|
@ -154,6 +158,8 @@ describe('Template credentials setup', () => {
|
||||||
templateCredentialsSetupPage.fillInDummyCredentialsForApp('Email (IMAP)');
|
templateCredentialsSetupPage.fillInDummyCredentialsForApp('Email (IMAP)');
|
||||||
templateCredentialsSetupPage.fillInDummyCredentialsForApp('Nextcloud');
|
templateCredentialsSetupPage.fillInDummyCredentialsForApp('Nextcloud');
|
||||||
|
|
||||||
|
clearNotifications();
|
||||||
|
|
||||||
templateCredentialsSetupPage.finishCredentialSetup();
|
templateCredentialsSetupPage.finishCredentialSetup();
|
||||||
|
|
||||||
workflowPage.getters.canvasNodes().should('have.length', 3);
|
workflowPage.getters.canvasNodes().should('have.length', 3);
|
||||||
|
@ -176,6 +182,8 @@ describe('Template credentials setup', () => {
|
||||||
templateCredentialsSetupPage.visitTemplateCredentialSetupPage(testTemplate.id);
|
templateCredentialsSetupPage.visitTemplateCredentialSetupPage(testTemplate.id);
|
||||||
templateCredentialsSetupPage.fillInDummyCredentialsForApp('Shopify');
|
templateCredentialsSetupPage.fillInDummyCredentialsForApp('Shopify');
|
||||||
|
|
||||||
|
clearNotifications();
|
||||||
|
|
||||||
templateCredentialsSetupPage.finishCredentialSetup();
|
templateCredentialsSetupPage.finishCredentialSetup();
|
||||||
|
|
||||||
getSetupWorkflowCredentialsButton().should('be.visible');
|
getSetupWorkflowCredentialsButton().should('be.visible');
|
||||||
|
@ -192,6 +200,8 @@ describe('Template credentials setup', () => {
|
||||||
templateCredentialsSetupPage.fillInDummyCredentialsForAppWithConfirm('X (Formerly Twitter)');
|
templateCredentialsSetupPage.fillInDummyCredentialsForAppWithConfirm('X (Formerly Twitter)');
|
||||||
templateCredentialsSetupPage.fillInDummyCredentialsForApp('Telegram');
|
templateCredentialsSetupPage.fillInDummyCredentialsForApp('Telegram');
|
||||||
|
|
||||||
|
clearNotifications();
|
||||||
|
|
||||||
setupCredsModal.closeModalFromContinueButton();
|
setupCredsModal.closeModalFromContinueButton();
|
||||||
setupCredsModal.getWorkflowCredentialsModal().should('not.exist');
|
setupCredsModal.getWorkflowCredentialsModal().should('not.exist');
|
||||||
|
|
||||||
|
|
|
@ -13,5 +13,10 @@ export const infoToast = () => cy.get('.el-notification:has(.el-notification--in
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
export const clearNotifications = () => {
|
export const clearNotifications = () => {
|
||||||
successToast().find('.el-notification__closeBtn').click({ multiple: true });
|
const buttons = successToast().find('.el-notification__closeBtn');
|
||||||
|
buttons.then(($buttons) => {
|
||||||
|
if ($buttons.length) {
|
||||||
|
buttons.click({ multiple: true });
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,7 +29,10 @@ exports[`useCanvasOperations > copyNodes > should copy nodes 1`] = `
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"connections": {},
|
"connections": {},
|
||||||
"pinData": {}
|
"pinData": {},
|
||||||
|
"meta": {
|
||||||
|
"instanceId": ""
|
||||||
|
}
|
||||||
}",
|
}",
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
@ -64,7 +67,10 @@ exports[`useCanvasOperations > cutNodes > should copy and delete nodes 1`] = `
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"connections": {},
|
"connections": {},
|
||||||
"pinData": {}
|
"pinData": {},
|
||||||
|
"meta": {
|
||||||
|
"instanceId": ""
|
||||||
|
}
|
||||||
}",
|
}",
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
|
|
@ -1887,6 +1887,12 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||||
async function copyNodes(ids: string[]) {
|
async function copyNodes(ids: string[]) {
|
||||||
const workflowData = deepCopy(getNodesToSave(workflowsStore.getNodesByIds(ids)));
|
const workflowData = deepCopy(getNodesToSave(workflowsStore.getNodesByIds(ids)));
|
||||||
|
|
||||||
|
workflowData.meta = {
|
||||||
|
...workflowData.meta,
|
||||||
|
...workflowsStore.workflow.meta,
|
||||||
|
instanceId: rootStore.instanceId,
|
||||||
|
};
|
||||||
|
|
||||||
await clipboard.copy(JSON.stringify(workflowData, null, 2));
|
await clipboard.copy(JSON.stringify(workflowData, null, 2));
|
||||||
|
|
||||||
telemetry.track('User copied nodes', {
|
telemetry.track('User copied nodes', {
|
||||||
|
|
|
@ -118,6 +118,11 @@ const LazyNodeDetailsView = defineAsyncComponent(
|
||||||
async () => await import('@/components/NodeDetailsView.vue'),
|
async () => await import('@/components/NodeDetailsView.vue'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const LazySetupWorkflowCredentialsButton = defineAsyncComponent(
|
||||||
|
async () =>
|
||||||
|
await import('@/components/SetupWorkflowCredentialsButton/SetupWorkflowCredentialsButton.vue'),
|
||||||
|
);
|
||||||
|
|
||||||
const $style = useCssModule();
|
const $style = useCssModule();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -1696,6 +1701,9 @@ onBeforeUnmount(() => {
|
||||||
@viewport-change="onViewportChange"
|
@viewport-change="onViewportChange"
|
||||||
@drag-and-drop="onDragAndDrop"
|
@drag-and-drop="onDragAndDrop"
|
||||||
>
|
>
|
||||||
|
<Suspense>
|
||||||
|
<LazySetupWorkflowCredentialsButton :class="$style.setupCredentialsButtonWrapper" />
|
||||||
|
</Suspense>
|
||||||
<div v-if="!isCanvasReadOnly" :class="$style.executionButtons">
|
<div v-if="!isCanvasReadOnly" :class="$style.executionButtons">
|
||||||
<CanvasRunWorkflowButton
|
<CanvasRunWorkflowButton
|
||||||
v-if="isRunWorkflowButtonVisible"
|
v-if="isRunWorkflowButtonVisible"
|
||||||
|
@ -1804,6 +1812,12 @@ onBeforeUnmount(() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.setupCredentialsButtonWrapper {
|
||||||
|
position: absolute;
|
||||||
|
left: var(--spacing-s);
|
||||||
|
top: var(--spacing-s);
|
||||||
|
}
|
||||||
|
|
||||||
.readOnlyEnvironmentNotification {
|
.readOnlyEnvironmentNotification {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 16px;
|
bottom: 16px;
|
||||||
|
|
Loading…
Reference in a new issue