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

38 lines
1.4 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2018-11-20 13:22:00 +00:00
describe('Item Create barcodes path', () => {
let browser;
2020-01-09 12:07:16 +00:00
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
2020-01-09 12:07:16 +00:00
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Ranged weapon longbow 2m');
await page.accessToSection('item.card.itemBarcode');
});
2020-01-09 12:07:16 +00:00
afterAll(async() => {
await browser.close();
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() => {
2020-01-09 12:07:16 +00:00
await page.waitToClick(selectors.itemBarcodes.firstCodeRemoveButton);
await page.waitToClick(selectors.itemBarcodes.addBarcodeButton);
2020-02-03 14:55:11 +00:00
await page.write(selectors.itemBarcodes.thirdCode, '5');
2020-01-09 12:07:16 +00:00
await page.waitToClick(selectors.itemBarcodes.submitBarcodesButton);
2020-04-08 09:24:40 +00:00
const message = await page.waitForSnackbar();
2020-10-30 16:09:11 +00:00
expect(message.text).toBe('Data saved!');
2018-11-20 13:22:00 +00:00
});
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() => {
2020-01-09 12:07:16 +00:00
await page.reloadSection('item.card.itemBarcode');
2020-02-03 14:55:11 +00:00
await page.waitForTextInField(selectors.itemBarcodes.thirdCode, '5');
2020-01-09 12:07:16 +00:00
const result = await page
2020-02-03 14:55:11 +00:00
.waitToGetProperty(selectors.itemBarcodes.thirdCode, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('5');
2018-02-20 14:22:24 +00:00
});
});