feat(editor): Add user activation survey (#5677)

*  Add user activation survey

* Fix typo

* Avoid showing the modal when there is a modal view

* Allow to redirect to specific execution

* Improve structure

* Handle errors when sharing feedback

* update withFeatureFlag function

* Fix linting issue

* Set user activation flag on workflowExecutionCompleted event

* Revert update user settings functionality

* Remove unnecessary changes

* fix linting issue

* account for new functionality in tests

* Small improvements

* keep once instace of the model open between tabs

* Add sorting to GET /executions

* type parameters for GET /executions


a

* Add constant for local store key

* Add execution mode filtering

* fix linting issue

* Do not override settings when setting isOnboarded true

* Add update user settings endpoint

* improvements

* revert changes to /GET executions

* Fix typo

* Add userActivated flag to user store

* Add E2E test

* Fix linting issue

* Update pnpm-lock

* Revert unnecessary change

* Centralize user's settings update

* Remove unused ref in userActivationSurvey modal

* Use aliased imports

* Use createEventBus function in component

* Fix tests
This commit is contained in:
Ricardo Espinoza
2023-04-11 12:43:47 -04:00
committed by GitHub
parent 7119bde029
commit 725393dae6
30 changed files with 548 additions and 19 deletions

View File

@@ -0,0 +1,61 @@
import { WorkflowPage, NDV, MainSidebar, UserActivationSurveyModal } from '../pages';
import SettingsWithActivationModalEnabled from '../fixtures/Settings_user_activation_modal_enabled.json';
import { v4 as uuid } from 'uuid';
const workflowPage = new WorkflowPage();
const ndv = new NDV();
const mainSidebar = new MainSidebar();
const userActivationSurveyModal = new UserActivationSurveyModal();
const BASE_WEBHOOK_URL = 'http://localhost:5678/webhook';
describe('User activation survey', () => {
it('Should show activation survey', () => {
cy.resetAll();
cy.skipSetup();
cy.intercept('GET', '/rest/settings',(req) => {
req.reply(SettingsWithActivationModalEnabled);
});
const path = uuid();
const method = 'GET';
workflowPage.actions.addInitialNodeToCanvas('Webhook');
workflowPage.actions.openNode('Webhook');
//input http method
cy.getByTestId('parameter-input-httpMethod').click();
cy.getByTestId('parameter-input-httpMethod')
.find('.el-select-dropdown')
.find('.option-headline')
.contains(method)
.click();
//input path method
cy.getByTestId('parameter-input-path')
.find('.parameter-input')
.find('input')
.clear()
.type(path);
ndv.actions.close();
workflowPage.actions.saveWorkflowOnButtonClick();
workflowPage.actions.activateWorkflow();
cy.request(method, `${BASE_WEBHOOK_URL}/${path}`).then((response) => {
expect(response.status).to.eq(200);
cy.visit('/');
cy.reload();
mainSidebar.actions.goToCredentials();
userActivationSurveyModal.getters.modalContainer().should('be.visible');
userActivationSurveyModal.getters.feedbackInput().type('testing');
userActivationSurveyModal.getters.sendFeedbackButton().click();
});
});
});

View File

@@ -0,0 +1,90 @@
{
"data": {
"endpointWebhook": "webhook",
"endpointWebhookTest": "webhook-test",
"saveDataErrorExecution": "all",
"saveDataSuccessExecution": "all",
"saveManualExecutions": false,
"executionTimeout": -1,
"maxExecutionTimeout": 3600,
"workflowCallerPolicyDefaultOption": "workflowsFromSameOwner",
"timezone": "America/New_York",
"urlBaseWebhook": "http://localhost:5678/",
"urlBaseEditor": "http://localhost:5678",
"versionCli": "0.221.2",
"oauthCallbackUrls": {
"oauth1": "http://localhost:5678/rest/oauth1-credential/callback",
"oauth2": "http://localhost:5678/rest/oauth2-credential/callback"
},
"versionNotifications": {
"enabled": true,
"endpoint": "https://api.n8n.io/api/versions/",
"infoUrl": "https://docs.n8n.io/getting-started/installation/updating.html"
},
"instanceId": "c229842c6d1e217486d04caf7223758e08385156ca87a58286c850760c7161f4",
"telemetry": {
"enabled": true
},
"posthog": {
"enabled": false,
"apiHost": "https://ph.n8n.io",
"apiKey": "phc_4URIAm1uYfJO7j8kWSe0J8lc8IqnstRLS7Jx8NcakHo",
"autocapture": false,
"disableSessionRecording": true,
"debug": false
},
"personalizationSurveyEnabled": false,
"userActivationSurveyEnabled": true,
"defaultLocale": "en",
"userManagement": {
"enabled": true,
"showSetupOnFirstLoad": false,
"smtpSetup": false
},
"sso": {
"saml": {
"loginEnabled": false,
"loginLabel": ""
},
"ldap": {
"loginEnabled": false,
"loginLabel": ""
}
},
"publicApi": {
"enabled": false,
"latestVersion": 1,
"path": "api",
"swaggerUi": {
"enabled": true
}
},
"workflowTagsDisabled": false,
"logLevel": "info",
"hiringBannerEnabled": true,
"templates": {
"enabled": true,
"host": "https://api.n8n.io/api/"
},
"onboardingCallPromptEnabled": true,
"executionMode": "regular",
"pushBackend": "sse",
"communityNodesEnabled": true,
"deployment": {
"type": "default"
},
"isNpmAvailable": false,
"allowedModules": {},
"enterprise": {
"sharing": true,
"ldap": true,
"saml": false,
"logStreaming": false,
"advancedExecutionFilters": false
},
"hideUsagePage": false,
"license": {
"environment": "production"
}
}
}

View File

@@ -1,3 +1,5 @@
export * from './credentials-modal';
export * from './message-box';
export * from './workflow-sharing-modal';
export * from './user-activation-survey-modal';

View File

@@ -0,0 +1,9 @@
import { BasePage } from './../base';
export class UserActivationSurveyModal extends BasePage {
getters = {
modalContainer: () => cy.getByTestId('userActivationSurvey-modal').last(),
feedbackInput: () => cy.getByTestId('activation-feedback-input').find('textarea'),
sendFeedbackButton: () => cy.getByTestId('send-activation-feedback-button'),
};
}