test: better itemBarcode test
gitea/salix-front/pipeline/head Build queued... Details

This commit is contained in:
Alex Moreno 2025-03-05 14:49:34 +01:00
parent b65a5f1076
commit 16d550085f
2 changed files with 10 additions and 10 deletions

View File

@ -94,6 +94,7 @@ const submit = async (rows) => {
icon="add_circle" icon="add_circle"
v-shortcut="'+'" v-shortcut="'+'"
flat flat
data-cy="addBarcode_input"
> >
<QTooltip> <QTooltip>
{{ t('Add barcode') }} {{ t('Add barcode') }}

View File

@ -3,23 +3,22 @@ describe('ItemBarcodes', () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1920, 1080); cy.viewport(1920, 1080);
cy.login('developer'); cy.login('developer');
cy.visit(`/#/item/list`); cy.visit(`/#/item/1/barcode`);
cy.typeSearchbar('1{enter}');
}); });
it('should throw an error if the barcode exists', () => { it('should throw an error if the barcode exists', () => {
cy.get('[href="#/item/1/barcode"]').click(); newBarcode('1111111111');
cy.get('.q-card > .q-btn > .q-btn__content > .q-icon').click();
cy.dataCy('Code_input').eq(3).type('1111111111');
cy.dataCy('crudModelDefaultSaveBtn').click();
cy.checkNotification('Codes can not be repeated'); cy.checkNotification('Codes can not be repeated');
}); });
it('should create a new barcode', () => { it('should create a new barcode', () => {
cy.get('[href="#/item/1/barcode"]').click(); newBarcode('1231231231');
cy.get('.q-card > .q-btn > .q-btn__content > .q-icon').click();
cy.dataCy('Code_input').eq(3).type('1231231231');
cy.dataCy('crudModelDefaultSaveBtn').click();
cy.checkNotification('Data saved'); 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();
}
}); });