salix/e2e/paths/item-module/07_create_item_barcode.spec.js

35 lines
1.3 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Item Create barcodes path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('buyer', 'item')
.accessToSearchResult('Object1 Gem1 5')
.accessToSection('item.card.itemBarcode');
});
it(`should click create a new code and delete a former one`, async() => {
const result = await nightmare
.waitToClick(selectors.itemBarcodes.firstCodeRemoveButton)
.waitToClick(selectors.itemBarcodes.addBarcodeButton)
.write(selectors.itemBarcodes.thirdCodeInput, '5')
.waitToClick(selectors.itemBarcodes.submitBarcodesButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, async() => {
const result = await nightmare
.waitToClick(selectors.itemBasicData.basicDataButton)
.waitToClick(selectors.itemBarcodes.barcodeButton)
.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5')
.waitToGetProperty(selectors.itemBarcodes.thirdCodeInput, 'value');
expect(result).toEqual('5');
});
});