38 lines
1.4 KiB
JavaScript
38 lines
1.4 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
describe('Item Create barcodes path', () => {
|
|
let browser;
|
|
let page;
|
|
beforeAll(async() => {
|
|
browser = await getBrowser();
|
|
page = browser.page;
|
|
await page.loginAndModule('buyer', 'item');
|
|
await page.accessToSearchResult('Ranged weapon longbow 2m');
|
|
await page.accessToSection('item.card.itemBarcode');
|
|
});
|
|
|
|
afterAll(async() => {
|
|
await browser.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.waitForTextInField(selectors.itemBarcodes.thirdCodeInput, '5');
|
|
const result = await page
|
|
.waitToGetProperty(selectors.itemBarcodes.thirdCodeInput, 'value');
|
|
|
|
expect(result).toEqual('5');
|
|
});
|
|
});
|