diff --git a/test/cypress/cypress/integration/step-definitions/management/decoders/the-user-creates-a-new-decoder-when.js b/test/cypress/cypress/integration/step-definitions/management/decoders/the-user-creates-a-new-decoder-when.js
index b40b5bcda0..0990c0201c 100644
--- a/test/cypress/cypress/integration/step-definitions/management/decoders/the-user-creates-a-new-decoder-when.js
+++ b/test/cypress/cypress/integration/step-definitions/management/decoders/the-user-creates-a-new-decoder-when.js
@@ -1,12 +1,12 @@
import { When } from 'cypress-cucumber-preprocessor/steps';
-import { fillField, elementIsVisible, getSelector } from '../../../utils/driver';
+import { fillField, elementIsVisible, getSelector, generateRandomName } from '../../../utils/driver';
import { DECODERS_PAGE as pageName} from '../../../utils/pages-constants';
const decoderTitleSelector = getSelector('decoderTitleSelector', pageName);
const codeEditorSelector = getSelector('codeEditorSelector', pageName);
-const testXmlText = '^{\s*"JSON_Decoder';
+const testXmlText = '^wazuh2: ';
When('The user writes a new decoder', () => {
elementIsVisible(decoderTitleSelector);
- fillField(decoderTitleSelector,'Test');
+ fillField(decoderTitleSelector,generateRandomName());
fillField(codeEditorSelector,testXmlText);
-})
+});
\ No newline at end of file
diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/the-user-writes-a-new-rule-when.js b/test/cypress/cypress/integration/step-definitions/management/rules/the-user-writes-a-new-rule-when.js
index aa57cf936a..93fa5435a9 100644
--- a/test/cypress/cypress/integration/step-definitions/management/rules/the-user-writes-a-new-rule-when.js
+++ b/test/cypress/cypress/integration/step-definitions/management/rules/the-user-writes-a-new-rule-when.js
@@ -1,12 +1,13 @@
import { When } from 'cypress-cucumber-preprocessor/steps';
-import { elementIsVisible, getSelector, fillField } from '../../../utils/driver';
+import { elementIsVisible, getSelector, fillField, generateRandomName } from '../../../utils/driver';
import { RULES_PAGE as pageName} from '../../../utils/pages-constants';
const codeEditorSelector = getSelector('codeEditorSelector', pageName);
const rulesTitleSelector = getSelector('rulesTitleSelector', pageName);
+const testXmlText = ' windows Generic template for all windows rules.';
When('The user writes a new rule', () => {
elementIsVisible(rulesTitleSelector);
- fillField(rulesTitleSelector,'Test')
+ fillField(rulesTitleSelector,generateRandomName())
elementIsVisible(codeEditorSelector);
- fillField(codeEditorSelector,'Test');
+ fillField(codeEditorSelector,testXmlText);
});
diff --git a/test/cypress/cypress/integration/utils/driver.js b/test/cypress/cypress/integration/utils/driver.js
index 5a1a1ea7eb..24513df0a0 100644
--- a/test/cypress/cypress/integration/utils/driver.js
+++ b/test/cypress/cypress/integration/utils/driver.js
@@ -117,6 +117,12 @@ export const xpathElementIsVisible = (xpathSelector) => {
return getElementByXpath(xpathSelector).should('exist').should('be.visible');
};
+export const generateRandomName = () => {
+ const uniqueSeed = Date.now().toString();
+ const getUniqueId = () => Cypress._.uniqueId(uniqueSeed);
+ return 'Test-'+getUniqueId();
+};
+
export const timestampToDate = (e) => {
let newDates = e.getDate() + "/" + (e.getMonth() + 1) + "/" + e.getFullYear() + " " + e.getHours() + ":" + e.getMinutes() + ":" + e.getSeconds();
return newDates;