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

37 lines
1.4 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')
.accessToSearchResult('Gem of Time')
.accessToSection('item.card.itemBarcode');
2018-11-20 13:22:00 +00:00
});
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)
.wait(selectors.itemBarcodes.thirdCodeInput)
.type(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!');
});
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
.click(selectors.itemBasicData.basicDataButton)
.wait(selectors.itemBasicData.nameInput)
.click(selectors.itemBarcodes.barcodeButton)
.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
});
});