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

30 lines
1.2 KiB
JavaScript

/// <reference types="cypress" />
describe('Item shelving', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/list`);
cy.typeSearchbar('1{enter}');
});
it('should throw an error if the barcode exists', () => {
cy.get('[href="#/item/1/barcode"]').click();
cy.get('.q-card > .q-btn > .q-btn__content > .q-icon').click();
cy.get(
':nth-child(4) > div.full-width > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Code_input"]'
).type('1111111111');
cy.dataCy('crudModelDefaultSaveBtn').click();
cy.checkNotification('Codes can not be repeated');
});
it('should create a new barcode', () => {
cy.get('[href="#/item/1/barcode"]').click();
cy.get('.q-card > .q-btn > .q-btn__content > .q-icon').click();
cy.get(
':nth-child(4) > div.full-width > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Code_input"]'
).type('1231231231');
cy.dataCy('crudModelDefaultSaveBtn').click();
cy.checkNotification('Data saved');
});
});