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 200cm');
|
||
|
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.thirdCode, '5');
|
||
|
await page.waitToClick(selectors.itemBarcodes.submitBarcodesButton);
|
||
|
const message = await page.waitForSnackbar();
|
||
|
|
||
|
expect(message.text).toContain('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.thirdCode, '5');
|
||
|
const result = await page
|
||
|
.waitToGetProperty(selectors.itemBarcodes.thirdCode, 'value');
|
||
|
|
||
|
expect(result).toEqual('5');
|
||
|
});
|
||
|
});
|