#1351 e2e order.catalog + extensions refactor

This commit is contained in:
Carlos Jimenez Ruiz 2019-05-02 11:23:54 +02:00
parent 0dbed4e102
commit 8bfcdf435f
10 changed files with 270 additions and 112 deletions

View File

@ -114,7 +114,7 @@ UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 8;
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 4 WHERE `id` = 23;
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 10;
UPDATE `vn`.`agencyMode` SET `web` = 1 WHERE `id` = 1;
UPDATE `vn`.`agencyMode` SET `web` = 1;
UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23;
@ -594,13 +594,20 @@ INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`)
INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `isOnOffer`, `expenceFk`, `isBargain`, `comment`, `relevancy`, `image`, `taxClassFk`, `subName`)
VALUES
(1 , 2, 70, 'AMA', 1 , 1, 'One of the infinity gems', 1, 06021010, 0, 2000000000, 0, NULL, 0, 66540, 1, NULL),
(2 , 2, 70, 'AZL', 1 , 2, 'One of the infinity gems', 1, 06021010, 0, 2000000000, 0, NULL, 0, 65540, 1, NULL),
(3 , 1, 60, 'AMR', 1 , 3, 'Rhodeys armor', 1, 05080000, 0, 4751000000, 0, NULL, 0, 61692, 1, NULL),
(4 , 1, 60, 'AMR', 1 , 1, 'Iron Mans first armor', 1, 05080000, 1, 4751000000, 0, NULL, 0, 66090, 2, NULL),
(5 , 3, 30, 'GRE', 1 , 2, 'Thors hammer!', 2, 06021010, 1, 4751000000, 0, NULL, 0, 67350, 2, NULL),
(1, 2, 70, 'AMA', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 66540, 1, NULL),
(2, 2, 70, 'AZL', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 65540, 1, NULL),
(3, 1, 60, 'AMR', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, 61692, 1, NULL),
(4, 1, 60, 'AMR', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, 66090, 2, NULL),
(5, 3, 30, 'GRE', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, 67350, 2, NULL),
(6, 5, 30, 'GRE', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
(7, 5, 90, 'AZL', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
(8, 2, 70, 'AMA', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 66540, 1, NULL),
(9, 2, 70, 'AZL', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 65540, 1, NULL),
(10, 1, 60, 'AMR', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, 61692, 1, NULL),
(11, 1, 60, 'AMR', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, 66090, 2, NULL),
(12, 3, 30, 'GRE', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, 67350, 2, NULL),
(13, 5, 30, 'GRE', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
(14, 5, 90, 'AZL', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
(71, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 1, 4751000000, 0, NULL, 0, NULL, 2, NULL);
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `checked`, `workerFk`)
@ -826,7 +833,7 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
(3 , 1, 27, '2m', 3),
(4 , 1, 36, 'Stark Industries', 4),
(5 , 1, 1, 'Brown', 5),
(6 , 1, 67, 'precission', 6),
(6 , 1, 67, '+1 precission', 6),
(7 , 1, 23, '1', 7),
(8 , 2, 56, 'Melee weapon', 1),
(9 , 2, 58, 'combat fist', 2),
@ -870,7 +877,56 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
(47, 7, 1, 'White', 5),
(48, 7, 67, 'supply', 6),
(49, 7, 23, '1', 7),
(50, 71, 92, 'Shipping cost', 2);
(50, 8, 56, 'Ranged Reinforced weapon', 1),
(51, 8, 58, '+1 longbow', 2),
(52, 8, 27, '2m', 3),
(53, 8, 36, 'Stark Industries', 4),
(54, 8, 1, 'Brown', 5),
(55, 8, 67, 'precission', 6),
(56, 8, 23, '1', 7),
(57, 9, 56, 'Melee Reinforced weapon', 1),
(58, 9, 58, 'combat fist', 2),
(59, 9, 27, '15cm', 3),
(60, 9, 36, 'Stark Industries', 4),
(61, 9, 1, 'Silver', 5),
(62, 9, 67, 'concussion', 6),
(63, 9, 23, '1', 7),
(64, 10, 56, 'Ranged Reinforced weapon', 1),
(65, 10, 58, 'sniper rifle', 2),
(66, 10, 4, '300mm', 3),
(67, 10, 36, 'Stark Industries', 4),
(68, 10, 1, 'Green', 5),
(69, 10, 67, 'precission', 6),
(70, 10, 23, '1', 7),
(71, 11, 56, 'Melee Reinforced weapon', 1),
(72, 11, 58, 'heavy shield', 2),
(73, 11, 4, '1x0.5m', 3),
(74, 11, 36, 'Stark Industries', 4),
(75, 11, 1, 'Black', 5),
(76, 11, 67, 'containtment', 6),
(77, 11, 23, '1', 7),
(78, 12, 56, 'Ranged Reinforced weapon', 1),
(79, 12, 58, 'pistol', 2),
(80, 12, 27, '9mm', 3),
(81, 12, 36, 'Stark Industries', 4),
(82, 12, 1, 'Silver', 5),
(83, 12, 67, 'rapid fire', 6),
(84, 12, 23, '1', 7),
(85, 13, 56, 'Chest', 1),
(86, 13, 58, 'ammo box', 2),
(87, 13, 27, '1m', 3),
(88, 13, 36, 'Stark Industries', 4),
(89, 13, 1, 'Green', 5),
(90, 13, 67, 'supply', 6),
(91, 13, 23, '1', 7),
(92, 14, 56, 'Chest', 1),
(93, 14, 58, 'medical box', 2),
(94, 14, 27, '1m', 3),
(95, 14, 36, 'Stark Industries', 4),
(96, 14, 1, 'White', 5),
(97, 14, 67, 'supply', 6),
(98, 14, 23, '1', 7),
(99, 71, 92, 'Shipping cost', 2);
INSERT INTO `vn`.`itemTypeTag`(`id`, `itemTypeFk`, `tagFk`, `priority`)
VALUES
@ -983,7 +1039,9 @@ INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`package
(3, 3, 1, 20 , 100 , 1, 1, 0.700, 0.020, 0.000, 1, 1, 0, NULL, 0.00, 2.50, 2.00, 0.50, NULL, 0, 1, 0, CURDATE()),
(4, 2, 2, 5 , 450 , 1, 1, 0.500, 0.100, 0.000, 10, 10, 0, NULL, 0.00, 1.30, 1.00, 0.00, NULL, 0, 1, 0, CURDATE()),
(5, 3, 3, 10 , 500 , 1, 1, 1.000, 0.050, 0.000, 10, 10, 0, NULL, 0.00, 2.50, 1.00, 0.00, NULL, 0, 1, 0, CURDATE()),
(6, 4, 4, 20 , 100 , 1, 1, 0.700, 0.020, 0.000, 10, 10, 1, NULL, 0.00, 2.50, 1.00, 0.00, NULL, 0, 1, 0, CURDATE());
(6, 4, 8, 20 , 1000 , 1, 1, 0.700, 0.020, 0.000, 10, 10, 1, NULL, 0.00, 2.50, 1.00, 0.00, NULL, 0, 1, 0, CURDATE()),
(7, 4, 9, 20 , 1000 , 1, 1, 0.700, 0.020, 0.000, 10, 10, 1, NULL, 0.00, 2.50, 1.00, 0.00, NULL, 0, 1, 0, CURDATE()),
(8, 4, 4, 20 , 1000 , 1, 1, 0.700, 0.020, 0.000, 10, 10, 1, NULL, 0.00, 2.50, 1.00, 0.00, NULL, 0, 1, 0, CURDATE());
INSERT INTO `vn2008`.`tblContadores`(`id`,`FechaInventario`)
VALUES

