salix-front/test/cypress/integration/entry/entryDms.spec.js

45 lines
1.5 KiB
JavaScript
Raw Normal View History

2024-07-05 05:36:20 +00:00
describe('EntryDms', () => {
2024-02-13 14:01:24 +00:00
const entryId = 1;
2024-02-15 14:00:30 +00:00
2024-02-13 14:01:24 +00:00
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/entry/${entryId}/dms`);
});
2024-02-15 14:00:30 +00:00
it('should create edit and remove new dms', () => {
cy.addRow();
2024-04-11 10:29:30 +00:00
cy.get('.icon-attach').click();
2024-02-15 14:00:30 +00:00
cy.get('.q-file').selectFile('test/cypress/fixtures/image.jpg', {
force: true,
});
2024-04-11 10:29:30 +00:00
cy.get('tbody > tr').then((value) => {
const u = undefined;
2024-02-15 14:00:30 +00:00
//Create and check if exist new row
let newFileTd = Cypress.$(value).length;
cy.get('.q-btn--standard > .q-btn__content > .block').click();
expect(value).to.have.length(newFileTd++);
2024-04-11 10:29:30 +00:00
const newRowSelector = `tbody > :nth-child(${newFileTd})`;
2024-02-15 14:00:30 +00:00
cy.waitForElement(newRowSelector);
2024-04-11 10:29:30 +00:00
cy.validateRow(newRowSelector, [u, u, u, u, 'ENTRADA ID 1']);
2024-02-15 14:00:30 +00:00
//Edit new dms
2024-04-11 10:29:30 +00:00
const newDescription = 'entry id 1 modified';
const textAreaSelector =
'.q-textarea > .q-field__inner > .q-field__control > .q-field__control-container';
cy.get(
`tbody :nth-child(${newFileTd}) > .text-right > .no-wrap > :nth-child(2) > .q-btn > .q-btn__content > .q-icon`
).click();
2024-02-15 14:00:30 +00:00
2024-04-11 10:29:30 +00:00
cy.get(textAreaSelector).clear();
cy.get(textAreaSelector).type(newDescription);
cy.saveCard();
cy.reload();
2024-02-15 14:00:30 +00:00
2024-04-11 10:29:30 +00:00
cy.validateRow(newRowSelector, [u, u, u, u, newDescription]);
});
2024-02-13 14:01:24 +00:00
});
});