2018-02-15 11:28:05 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-14 08:24:09 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2018-02-15 11:28:05 +00:00
|
|
|
|
2018-11-20 13:22:00 +00:00
|
|
|
describe('Item Create barcodes path', () => {
|
2020-01-14 08:24:09 +00:00
|
|
|
let browser;
|
2020-01-09 12:07:16 +00:00
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
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');
|
|
|
|
});
|
2018-02-15 11:28:05 +00:00
|
|
|
|
2020-01-09 12:07:16 +00:00
|
|
|
afterAll(async() => {
|
2020-01-16 12:40:51 +00:00
|
|
|
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);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2018-02-19 10:55:45 +00:00
|
|
|
|
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');
|
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
|
|
|
});
|
2018-02-15 11:28:05 +00:00
|
|
|
});
|