2024-06-11 05:45:15 -07:00
|
|
|
import cloneDeep from 'lodash/cloneDeep';
|
|
|
|
import merge from 'lodash/merge';
|
2024-09-18 00:19:33 -07:00
|
|
|
|
2024-06-11 05:45:15 -07:00
|
|
|
import { settings } from './commands';
|
2023-02-03 04:14:59 -08:00
|
|
|
|
2023-05-26 08:15:06 -07:00
|
|
|
before(() => {
|
2024-01-08 01:35:18 -08:00
|
|
|
cy.resetDatabase();
|
2023-07-28 00:51:07 -07:00
|
|
|
|
2024-06-10 06:49:50 -07:00
|
|
|
Cypress.on('uncaught:exception', (error) => {
|
|
|
|
return !error.message.includes('ResizeObserver');
|
2023-07-28 00:51:07 -07:00
|
|
|
});
|
2023-05-26 08:15:06 -07:00
|
|
|
});
|
|
|
|
|
2023-02-03 04:14:59 -08:00
|
|
|
beforeEach(() => {
|
2023-06-22 15:38:12 -07:00
|
|
|
if (!cy.config('disableAutoLogin')) {
|
2024-06-11 05:45:15 -07:00
|
|
|
cy.signinAsOwner();
|
2023-06-22 15:38:12 -07:00
|
|
|
}
|
|
|
|
|
2024-04-11 05:22:33 -07:00
|
|
|
cy.window().then((win): void => {
|
|
|
|
win.localStorage.setItem('N8N_THEME', 'light');
|
2024-08-16 06:30:20 -07:00
|
|
|
win.localStorage.setItem('N8N_AUTOCOMPLETE_ONBOARDED', 'true');
|
|
|
|
win.localStorage.setItem('N8N_MAPPING_ONBOARDED', 'true');
|
2024-04-11 05:22:33 -07:00
|
|
|
});
|
|
|
|
|
2024-06-11 05:45:15 -07:00
|
|
|
cy.intercept('GET', '/rest/settings', (req) => {
|
|
|
|
// Disable cache
|
|
|
|
delete req.headers['if-none-match'];
|
|
|
|
req.on('response', (res) => {
|
|
|
|
const defaultSettings = res.body.data;
|
|
|
|
res.send({ data: merge(cloneDeep(defaultSettings), settings) });
|
|
|
|
});
|
|
|
|
}).as('loadSettings');
|
|
|
|
|
2023-11-03 07:22:37 -07:00
|
|
|
cy.intercept('GET', '/types/nodes.json').as('loadNodeTypes');
|
2023-02-03 04:14:59 -08:00
|
|
|
|
2023-03-10 07:54:54 -08:00
|
|
|
// Always intercept the request to test credentials and return a success
|
|
|
|
cy.intercept('POST', '/rest/credentials/test', {
|
2024-06-11 05:45:15 -07:00
|
|
|
data: { status: 'success', message: 'Tested successfully' },
|
|
|
|
}).as('credentialTest');
|
|
|
|
|
|
|
|
cy.intercept('POST', '/rest/license/renew', {});
|
|
|
|
|
|
|
|
cy.intercept({ pathname: '/api/health' }, { status: 'OK' }).as('healthCheck');
|
|
|
|
cy.intercept({ pathname: '/api/versions/*' }, [
|
|
|
|
{
|
|
|
|
name: '1.45.1',
|
|
|
|
createdAt: '2023-08-18T11:53:12.857Z',
|
|
|
|
hasSecurityIssue: null,
|
|
|
|
hasSecurityFix: null,
|
|
|
|
securityIssueFixVersion: null,
|
|
|
|
hasBreakingChange: null,
|
|
|
|
documentationUrl: 'https://docs.n8n.io/release-notes/#n8n131',
|
|
|
|
nodes: [],
|
|
|
|
description: 'Includes <strong>bug fixes</strong>',
|
2023-05-26 08:15:06 -07:00
|
|
|
},
|
2024-06-11 05:45:15 -07:00
|
|
|
{
|
|
|
|
name: '1.0.5',
|
|
|
|
createdAt: '2023-07-24T10:54:56.097Z',
|
|
|
|
hasSecurityIssue: false,
|
|
|
|
hasSecurityFix: null,
|
|
|
|
securityIssueFixVersion: null,
|
|
|
|
hasBreakingChange: true,
|
|
|
|
documentationUrl: 'https://docs.n8n.io/release-notes/#n8n104',
|
|
|
|
nodes: [],
|
|
|
|
description: 'Includes <strong>core functionality</strong> and <strong>bug fixes</strong>',
|
|
|
|
},
|
|
|
|
]).as('getVersions');
|
2023-05-26 08:15:06 -07:00
|
|
|
});
|