Skip to content

Commit

Permalink
✔️ Enabling the feature
Browse files Browse the repository at this point in the history
  • Loading branch information
MiloradFilipovic committed Aug 20, 2024
1 parent 4342d85 commit 76e0d3b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
13 changes: 3 additions & 10 deletions cypress/e2e/45-ai-assistant.cy.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
import { overrideFeatureFlag } from '../composables/featureFlags';
import { NDV, WorkflowPage } from '../pages';
import { AIAssistant } from '../pages/features/ai-assistant';

const AI_ASSISTANT_FEATURE = {
flagName: '021_ai_debug_helper',
enabledFor: 'variant',
disabledFor: 'control',
};

const wf = new WorkflowPage();
const ndv = new NDV();
const aiAssistant = new AIAssistant();

describe('AI Assistant::disabled', () => {
beforeEach(() => {
overrideFeatureFlag(AI_ASSISTANT_FEATURE.flagName, AI_ASSISTANT_FEATURE.disabledFor);
aiAssistant.actions.disableAssistant();
wf.actions.visit();
});

Expand All @@ -25,12 +18,12 @@ describe('AI Assistant::disabled', () => {

describe('AI Assistant::enabled', () => {
beforeEach(() => {
overrideFeatureFlag(AI_ASSISTANT_FEATURE.flagName, AI_ASSISTANT_FEATURE.enabledFor);
aiAssistant.actions.enableAssistant();
wf.actions.visit();
});

after(() => {
overrideFeatureFlag(AI_ASSISTANT_FEATURE.flagName, AI_ASSISTANT_FEATURE.disabledFor);
aiAssistant.actions.disableAssistant();
});

it('renders placeholder UI', () => {
Expand Down
19 changes: 19 additions & 0 deletions cypress/pages/features/ai-assistant.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { overrideFeatureFlag } from '../../composables/featureFlags';
import { BasePage } from '../base';

const AI_ASSISTANT_FEATURE = {
name: 'aiAssistant',
experimentName: '021_ai_debug_helper',
enabledFor: 'variant',
disabledFor: 'control',
};

export class AIAssistant extends BasePage {
url = '/workflows/new';

Expand Down Expand Up @@ -27,4 +35,15 @@ export class AIAssistant extends BasePage {
nodeErrorViewAssistantButton: () =>
cy.getByTestId('node-error-view-ask-assistant-button').find('button').first(),
};

actions = {
enableAssistant(): void {
overrideFeatureFlag(AI_ASSISTANT_FEATURE.experimentName, AI_ASSISTANT_FEATURE.enabledFor);
cy.enableFeature(AI_ASSISTANT_FEATURE.name);
},
disableAssistant(): void {
overrideFeatureFlag(AI_ASSISTANT_FEATURE.experimentName, AI_ASSISTANT_FEATURE.disabledFor);
cy.disableFeature(AI_ASSISTANT_FEATURE.name);
},
};
}

0 comments on commit 76e0d3b

Please sign in to comment.