salix/e2e/paths/04-item-module/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() => {
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);
await page.write(selectors.itemBarcodes.thirdCodeInput, '5');
await page.waitToClick(selectors.itemBarcodes.submitBarcodesButton);
const result = await page.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() => {
2020-01-09 12:07:16 +00:00
await page.reloadSection('item.card.itemBarcode');
await page.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5');
const result = await page
.waitToGetProperty(`${selectors.itemBarcodes.thirdCodeInput} input`, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('5');
2018-02-20 14:22:24 +00:00
});
});