mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-15 09:04:07 -08:00
4277e92ec0
Updating n8n front-end to use the new search endpoint powered by TypeSense. Endpoint is deployed on staging API so, in order to test it, use this env var: ```export N8N_TEMPLATES_HOST=https://api-staging.n8n.io/api``` **NOTE**: This PR should not be merged until [backend changes](https://github.com/n8n-io/creators-site/pull/118) are merged and released. ## Related tickets and issues https://linear.app/n8n/issue/ADO-1555/update-in-app-search-to-work-with-the-new-back-end ## 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)) - [ ] 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.
64 lines
2 KiB
TypeScript
64 lines
2 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(),
|
|
allCategoriesFilter: () => cy.getByTestId('template-filter-all-categories'),
|
|
searchInput: () => cy.getByTestId('template-search-input'),
|
|
categoryFilters: () => cy.get('[data-test-id^=template-filter]'),
|
|
categoryFilter: (category: string) => cy.getByTestId(`template-filter-${category}`),
|
|
collectionCountLabel: () => cy.getByTestId('collection-count-label'),
|
|
templateCountLabel: () => cy.getByTestId('template-count-label'),
|
|
templatesLoadingContainer: () => cy.getByTestId('templates-loading-container'),
|
|
expandCategoriesButton: () => cy.getByTestId('expand-categories-button'),
|
|
};
|
|
|
|
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');
|
|
},
|
|
};
|
|
}
|