2018-11-14 17:05:24 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-14 08:24:09 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2018-11-14 17:05:24 +00:00
|
|
|
|
2019-04-29 11:22:32 +00:00
|
|
|
describe('Item regularize 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('employee', 'item');
|
2018-11-14 17:05:24 +00:00
|
|
|
});
|
|
|
|
|
2020-01-09 12:07:16 +00:00
|
|
|
afterAll(async() => {
|
2020-01-16 12:40:51 +00:00
|
|
|
await browser.close();
|
2020-01-09 12:07:16 +00:00
|
|
|
});
|
2019-02-07 14:02:22 +00:00
|
|
|
|
|
|
|
it('should edit the user local warehouse', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitForSpinnerLoad();
|
|
|
|
await page.waitToClick(selectors.globalItems.userMenuButton);
|
|
|
|
await page.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four');
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-02-07 14:02:22 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
2020-01-16 12:40:51 +00:00
|
|
|
it('should check the local settings were saved', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const userLocalWarehouse = await page
|
2020-01-29 13:54:07 +00:00
|
|
|
.waitToGetProperty(selectors.globalItems.userLocalWarehouse, 'value');
|
2019-02-07 14:02:22 +00:00
|
|
|
|
2020-02-12 13:36:05 +00:00
|
|
|
await page.closePopup();
|
2020-01-16 12:40:51 +00:00
|
|
|
|
2019-02-07 14:02:22 +00:00
|
|
|
expect(userLocalWarehouse).toContain('Warehouse Four');
|
|
|
|
});
|
|
|
|
|
2020-01-09 12:07:16 +00:00
|
|
|
it('should search for an specific item', async() => {
|
2020-03-17 13:01:25 +00:00
|
|
|
await page.accessToSearchResult('Ranged weapon pistol 9mm');
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('item.card.summary');
|
2018-11-14 17:05:24 +00:00
|
|
|
});
|
|
|
|
|
2019-02-07 14:02:22 +00:00
|
|
|
it('should open the regularize dialog and check the warehouse matches the local user settings', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemDescriptor.moreMenu);
|
|
|
|
await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton);
|
2020-02-03 14:55:11 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.itemDescriptor.regularizeWarehouse, 'value');
|
2019-02-07 14:02:22 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Warehouse Four');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should regularize the item', async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.write(selectors.itemDescriptor.regularizeQuantity, '100');
|
|
|
|
await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouse, 'Warehouse One');
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2018-11-14 17:05:24 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should click on the Tickets button of the top bar menu', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
|
|
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
|
|
|
await Promise.all([
|
|
|
|
page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}),
|
|
|
|
page.waitToClick(selectors.globalItems.ticketsButton)
|
|
|
|
]);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.index');
|
2018-11-14 17:05:24 +00:00
|
|
|
});
|
|
|
|
|
2019-12-31 11:00:16 +00:00
|
|
|
it('should clear the user local settings now', async() => {
|
2020-02-25 15:36:29 +00:00
|
|
|
await page.waitForContentLoaded();
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.userMenuButton);
|
|
|
|
await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-02-07 14:02:22 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should search for the ticket with alias missing', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.keyboard.press('Escape');
|
2020-03-17 13:01:25 +00:00
|
|
|
await page.accessToSearchResult('missing');
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.card.summary');
|
2018-11-14 17:05:24 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should check the ticket sale quantity is showing a negative value`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100');
|
|
|
|
const result = await page
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.ticketSummary.firstSaleQuantity, 'innerText');
|
2018-11-14 17:05:24 +00:00
|
|
|
|
2018-11-14 17:55:40 +00:00
|
|
|
expect(result).toContain('-100');
|
2018-11-14 17:05:24 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should check the ticket sale discount is 100%`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const result = await page
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.ticketSummary.firstSaleDiscount, 'innerText');
|
2018-11-14 17:05:24 +00:00
|
|
|
|
|
|
|
expect(result).toContain('100 %');
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should now click on the Items button of the top bar menu', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
|
|
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
|
|
|
await page.waitToClick(selectors.globalItems.itemsButton);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('item.index');
|
2018-11-14 17:05:24 +00:00
|
|
|
});
|
|
|
|
|
2019-01-10 06:26:10 +00:00
|
|
|
it('should search for the item once again', async() => {
|
2020-03-17 13:01:25 +00:00
|
|
|
await page.accessToSearchResult('Ranged weapon pistol 9mm');
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('item.card.summary');
|
2018-11-14 17:05:24 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should regularize the item once more', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemDescriptor.moreMenu);
|
|
|
|
await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton);
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.write(selectors.itemDescriptor.regularizeQuantity, '100');
|
|
|
|
await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouse, 'Warehouse One');
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2018-11-14 17:05:24 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should again click on the Tickets button of the top bar menu', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
|
|
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
|
|
|
await Promise.all([
|
|
|
|
page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}),
|
|
|
|
page.waitToClick(selectors.globalItems.ticketsButton)
|
|
|
|
]);
|
|
|
|
await page.waitForTransitionEnd('vn-searchbar');
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.index');
|
2018-11-14 17:05:24 +00:00
|
|
|
});
|
|
|
|
|
2019-07-01 09:56:16 +00:00
|
|
|
it('should search for the ticket with id 25 once again', async() => {
|
2020-03-17 13:01:25 +00:00
|
|
|
await page.accessToSearchResult('25');
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.card.summary');
|
2018-11-14 17:05:24 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should check the ticket contains now two sales`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100');
|
|
|
|
const result = await page.countElement(selectors.ticketSummary.sale);
|
2018-11-14 17:05:24 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(2);
|
|
|
|
});
|
|
|
|
});
|