mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
feat(editor): Add RAG starter template callouts experiment (#16282)
Co-authored-by: Charlie Kolb <charlie@n8n.io>
This commit is contained in:
31
cypress/composables/nodeCreator.ts
Normal file
31
cypress/composables/nodeCreator.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
// Getters
|
||||
export const nodeCreatorPlusButton = () => cy.getByTestId('node-creator-plus-button');
|
||||
export const canvasAddButton = () => cy.getByTestId('canvas-add-button');
|
||||
export const searchBar = () => cy.getByTestId('search-bar');
|
||||
export const getCategoryItem = (label: string) => cy.get(`[data-keyboard-nav-id="${label}"]`);
|
||||
export const getCreatorItem = (label: string) =>
|
||||
getCreatorItems().contains(label).parents('[data-test-id="item-iterator-item"]');
|
||||
export const getNthCreatorItem = (n: number) => getCreatorItems().eq(n);
|
||||
export const nodeCreator = () => cy.getByTestId('node-creator');
|
||||
export const nodeCreatorTabs = () => cy.getByTestId('node-creator-type-selector');
|
||||
export const selectedTab = () => nodeCreatorTabs().find('.is-active');
|
||||
export const categorizedItems = () => cy.getByTestId('categorized-items');
|
||||
export const getCreatorItems = () => cy.getByTestId('item-iterator-item');
|
||||
export const categoryItem = () => cy.getByTestId('node-creator-category-item');
|
||||
export const communityNodeTooltip = () => cy.getByTestId('node-item-community-tooltip');
|
||||
export const noResults = () => cy.getByTestId('node-creator-no-results');
|
||||
export const nodeItemName = () => cy.getByTestId('node-creator-item-name');
|
||||
export const nodeItemDescription = () => cy.getByTestId('node-creator-item-description');
|
||||
export const activeSubcategory = () => cy.getByTestId('nodes-list-header');
|
||||
export const expandedCategories = () =>
|
||||
getCreatorItems().find('>div').filter('.active').invoke('text');
|
||||
|
||||
// Actions
|
||||
export const openNodeCreator = () => {
|
||||
nodeCreatorPlusButton().click();
|
||||
nodeCreator().should('be.visible');
|
||||
};
|
||||
|
||||
export const selectNode = (displayName: string) => {
|
||||
getCreatorItem(displayName).click();
|
||||
};
|
||||
72
cypress/e2e/52-rag-callout-experiment.cy.ts
Normal file
72
cypress/e2e/52-rag-callout-experiment.cy.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import { overrideFeatureFlag } from '../composables/featureFlags';
|
||||
import { openNodeCreator, searchBar } from '../composables/nodeCreator';
|
||||
import { addNodeToCanvas, navigateToNewWorkflowPage } from '../composables/workflow';
|
||||
|
||||
describe('RAG callout experiment', () => {
|
||||
describe('NDV callout', () => {
|
||||
it('should not show callout if experiment is control', () => {
|
||||
overrideFeatureFlag('033_rag_template', 'control');
|
||||
|
||||
navigateToNewWorkflowPage();
|
||||
|
||||
addNodeToCanvas('Zep Vector Store', true, true, 'Add documents to vector store');
|
||||
|
||||
cy.contains('Tip: Get a feel for vector stores in n8n with our').should('not.exist');
|
||||
});
|
||||
|
||||
it('should callout is variant and open on click', () => {
|
||||
cy.intercept('workflows/templates/rag-starter-template?fromJson=true');
|
||||
overrideFeatureFlag('033_rag_template', 'variant');
|
||||
|
||||
navigateToNewWorkflowPage();
|
||||
|
||||
addNodeToCanvas('Zep Vector Store', true, true, 'Add documents to vector store');
|
||||
|
||||
cy.contains('Tip: Get a feel for vector stores in n8n with our').should('exist');
|
||||
|
||||
let openedUrl = '';
|
||||
cy.window().then((win) => {
|
||||
cy.stub(win, 'open').callsFake((url) => {
|
||||
openedUrl = url;
|
||||
});
|
||||
});
|
||||
cy.contains('RAG starter template').click();
|
||||
cy.then(() => cy.visit(openedUrl));
|
||||
|
||||
cy.url().should('include', '/workflows/templates/rag-starter-template?fromJson=true');
|
||||
});
|
||||
});
|
||||
describe('search callout', () => {
|
||||
it('should not show callout if experiment is control', () => {
|
||||
overrideFeatureFlag('033_rag_template', 'control');
|
||||
|
||||
navigateToNewWorkflowPage();
|
||||
|
||||
openNodeCreator();
|
||||
searchBar().type('rag');
|
||||
|
||||
cy.contains('RAG starter template').should('not.exist');
|
||||
});
|
||||
|
||||
it('should should callout is variant and open on click', () => {
|
||||
cy.intercept('workflows/templates/rag-starter-template?fromJson=true');
|
||||
overrideFeatureFlag('033_rag_template', 'variant');
|
||||
|
||||
navigateToNewWorkflowPage();
|
||||
|
||||
openNodeCreator();
|
||||
searchBar().type('rag');
|
||||
|
||||
let openedUrl = '';
|
||||
cy.window().then((win) => {
|
||||
cy.stub(win, 'open').callsFake((url) => {
|
||||
openedUrl = url;
|
||||
});
|
||||
});
|
||||
cy.contains('RAG starter template').should('exist').click();
|
||||
cy.then(() => cy.visit(openedUrl));
|
||||
|
||||
cy.url().should('include', '/workflows/templates/rag-starter-template?fromJson=true');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user