salix/e2e/paths/04-item-module/07_barcode.spec.js

34 lines
1.3 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
2018-11-20 13:22:00 +00:00
describe('Item Create barcodes path', () => {
const nightmare = createNightmare();
2018-11-20 13:22:00 +00:00
beforeAll(() => {
nightmare
.loginAndModule('buyer', 'item')
2019-03-27 07:44:15 +00:00
.accessToSearchResult('Ranged weapon longbow 2m')
.accessToSection('item.card.itemBarcode');
2018-11-20 13:22:00 +00:00
});
2019-01-10 06:26:10 +00:00
it(`should click create a new code and delete a former one`, async() => {
2018-11-20 13:22:00 +00:00
const result = await nightmare
.waitToClick(selectors.itemBarcodes.firstCodeRemoveButton)
.waitToClick(selectors.itemBarcodes.addBarcodeButton)
2019-01-23 14:33:25 +00:00
.write(selectors.itemBarcodes.thirdCodeInput, '5')
.waitToClick(selectors.itemBarcodes.submitBarcodesButton)
2018-11-20 13:22:00 +00:00
.waitForLastSnackbar();
2018-11-20 13:22:00 +00:00
expect(result).toEqual('Data saved!');
});
2019-01-10 06:26:10 +00:00
it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, async() => {
2018-11-20 13:22:00 +00:00
const result = await nightmare
.reloadSection('item.card.itemBarcode')
.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5')
.waitToGetProperty(selectors.itemBarcodes.thirdCodeInput, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('5');
2018-02-20 14:22:24 +00:00
});
});