2018-11-14 17:05:24 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
|
2018-11-15 08:30:14 +00:00
|
|
|
describe('Item regularize path', () => {
|
2018-11-14 17:05:24 +00:00
|
|
|
const nightmare = createNightmare();
|
|
|
|
beforeAll(() => {
|
2018-11-20 13:22:00 +00:00
|
|
|
nightmare
|
2018-11-14 17:05:24 +00:00
|
|
|
.waitForLogin('developer');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should access to the items index by clicking the items button', async () => {
|
|
|
|
const url = await nightmare
|
|
|
|
.click(selectors.moduleAccessView.itemsSectionButton)
|
|
|
|
.wait(selectors.itemsIndex.createItemButton)
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/item/index');
|
|
|
|
});
|
|
|
|
|
2018-11-14 17:55:40 +00:00
|
|
|
it('should search for the item Mjolnir', async () => {
|
2018-11-14 17:05:24 +00:00
|
|
|
const resultCount = await nightmare
|
2018-11-21 13:30:32 +00:00
|
|
|
.wait(selectors.itemsIndex.searchItemInput)
|
2018-11-14 17:55:40 +00:00
|
|
|
.type(selectors.itemsIndex.searchItemInput, 'Mjolnir')
|
2018-11-14 17:05:24 +00:00
|
|
|
.click(selectors.itemsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.itemsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(resultCount).toEqual(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should click on the search result to access to the item tax`, async () => {
|
|
|
|
const url = await nightmare
|
2018-11-14 17:55:40 +00:00
|
|
|
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir')
|
2018-11-14 17:05:24 +00:00
|
|
|
.waitToClick(selectors.itemsIndex.searchResult)
|
|
|
|
.waitForURL('/summary')
|
2018-11-22 14:44:33 +00:00
|
|
|
.parsedUrl();
|
2018-11-14 17:05:24 +00:00
|
|
|
|
2018-11-22 14:44:33 +00:00
|
|
|
expect(url.hash).toContain('/summary');
|
2018-11-14 17:05:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should regularize the item', async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.itemDescriptor.moreMenu)
|
|
|
|
.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton)
|
|
|
|
.wait(selectors.itemDescriptor.regularizeQuantityInput)
|
|
|
|
.type(selectors.itemDescriptor.regularizeQuantityInput, 100)
|
|
|
|
.waitToClick(selectors.itemDescriptor.regularizeWarehouseSelect)
|
|
|
|
.waitToClick(selectors.itemDescriptor.regularizeWarehouseSelectSecondOption)
|
|
|
|
.waitToClick(selectors.itemDescriptor.regularizeSaveButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should click on the Tickets button of the top bar menu', async () => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.ticketsButton)
|
2018-11-21 13:30:32 +00:00
|
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
2018-11-14 17:05:24 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
|
|
|
});
|
|
|
|
|
2018-11-15 08:30:14 +00:00
|
|
|
it('should search for the ticket with alias missing', async () => {
|
2018-11-14 17:05:24 +00:00
|
|
|
const result = await nightmare
|
|
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
2018-11-15 08:30:14 +00:00
|
|
|
.type(selectors.ticketsIndex.searchTicketInput, 'missing')
|
2018-11-14 17:05:24 +00:00
|
|
|
.click(selectors.ticketsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.ticketsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should click on the search result to access to the ticket summary`, async () => {
|
|
|
|
const url = await nightmare
|
2018-11-15 08:30:14 +00:00
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Missing')
|
2018-11-14 17:05:24 +00:00
|
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
|
|
.waitForURL('/summary')
|
2018-11-22 14:44:33 +00:00
|
|
|
.parsedUrl();
|
2018-11-14 17:05:24 +00:00
|
|
|
|
2018-11-22 14:44:33 +00:00
|
|
|
expect(url.hash).toContain('/summary');
|
2018-11-14 17:05:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the ticket sale quantity is showing a negative value`, async () => {
|
|
|
|
const result = await nightmare
|
2018-11-14 17:55:40 +00:00
|
|
|
.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100')
|
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
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the ticket sale discount is 100%`, async () => {
|
|
|
|
const result = await nightmare
|
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 %');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should now click on the Items button of the top bar menu', async () => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.itemsButton)
|
2018-11-21 13:30:32 +00:00
|
|
|
.wait(selectors.itemsIndex.searchItemInput)
|
2018-11-14 17:05:24 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/item/index');
|
|
|
|
});
|
|
|
|
|
2018-11-14 17:55:40 +00:00
|
|
|
it('should search for the item Mjolnir once again', async () => {
|
2018-11-14 17:05:24 +00:00
|
|
|
const resultCount = await nightmare
|
2018-11-21 13:30:32 +00:00
|
|
|
.wait(selectors.itemsIndex.searchItemInput)
|
2018-11-14 17:55:40 +00:00
|
|
|
.type(selectors.itemsIndex.searchItemInput, 'Mjolnir')
|
2018-11-14 17:05:24 +00:00
|
|
|
.click(selectors.itemsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.itemsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(resultCount).toEqual(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should click on the search result to access to the item tax`, async () => {
|
|
|
|
const url = await nightmare
|
2018-11-14 17:55:40 +00:00
|
|
|
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir')
|
2018-11-14 17:05:24 +00:00
|
|
|
.waitToClick(selectors.itemsIndex.searchResult)
|
|
|
|
.waitForURL('/summary')
|
2018-11-22 14:44:33 +00:00
|
|
|
.parsedUrl();
|
2018-11-14 17:05:24 +00:00
|
|
|
|
2018-11-22 14:44:33 +00:00
|
|
|
expect(url.hash).toContain('/summary');
|
2018-11-14 17:05:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should regularize the item once more', async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.itemDescriptor.moreMenu)
|
|
|
|
.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton)
|
|
|
|
.wait(selectors.itemDescriptor.regularizeQuantityInput)
|
|
|
|
.type(selectors.itemDescriptor.regularizeQuantityInput, 100)
|
|
|
|
.waitToClick(selectors.itemDescriptor.regularizeWarehouseSelect)
|
|
|
|
.waitToClick(selectors.itemDescriptor.regularizeWarehouseSelectSecondOption)
|
|
|
|
.waitToClick(selectors.itemDescriptor.regularizeSaveButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should again click on the Tickets button of the top bar menu', async () => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.ticketsButton)
|
2018-11-21 13:30:32 +00:00
|
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
2018-11-14 17:05:24 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search for the ticket with id 22 once again', async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
|
|
|
.type(selectors.ticketsIndex.searchTicketInput, 'id:22')
|
|
|
|
.click(selectors.ticketsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.ticketsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should now click on the search result to access to the ticket summary`, async () => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, '22')
|
|
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
|
|
.waitForURL('/summary')
|
2018-11-22 14:44:33 +00:00
|
|
|
.parsedUrl();
|
2018-11-14 17:05:24 +00:00
|
|
|
|
2018-11-22 14:44:33 +00:00
|
|
|
expect(url.hash).toContain('/summary');
|
2018-11-14 17:05:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the ticket contains now two sales`, async () => {
|
|
|
|
const result = await nightmare
|
2018-11-14 17:55:40 +00:00
|
|
|
.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100')
|
2018-11-14 17:05:24 +00:00
|
|
|
.countElement(selectors.ticketSummary.sale);
|
|
|
|
|
|
|
|
expect(result).toEqual(2);
|
|
|
|
});
|
|
|
|
});
|