salix-front/test/cypress/integration/item/itemBarcodes.spec.js

25 lines
708 B
JavaScript

/// <reference types="cypress" />
describe('ItemBarcodes', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/1/barcode`);
});
it('should throw an error if the barcode exists', () => {
newBarcode('1111111111');
cy.checkNotification('Codes can not be repeated');
});
it('should create a new barcode', () => {
newBarcode('1231231231');
cy.checkNotification('Data saved');
});
function newBarcode(text) {
cy.dataCy('addBarcode_input').click();
cy.dataCy('Code_input').eq(3).should('exist').type(text);
cy.dataCy('crudModelDefaultSaveBtn').click();
}
});