salix-front/test/cypress/integration/entry/entryCard/entryLock.spec.js

45 lines
1.3 KiB
JavaScript

import '../commands.js';
describe('EntryLock', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('buyer');
cy.visit(`/#/entry/list`);
});
it('Should notify when entry is lock by another user', () => {
const checkLockMessage = () => {
cy.get('[role="dialog"]').should('be.visible');
cy.get('[data-cy="VnConfirm_message"] > span').should(
'contain.text',
'This entry has been locked by buyerNick',
);
};
cy.createEntry();
goToEntryBuys();
cy.get('.q-notification__message')
.eq(1)
.should('have.text', 'The entry has been locked successfully');
cy.login('logistic');
cy.reload();
checkLockMessage();
cy.get('[data-cy="VnConfirm_cancel"]').click();
cy.url().should('include', 'summary');
goToEntryBuys();
checkLockMessage();
cy.get('[data-cy="VnConfirm_confirm"]').click();
cy.url().should('include', 'buys');
cy.deleteEntry();
function goToEntryBuys() {
const entryBuySelector = 'a[data-cy="EntryBuys-menu-item"]';
cy.get(entryBuySelector).should('be.visible');
cy.waitForElement('[data-cy="entry-buys"]');
cy.get(entryBuySelector).click();
}
});
});