mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
refactor(editor): User journey link to n8n.io (#10331)
This commit is contained in:
parent
c0e7620036
commit
836178fcaa
35
cypress/e2e/46-n8n.io-iframe.cy.ts
Normal file
35
cypress/e2e/46-n8n.io-iframe.cy.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
import { WorkflowsPage } from '../pages';
|
||||
|
||||
const workflowsPage = new WorkflowsPage();
|
||||
|
||||
describe('n8n.io iframe', () => {
|
||||
describe('when telemetry is disabled', () => {
|
||||
it('should not load the iframe when visiting /home/workflows', () => {
|
||||
cy.overrideSettings({ telemetry: { enabled: false } });
|
||||
|
||||
cy.visit(workflowsPage.url);
|
||||
|
||||
cy.get('iframe').should('not.exist');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when telemetry is enabled', () => {
|
||||
it('should load the iframe when visiting /home/workflows', () => {
|
||||
const testInstanceId = 'test-instance-id';
|
||||
|
||||
cy.overrideSettings({ telemetry: { enabled: true }, instanceId: testInstanceId });
|
||||
|
||||
const testUserId = Cypress.env('currentUserId');
|
||||
|
||||
const iframeUrl = `https://n8n.io/self-install?instanceId=${testInstanceId}&userId=${testUserId}`;
|
||||
|
||||
cy.intercept(iframeUrl, (req) => req.reply(200)).as('iframeRequest');
|
||||
|
||||
cy.visit(workflowsPage.url);
|
||||
|
||||
cy.get('iframe').should('exist').and('have.attr', 'src', iframeUrl);
|
||||
|
||||
cy.wait('@iframeRequest').its('response.statusCode').should('eq', 200);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -59,14 +59,18 @@ Cypress.Commands.add('waitForLoad', (waitForIntercepts = true) => {
|
|||
|
||||
Cypress.Commands.add('signin', ({ email, password }) => {
|
||||
void Cypress.session.clearAllSavedSessions();
|
||||
cy.session([email, password], () =>
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: `${BACKEND_BASE_URL}/rest/login`,
|
||||
body: { email, password },
|
||||
failOnStatusCode: false,
|
||||
}),
|
||||
);
|
||||
cy.session([email, password], () => {
|
||||
return cy
|
||||
.request({
|
||||
method: 'POST',
|
||||
url: `${BACKEND_BASE_URL}/rest/login`,
|
||||
body: { email, password },
|
||||
failOnStatusCode: false,
|
||||
})
|
||||
.then((response) => {
|
||||
Cypress.env('currentUserId', response.body.data.id);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('signinAsOwner', () => cy.signin(INSTANCE_OWNER));
|
||||
|
|
|
@ -34,6 +34,10 @@ const isTelemetryEnabled = computed((): boolean => {
|
|||
return !!telemetry.value?.enabled;
|
||||
});
|
||||
|
||||
const selfInstallSrc = computed((): string => {
|
||||
return `https://n8n.io/self-install?instanceId=${rootStore.instanceId}&userId=${currentUserId.value}`;
|
||||
});
|
||||
|
||||
watch(telemetry, () => {
|
||||
init();
|
||||
});
|
||||
|
@ -70,5 +74,6 @@ function init() {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<span v-show="false" />
|
||||
<iframe v-if="isTelemetryEnabled && currentUserId" v-show="false" :src="selfInstallSrc" />
|
||||
<span v-else v-show="false" />
|
||||
</template>
|
||||
|
|
Loading…
Reference in a new issue