feat: refs #8422 add testDmsAction command to handle create and delete actions with improved logic
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Jose Antonio Tubau 2025-04-14 12:27:15 +02:00
parent be877fa2b8
commit b26be0bf6d
1 changed files with 10 additions and 4 deletions

View File

@ -641,13 +641,19 @@ Cypress.Commands.add(
Cypress.Commands.add('testDmsAction', (action, selectors, data, message, content) => { Cypress.Commands.add('testDmsAction', (action, selectors, data, message, content) => {
cy.get(selectors.actionBtn).click(); cy.get(selectors.actionBtn).click();
if (action !== 'delete') cy.fillInForm(data);
if (action === 'create') if (action === 'create') {
cy.dataCy(selectors.fileInput).selectFile('test/cypress/fixtures/image.jpg', { cy.dataCy(selectors.fileInput).selectFile('test/cypress/fixtures/image.jpg', {
force: true, force: true,
}); });
if (action === 'delete') cy.clickConfirm(); }
if (action !== 'delete') cy.dataCy(selectors.saveFormBtn).click();
if (action !== 'delete') {
cy.fillInForm(data);
cy.dataCy(selectors.saveFormBtn).click();
} else cy.clickConfirm();
cy.checkNotification(message); cy.checkNotification(message);
if (action !== 'create') cy.containContent(selectors.selectorContentToCheck, content); if (action !== 'create') cy.containContent(selectors.selectorContentToCheck, content);
}); });