View File

@ -407,7 +407,7 @@ let actions = {
});
},
datePicker: function(datePickerSelector, changeMonth, done) {
datePicker: function(datePickerSelector, changeMonth, day, done) {
this.wait(datePickerSelector)
.mousedown(datePickerSelector)
.wait('div.flatpickr-calendar.open');
@ -418,7 +418,14 @@ let actions = {
if (changeMonth < 0)
this.mousedown('body > div.flatpickr-calendar.open > div.flatpickr-months > span.flatpickr-prev-month > svg');
const daySelector = 'div.flatpickr-calendar.open span.flatpickr-day:nth-child(16)';
let daySelector;
if (!day)
daySelector = 'div.flatpickr-calendar.open span.flatpickr-day:nth-child(16)';
if (day)
daySelector = `span.flatpickr-day[aria-label~="${day},"]:not(.prevMonthDay):not(.nextMonthDay)`;
this.wait(selector => {
return document.querySelector(selector);

View File

@ -522,12 +522,22 @@ export default {
clientAutocomplete: 'vn-autocomplete[label="Client"]',
addressAutocomplete: 'vn-autocomplete[label="Address"]',
agencyAutocomplete: 'vn-autocomplete[label="Agency"]',
landedDatePicker: 'vn-date-picker[label="Landed"]',
landedDatePicker: 'vn-date-picker[label="Landed"] input',
createButton: `${components.vnSubmit}`,
cancelButton: 'vn-button[href="#!/client/index"]'
},
orderCatalog: {
orderByAutocomplete: 'vn-autocomplete[label="Order by"]',
plantRealmButton: 'vn-order-catalog > vn-side-menu vn-icon[icon="icon-plant"]',
typeAutocomplete: 'vn-autocomplete[data="$ctrl.itemTypes"]',
itemIdInput: 'vn-order-catalog > vn-side-menu vn-catalog-filter vn-textfield[model="$ctrl.itemFk"] input',
itemTagValueInput: 'vn-order-catalog > vn-side-menu vn-catalog-filter vn-textfield[model="$ctrl.value"] input',
openTagSearch: 'vn-order-catalog > vn-side-menu > div > vn-catalog-filter > div > vn-vertical > vn-textfield[model="$ctrl.value"] > div > div > div.rightIcons > t-right-icons > i',
tagAutocomplete: 'vn-order-catalog > vn-side-menu vn-catalog-filter vn-popover vn-order-catalog-search-panel vn-autocomplete[field="filter.tagFk"]',
tagValueInput: 'vn-order-catalog > vn-side-menu vn-catalog-filter vn-popover vn-order-catalog-search-panel vn-textfield[model="filter.value"] input',
searchTagButton: 'vn-order-catalog > vn-side-menu vn-catalog-filter vn-popover vn-order-catalog-search-panel > div > form > vn-horizontal:nth-child(3) > vn-submit > input',
thirdFilterRemoveButton: 'vn-order-catalog > vn-side-menu vn-catalog-filter > div > vn-horizontal.chips > vn-chip:nth-child(3) button',
fourthFilterRemoveButton: 'vn-order-catalog > vn-side-menu vn-catalog-filter > div > vn-horizontal.chips > vn-chip:nth-child(4) button',
},
orderBasicData: {
clientAutocomplete: 'vn-autocomplete[label="Client"]',

View File

@ -22,7 +22,7 @@ describe('Item Edit basic data path', () => {
const result = await nightmare
.clearInput(selectors.itemBasicData.nameInput)
.write(selectors.itemBasicData.nameInput, 'Rose of Purity')
.autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Crisantemo')
.autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Anthurium')
.autocompleteSearch(selectors.itemBasicData.intrastatAutocomplete, 'Coral y materiales similares')
.clearInput(selectors.itemBasicData.relevancyInput)
.write(selectors.itemBasicData.relevancyInput, '1')
@ -49,7 +49,7 @@ describe('Item Edit basic data path', () => {
const result = await nightmare
.waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value');
expect(result).toEqual('Crisantemo');
expect(result).toEqual('Anthurium');
});
it(`should confirm the item intrastad was edited`, async() => {

View File

@ -70,7 +70,7 @@ describe('Item create tags path', () => {
.waitToGetProperty(selectors.itemTags.sixthRelevancyInput, 'value');
expect(tag).toEqual('Categoria');
expect(value).toEqual('precission');
expect(value).toEqual('+1 precission');
expect(relevancy).toEqual('6');
});
});

View File

@ -22,7 +22,7 @@ describe('Ticket create path', () => {
const result = await nightmare
.autocompleteSearch(selectors.createTicketView.clientAutocomplete, 'Bruce Banner')
.autocompleteSearch(selectors.createTicketView.addressAutocomplete, 'Bruce Banner')
.datePicker(selectors.createTicketView.deliveryDateInput, 1)
.datePicker(selectors.createTicketView.deliveryDateInput, 1, null)
.autocompleteSearch(selectors.createTicketView.warehouseAutocomplete, 'Warehouse One')
.autocompleteSearch(selectors.createTicketView.agencyAutocomplete, 'inhouse pickup')
.waitToClick(selectors.createTicketView.createButton)

View File

@ -0,0 +1,83 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Order catalog', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('employee', 'order');
});
it('should open the create new order form', async() => {
const url = await nightmare
.waitToClick(selectors.ordersIndex.createOrderButton)
.waitForURL('order/create')
.parsedUrl();
expect(url.hash).toContain('order/create');
});
it('should create a new order', async() => {
let today = new Date().getDate();
const url = await nightmare
.autocompleteSearch(selectors.createOrderView.clientAutocomplete, 'Tony Stark')
.datePicker(selectors.createOrderView.landedDatePicker, 0, today)
.autocompleteSearch(selectors.createOrderView.agencyAutocomplete, 'Silla247')
.waitToClick(selectors.createOrderView.createButton)
.waitForURL('/catalog')
.parsedUrl();
expect(url.hash).toContain('/catalog');
});
it('should add the realm and type filters and obtain results', async() => {
const result = await nightmare
.waitToClick(selectors.orderCatalog.plantRealmButton)
.autocompleteSearch(selectors.orderCatalog.typeAutocomplete, 'Anthurium')
.waitForNumberOfElements('section.product', 4)
.countElement('section.product');
expect(result).toEqual(4);
});
it('should search for the item tag value +1 and find two results', async() => {
const result = await nightmare
.write(selectors.orderCatalog.itemTagValueInput, '+1\u000d')
.waitForNumberOfElements('section.product', 2)
.countElement('section.product');
expect(result).toEqual(2);
});
it('should search for the item tag categoria +1 and find two results', async() => {
const result = await nightmare
.waitToClick(selectors.orderCatalog.openTagSearch)
.autocompleteSearch(selectors.orderCatalog.tagAutocomplete, 'categoria')
.write(selectors.orderCatalog.tagValueInput, '+1')
.waitToClick(selectors.orderCatalog.searchTagButton)
.waitForNumberOfElements('section.product', 1)
.countElement('section.product');
expect(result).toEqual(1);
});
it('should remove the tag filters and have 4 results', async() => {
const result = await nightmare
.waitToClick(selectors.orderCatalog.fourthFilterRemoveButton)
.waitToClick(selectors.orderCatalog.thirdFilterRemoveButton)
.waitForNumberOfElements('section.product', 4)
.countElement('section.product');
expect(result).toEqual(4);
});
it('should search for the item id 1 and have only 1 result', async() => {
const result = await nightmare
.write(selectors.orderCatalog.itemIdInput, '2\u000d')
.waitForNumberOfElements('section.product', 1)
.countElement('section.product');
expect(result).toEqual(1);
});
});

View File

@ -48,7 +48,7 @@ describe('Route create path', () => {
it(`should create a new route`, async() => {
const result = await nightmare
.autocompleteSearch(selectors.createRouteView.workerAutocomplete, 'teamManagerNick')
.datePicker(selectors.createRouteView.createdDatePicker, 0)
.datePicker(selectors.createRouteView.createdDatePicker, 0, null)
.autocompleteSearch(selectors.createRouteView.vehicleAutoComplete, '4444-IMK')
.autocompleteSearch(selectors.createRouteView.agencyAutoComplete, 'Teleportation device')
.write(selectors.createRouteView.descriptionInput, 'faster faster!!')

View File

@ -15,13 +15,13 @@ describe('Route basic Data path', () => {
const result = await nightmare
.autocompleteSearch(selectors.routeBasicData.workerAutoComplete, 'adminBossNick')
.autocompleteSearch(selectors.routeBasicData.vehicleAutoComplete, '1111-IMK')
.datePicker(selectors.routeBasicData.createdDateInput, 1)
.datePicker(selectors.routeBasicData.createdDateInput, 1, null)
.clearInput(selectors.routeBasicData.kmStartInput)
.write(selectors.routeBasicData.kmStartInput, 1)
.clearInput(selectors.routeBasicData.kmEndInput)
.write(selectors.routeBasicData.kmEndInput, 2)
.datePicker(selectors.routeBasicData.startedDateInput, 1)
.datePicker(selectors.routeBasicData.finishedDateInput, 1)
.datePicker(selectors.routeBasicData.startedDateInput, 1, null)
.datePicker(selectors.routeBasicData.finishedDateInput, 1, null)
.waitToClick(selectors.routeBasicData.saveButton)
.waitForLastSnackbar();