171 lines
6.8 KiB
JavaScript
171 lines
6.8 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
describe('Item regularize path', () => {
|
|
const nightmare = createNightmare();
|
|
beforeAll(() => {
|
|
nightmare
|
|
.loginAndModule('employee', 'item');
|
|
});
|
|
|
|
it('should search for the item', async() => {
|
|
const resultCount = await nightmare
|
|
.write(selectors.itemsIndex.searchItemInput, 'Object5 Weapon 50')
|
|
.waitToClick(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
|
|
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Object5 Weapon 50')
|
|
.waitToClick(selectors.itemsIndex.searchResult)
|
|
.waitForURL('/summary')
|
|
.parsedUrl();
|
|
|
|
expect(url.hash).toContain('/summary');
|
|
});
|
|
|
|
it('should regularize the item', async() => {
|
|
const result = await nightmare
|
|
.waitToClick(selectors.itemDescriptor.moreMenu)
|
|
.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton)
|
|
.write(selectors.itemDescriptor.regularizeQuantityInput, 100)
|
|
.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One')
|
|
.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)
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
|
.parsedUrl();
|
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
|
});
|
|
|
|
it('should search for the ticket with alias missing', async() => {
|
|
const result = await nightmare
|
|
.write(selectors.ticketsIndex.searchTicketInput, 'missing')
|
|
.waitToClick(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
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Missing')
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
.waitForURL('/summary')
|
|
.parsedUrl();
|
|
|
|
expect(url.hash).toContain('/summary');
|
|
});
|
|
|
|
it(`should check the ticket sale quantity is showing a negative value`, async() => {
|
|
const result = await nightmare
|
|
.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100')
|
|
.waitToGetProperty(selectors.ticketSummary.firstSaleQuantity, 'innerText');
|
|
|
|
expect(result).toContain('-100');
|
|
});
|
|
|
|
it(`should check the ticket sale discount is 100%`, async() => {
|
|
const result = await nightmare
|
|
.waitToGetProperty(selectors.ticketSummary.firstSaleDiscount, 'innerText');
|
|
|
|
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)
|
|
.wait(selectors.itemsIndex.searchItemInput)
|
|
.parsedUrl();
|
|
|
|
expect(url.hash).toEqual('#!/item/index');
|
|
});
|
|
|
|
it('should search for the item once again', async() => {
|
|
const resultCount = await nightmare
|
|
.write(selectors.itemsIndex.searchItemInput, 'Object5 Weapon 50')
|
|
.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
|
|
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Object5 Weapon 50')
|
|
.waitToClick(selectors.itemsIndex.searchResult)
|
|
.waitForURL('/summary')
|
|
.parsedUrl();
|
|
|
|
expect(url.hash).toContain('/summary');
|
|
});
|
|
|
|
it('should regularize the item once more', async() => {
|
|
const result = await nightmare
|
|
.waitToClick(selectors.itemDescriptor.moreMenu)
|
|
.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton)
|
|
.write(selectors.itemDescriptor.regularizeQuantityInput, 100)
|
|
.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One')
|
|
.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)
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
|
.parsedUrl();
|
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
|
});
|
|
|
|
it('should search for the ticket with id 23 once again', async() => {
|
|
const result = await nightmare
|
|
.write(selectors.ticketsIndex.searchTicketInput, 'id:23')
|
|
.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, '23')
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
.waitForURL('/summary')
|
|
.parsedUrl();
|
|
|
|
expect(url.hash).toContain('/summary');
|
|
});
|
|
|
|
it(`should check the ticket contains now two sales`, async() => {
|
|
const result = await nightmare
|
|
.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100')
|
|
.countElement(selectors.ticketSummary.sale);
|
|
|
|
expect(result).toEqual(2);
|
|
});
|
|
});
|