2024-06-11 01:23:30 -07:00
|
|
|
|
import { errorToast, successToast } from '../pages/notifications';
|
2023-11-22 03:14:44 -08:00
|
|
|
|
|
|
|
|
|
const INVALID_NAMES = [
|
|
|
|
|
'https://n8n.io',
|
|
|
|
|
'http://n8n.io',
|
|
|
|
|
'www.n8n.io',
|
|
|
|
|
'n8n.io',
|
|
|
|
|
'n8n.бг',
|
|
|
|
|
'n8n.io/home',
|
|
|
|
|
'n8n.io/home?send=true',
|
|
|
|
|
'<a href="#">Jack</a>',
|
|
|
|
|
'<script>alert("Hello")</script>',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const VALID_NAMES = [
|
|
|
|
|
['a', 'a'],
|
|
|
|
|
['alice', 'alice'],
|
|
|
|
|
['Robert', 'Downey Jr.'],
|
|
|
|
|
['Mia', 'Mia-Downey'],
|
|
|
|
|
['Mark', "O'neil"],
|
|
|
|
|
['Thomas', 'Müler'],
|
|
|
|
|
['ßáçøñ', 'ßáçøñ'],
|
|
|
|
|
['أحمد', 'فلسطين'],
|
|
|
|
|
['Милорад', 'Филиповић'],
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
describe('Personal Settings', () => {
|
2024-06-10 06:49:50 -07:00
|
|
|
|
it('should allow to change first and last name', () => {
|
2023-11-22 03:14:44 -08:00
|
|
|
|
cy.visit('/settings/personal');
|
|
|
|
|
VALID_NAMES.forEach((name) => {
|
|
|
|
|
cy.getByTestId('personal-data-form').find('input[name="firstName"]').clear().type(name[0]);
|
|
|
|
|
cy.getByTestId('personal-data-form').find('input[name="lastName"]').clear().type(name[1]);
|
|
|
|
|
cy.getByTestId('save-settings-button').click();
|
2024-06-11 01:23:30 -07:00
|
|
|
|
successToast().should('contain', 'Personal details updated');
|
|
|
|
|
successToast().find('.el-notification__closeBtn').click();
|
2023-11-22 03:14:44 -08:00
|
|
|
|
});
|
|
|
|
|
});
|
2024-08-16 05:51:38 -07:00
|
|
|
|
// eslint-disable-next-line n8n-local-rules/no-skipped-tests
|
2024-08-16 06:30:20 -07:00
|
|
|
|
it('not allow malicious values for personal data', () => {
|
2023-11-22 03:14:44 -08:00
|
|
|
|
cy.visit('/settings/personal');
|
|
|
|
|
INVALID_NAMES.forEach((name) => {
|
|
|
|
|
cy.getByTestId('personal-data-form').find('input[name="firstName"]').clear().type(name);
|
|
|
|
|
cy.getByTestId('personal-data-form').find('input[name="lastName"]').clear().type(name);
|
|
|
|
|
cy.getByTestId('save-settings-button').click();
|
2024-09-20 12:14:06 -07:00
|
|
|
|
errorToast().should('contain', 'Potentially malicious string');
|
2024-06-11 01:23:30 -07:00
|
|
|
|
errorToast().find('.el-notification__closeBtn').click();
|
2023-11-22 03:14:44 -08:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|