-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ADO-1537-save-templateId-with-workflow
* master: (22 commits) fix(editor): Make keyboard shortcuts more strict; don't accept extra Ctrl/Alt/Shift keys (#8024) fix(core): Downgrade Rudderstack SDK (no-changelog) (#8107) fix(editor): Move versions check to init function and refactor store (no-changelog) (#8067) refactor(editor): Add telemetry for SSO/SAML (no-changelog) (#8102) fix(editor): Ensure execution data overrides pinned data when copying in executions view (#8009) fix(editor): Fix copy/paste issue when switch node is in workflow (#8103) feat(editor): Upgrade frontend tooling to address a few vulnerabilities (#8100) feat(editor): De-duplicate frontend devDependencies (no-changelog) (#8094) refactor(core): Improve test-webhooks (no-changelog) (#8069) refactor: Add telemetry for RBAC (no-changelog) (#8056) feat(core): Upgrade Rudderstack SDK (no-changelog) (#8090) fix: Upgrade axios to address CVE-2023-45857 (#7713) fix(core): Do not display error when stopping jobless execution in queue mode (#8007) feat(editor): Gracefully ignore invalid payloads in postMessage handler (#8096) feat(editor): Add lead enrichment suggestions to workflow list (#8042) refactor(Discord Node): Stop reporting to Sentry inaccessible guild error (no-changelog) (#8095) feat: Add opt-in enterprise license trial checkbox (no-changelog) (#7826) ci: Remove unnecessary async/await, enable await-thenable linting rule (no-changelog) (#8076) refactor(editor): Add telemetry for log streaming (no-changelog) (#8075) fix(core): Use relative imports for dynamic imports in SecurityAuditService (#8086) ...
- Loading branch information
Showing
129 changed files
with
3,739 additions
and
2,103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Getters | ||
*/ | ||
|
||
export function getVersionUpdatesPanelOpenButton() { | ||
return cy.getByTestId('version-updates-panel-button'); | ||
} | ||
|
||
export function getVersionUpdatesPanel() { | ||
return cy.getByTestId('version-updates-panel'); | ||
} | ||
|
||
export function getVersionUpdatesPanelCloseButton() { | ||
return getVersionUpdatesPanel().get('.el-drawer__close-btn').first(); | ||
} | ||
|
||
export function getVersionCard() { | ||
return cy.getByTestId('version-card'); | ||
} | ||
|
||
/** | ||
* Actions | ||
*/ | ||
|
||
export function openVersionUpdatesPanel() { | ||
getVersionUpdatesPanelOpenButton().click(); | ||
getVersionUpdatesPanel().should('be.visible'); | ||
} | ||
|
||
export function closeVersionUpdatesPanel() { | ||
getVersionUpdatesPanelCloseButton().click(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
import { WorkflowsPage as WorkflowsPageClass } from '../pages/workflows'; | ||
import { WorkflowPage as WorkflowPageClass } from '../pages/workflow'; | ||
|
||
type SuggestedTemplatesStub = { | ||
sections: SuggestedTemplatesSectionStub[]; | ||
} | ||
|
||
type SuggestedTemplatesSectionStub = { | ||
name: string; | ||
title: string; | ||
description: string; | ||
workflows: Array<Object>; | ||
}; | ||
|
||
const WorkflowsListPage = new WorkflowsPageClass(); | ||
const WorkflowPage = new WorkflowPageClass(); | ||
|
||
let fixtureSections: SuggestedTemplatesStub = { sections: [] };; | ||
|
||
describe('Suggested templates - Should render', () => { | ||
|
||
before(() => { | ||
cy.fixture('Suggested_Templates.json').then((data) => { | ||
fixtureSections = data; | ||
}); | ||
}); | ||
|
||
beforeEach(() => { | ||
localStorage.removeItem('SHOW_N8N_SUGGESTED_TEMPLATES'); | ||
cy.intercept('GET', '/rest/settings', (req) => { | ||
req.on('response', (res) => { | ||
res.send({ | ||
data: { ...res.body.data, deployment: { type: 'cloud' } }, | ||
}); | ||
}); | ||
}).as('loadSettings'); | ||
cy.intercept('GET', '/rest/cloud/proxy/templates', { | ||
fixture: 'Suggested_Templates.json', | ||
}); | ||
cy.visit(WorkflowsListPage.url); | ||
cy.wait('@loadSettings'); | ||
}); | ||
|
||
it('should render suggested templates page in empty workflow list', () => { | ||
WorkflowsListPage.getters.suggestedTemplatesPageContainer().should('exist'); | ||
WorkflowsListPage.getters.suggestedTemplatesCards().should('have.length', fixtureSections.sections[0].workflows.length); | ||
WorkflowsListPage.getters.suggestedTemplatesSectionDescription().should('contain', fixtureSections.sections[0].description); | ||
}); | ||
|
||
it('should render suggested templates when there are workflows in the list', () => { | ||
WorkflowsListPage.getters.suggestedTemplatesNewWorkflowButton().click(); | ||
cy.createFixtureWorkflow('Test_workflow_1.json', 'Test Workflow'); | ||
cy.visit(WorkflowsListPage.url); | ||
WorkflowsListPage.getters.suggestedTemplatesSectionContainer().should('exist'); | ||
cy.contains(`Explore ${fixtureSections.sections[0].name.toLocaleLowerCase()} workflow templates`).should('exist'); | ||
WorkflowsListPage.getters.suggestedTemplatesCards().should('have.length', fixtureSections.sections[0].workflows.length); | ||
}); | ||
|
||
it('should enable users to # for suggested templates templates', () => { | ||
// Test the whole flow | ||
WorkflowsListPage.getters.suggestedTemplatesCards().first().click(); | ||
WorkflowsListPage.getters.suggestedTemplatesPreviewModal().should('exist'); | ||
WorkflowsListPage.getters.suggestedTemplatesUseTemplateButton().click(); | ||
cy.url().should('include', '/workflow/new'); | ||
WorkflowPage.getters.infoToast().should('contain', 'Template coming soon!'); | ||
WorkflowPage.getters.infoToast().contains('Notify me when it\'s available').click(); | ||
WorkflowPage.getters.successToast().should('contain', 'We will contact you via email once this template is released.'); | ||
cy.visit(WorkflowsListPage.url); | ||
// Once users have signed up for a template, suggestions should not be shown again | ||
WorkflowsListPage.getters.suggestedTemplatesSectionContainer().should('not.exist'); | ||
}); | ||
|
||
}); | ||
|
||
describe('Suggested templates - Should not render', () => { | ||
beforeEach(() => { | ||
localStorage.removeItem('SHOW_N8N_SUGGESTED_TEMPLATES'); | ||
cy.visit(WorkflowsListPage.url); | ||
}); | ||
|
||
it('should not render suggested templates templates if not in cloud deployment', () => { | ||
cy.intercept('GET', '/rest/settings', (req) => { | ||
req.on('response', (res) => { | ||
res.send({ | ||
data: { ...res.body.data, deployment: { type: 'notCloud' } }, | ||
}); | ||
}); | ||
}); | ||
WorkflowsListPage.getters.suggestedTemplatesPageContainer().should('not.exist'); | ||
WorkflowsListPage.getters.suggestedTemplatesSectionContainer().should('not.exist'); | ||
}); | ||
|
||
it('should not render suggested templates templates if endpoint throws error', () => { | ||
cy.intercept('GET', '/rest/settings', (req) => { | ||
req.on('response', (res) => { | ||
res.send({ | ||
data: { ...res.body.data, deployment: { type: 'cloud' } }, | ||
}); | ||
}); | ||
}); | ||
cy.intercept('GET', '/rest/cloud/proxy/templates', { statusCode: 500 }).as('loadTemplates'); | ||
WorkflowsListPage.getters.suggestedTemplatesPageContainer().should('not.exist'); | ||
WorkflowsListPage.getters.suggestedTemplatesSectionContainer().should('not.exist'); | ||
}); | ||
|
||
it('should not render suggested templates templates if endpoint returns empty list', () => { | ||
cy.intercept('GET', '/rest/settings', (req) => { | ||
req.on('response', (res) => { | ||
res.send({ | ||
data: { ...res.body.data, deployment: { type: 'cloud' } }, | ||
}); | ||
}); | ||
}); | ||
cy.intercept('GET', '/rest/cloud/proxy/templates', (req) => { | ||
req.on('response', (res) => { | ||
res.send({ | ||
data: { collections: [] }, | ||
}); | ||
}); | ||
}); | ||
WorkflowsListPage.getters.suggestedTemplatesPageContainer().should('not.exist'); | ||
WorkflowsListPage.getters.suggestedTemplatesSectionContainer().should('not.exist'); | ||
}); | ||
|
||
it('should not render suggested templates templates if endpoint returns invalid response', () => { | ||
cy.intercept('GET', '/rest/settings', (req) => { | ||
req.on('response', (res) => { | ||
res.send({ | ||
data: { ...res.body.data, deployment: { type: 'cloud' } }, | ||
}); | ||
}); | ||
}); | ||
cy.intercept('GET', '/rest/cloud/proxy/templates', (req) => { | ||
req.on('response', (res) => { | ||
res.send({ | ||
data: { somethingElse: [] }, | ||
}); | ||
}); | ||
}); | ||
WorkflowsListPage.getters.suggestedTemplatesPageContainer().should('not.exist'); | ||
WorkflowsListPage.getters.suggestedTemplatesSectionContainer().should('not.exist'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { INSTANCE_OWNER } from '../constants'; | ||
import { WorkflowsPage } from '../pages/workflows'; | ||
import { | ||
closeVersionUpdatesPanel, | ||
getVersionCard, | ||
getVersionUpdatesPanelOpenButton, | ||
openVersionUpdatesPanel, | ||
} from '../composables/versions'; | ||
|
||
const workflowsPage = new WorkflowsPage(); | ||
|
||
describe('Versions', () => { | ||
it('should open updates panel', () => { | ||
cy.intercept('GET', '/rest/settings', (req) => { | ||
req.continue((res) => { | ||
if (res.body.hasOwnProperty('data')) { | ||
res.body.data = { | ||
...res.body.data, | ||
releaseChannel: 'stable', | ||
versionCli: '1.0.0', | ||
versionNotifications: { | ||
enabled: true, | ||
endpoint: 'https://api.n8n.io/api/versions/', | ||
infoUrl: 'https://docs.n8n.io/getting-started/installation/updating.html', | ||
}, | ||
}; | ||
} | ||
}); | ||
}).as('settings'); | ||
|
||
cy.intercept('GET', 'https://api.n8n.io/api/versions/1.0.0', [ | ||
{ | ||
name: '1.3.1', | ||
createdAt: '2023-08-18T11:53:12.857Z', | ||
hasSecurityIssue: null, | ||
hasSecurityFix: null, | ||
securityIssueFixVersion: null, | ||
hasBreakingChange: null, | ||
documentationUrl: 'https://docs.n8n.io/release-notes/#n8n131', | ||
nodes: [], | ||
description: 'Includes <strong>bug fixes</strong>', | ||
}, | ||
{ | ||
name: '1.0.5', | ||
createdAt: '2023-07-24T10:54:56.097Z', | ||
hasSecurityIssue: false, | ||
hasSecurityFix: null, | ||
securityIssueFixVersion: null, | ||
hasBreakingChange: true, | ||
documentationUrl: 'https://docs.n8n.io/release-notes/#n8n104', | ||
nodes: [], | ||
description: 'Includes <strong>core functionality</strong> and <strong>bug fixes</strong>', | ||
}, | ||
]); | ||
|
||
cy.signin(INSTANCE_OWNER); | ||
|
||
cy.visit(workflowsPage.url); | ||
cy.wait('@settings'); | ||
|
||
getVersionUpdatesPanelOpenButton().should('contain', '2 updates'); | ||
openVersionUpdatesPanel(); | ||
getVersionCard().should('have.length', 2); | ||
closeVersionUpdatesPanel(); | ||
}); | ||
}); |
Oops, something went wrong.