mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 05:04:05 -08:00
517b050d0a
## Summary Adding a link between the workflow and the template it originated from by saving `templateId` in the workflow metadata ## Related tickets and issues ADO-1537 ## Review / Merge checklist - [x] PR title and summary are descriptive. **Remember, the title automatically goes into the changelog. Use `(no-changelog)` otherwise.** ([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md)) - [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up ticket created. - [x] Tests included. > A bug is not considered fixed, unless a test is added to prevent it from happening again. > A feature is not complete without tests.
56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import { BasePage } from './base';
|
|
|
|
export class TemplatesPage extends BasePage {
|
|
url = '/templates';
|
|
|
|
getters = {
|
|
useTemplateButton: () => cy.getByTestId('use-template-button'),
|
|
templateCards: () => cy.getByTestId('template-card'),
|
|
firstTemplateCard: () => this.getters.templateCards().first(),
|
|
};
|
|
|
|
actions = {
|
|
openSingleTemplateView: (templateId: number) => {
|
|
cy.visit(`${this.url}/${templateId}`);
|
|
cy.waitForLoad();
|
|
},
|
|
|
|
openOnboardingFlow: (id: number, name: string, workflow: object) => {
|
|
const apiResponse = {
|
|
id,
|
|
name,
|
|
workflow,
|
|
};
|
|
cy.intercept('POST', '/rest/workflows').as('createWorkflow');
|
|
cy.intercept('GET', `https://api.n8n.io/api/workflows/templates/${id}`, {
|
|
statusCode: 200,
|
|
body: apiResponse,
|
|
}).as('getTemplate');
|
|
cy.intercept('GET', 'rest/workflows/**').as('getWorkflow');
|
|
|
|
cy.visit(`/workflows/onboarding/${id}`);
|
|
|
|
cy.wait('@getTemplate');
|
|
cy.wait(['@createWorkflow', '@getWorkflow']);
|
|
},
|
|
|
|
importTemplate: (id: number, name: string, workflow: object) => {
|
|
const apiResponse = {
|
|
id,
|
|
name,
|
|
workflow,
|
|
};
|
|
cy.intercept('GET', `https://api.n8n.io/api/workflows/templates/${id}`, {
|
|
statusCode: 200,
|
|
body: apiResponse,
|
|
}).as('getTemplate');
|
|
cy.intercept('GET', 'rest/workflows/**').as('getWorkflow');
|
|
|
|
cy.visit(`/workflows/templates/${id}`);
|
|
|
|
cy.wait('@getTemplate');
|
|
cy.wait('@getWorkflow');
|
|
},
|
|
};
|
|
}
|