import '../commands.js'; describe('EntryNotes', () => { beforeEach(() => { cy.viewport(1920, 1080); cy.login('buyer'); cy.visit(`/#/entry/list`); }); const createObservation = (type, description) => { cy.dataCy('vnTableCreateBtn').click(); cy.dataCy('Observation type_select').eq(1).should('be.visible').type(type); cy.get('div[role="listbox"] > div > div[role="option"]').eq(0).click(); cy.dataCy('Description_input').should('be.visible').type(description); cy.dataCy('FormModelPopup_save').should('be.enabled').click(); }; const editObservation = (rowIndex, type, description) => { cy.get(`td[data-col-field="description"][data-row-index="${rowIndex}"]`) .click() .clear() .type(description); cy.get(`td[data-col-field="observationTypeFk"][data-row-index="${rowIndex}"]`) .click() .clear() .type(type); cy.get('div[role="listbox"] > div > div[role="option"]').eq(0).click(); cy.saveCard(); }; it('Create, delete, and edit observations', () => { cy.createEntry(); cy.waitForElement('[data-cy="entry-buys"]'); cy.dataCy('EntryNotes-menu-item').click(); createObservation('Packager', 'test'); cy.get('.q-notification__message').eq(0).should('have.text', 'Data created'); editObservation(0, 'Administrative', 'test2'); createObservation('Administrative', 'test'); cy.get('.q-notification__message') .eq(2) .should('have.text', "The observation type can't be repeated"); cy.dataCy('FormModelPopup_cancel').click(); cy.deleteEntry(); }); });