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

36 lines
1.4 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import openPage from '../../helpers/puppeteer';
describe('Item Create barcodes path', () => {
let page;
beforeAll(async() => {
page = await openPage();
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Ranged weapon longbow 2m');
await page.accessToSection('item.card.itemBarcode');
});
afterAll(async() => {
page.close();
});
it(`should click create a new code and delete a former one`, async() => {
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();
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() => {
await page.reloadSection('item.card.itemBarcode');
await page.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5');
const result = await page
.waitToGetProperty(`${selectors.itemBarcodes.thirdCodeInput} input`, 'value');
expect(result).toEqual('5');
});
});