#1976 Implementar Puppeteer

This commit is contained in:
Carlos Jimenez Ruiz 2020-01-09 13:07:16 +01:00
parent 6a0e4bce72
commit 505a491f59
18 changed files with 2738 additions and 2625 deletions

View File

@ -404,11 +404,11 @@ INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`,
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`)
VALUES
(1, 'T', 1014.24, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 101, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1),
(1, 'T', 1014.24, CURDATE(), 101, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
(2, 'T', 121.36, CURDATE(), 102, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
(3, 'T', 8.88, CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
(4, 'T', 8.88, CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
(5, 'A', 8.88, CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1);
(5, 'A', 8.88, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 103, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1);
UPDATE `vn`.`invoiceOut` SET ref = 'T1111111' WHERE id = 1;
UPDATE `vn`.`invoiceOut` SET ref = 'T2222222' WHERE id = 2;

View File

@ -129,12 +129,13 @@ let actions = {
let field = await this.evaluate(selector => {
return document.querySelector(`${selector} input`).closest('.vn-field').$ctrl.field;
}, selector);
if ((field != null && field != '') || field == '0') {
if (field && field.lenght) {
let coords = await this.evaluate(selector => {
let rect = document.querySelector(selector).getBoundingClientRect();
return {x: rect.x + (rect.width / 2), y: rect.y + (rect.height / 2)};
return {x: rect.x + (rect.width / 2), y: rect.y + (rect.height / 2), width: rect.width};
}, selector);
await this.mouse.move(coords.x, coords.y);
await this.waitFor(1000);
await this.waitToClick(`${selector} [icon="clear"]`);
}
},
@ -237,7 +238,7 @@ let actions = {
return await this.wait(selector => {
const imageReady = document.querySelector(selector).complete;
return imageReady;
}, selector);
}, {}, selector);
},
clickIfVisible: async function(selector) {
@ -341,11 +342,6 @@ let actions = {
await this.write('vn-searchbar', searchValue);
await this.waitToClick('vn-searchbar vn-icon[icon="search"]');
await this.waitForNumberOfElements('.search-result', 1);
let result = await this.evaluate(() => {
return document.querySelector('ui-view vn-card vn-table') != null;
});
if (result)
return await this.waitToClick('ui-view vn-card vn-td');
return await this.waitToClick('ui-view vn-card a');
},
@ -445,6 +441,19 @@ let actions = {
return !angular.equals({}, orgData) && orgData != null;
}, {}, selector);
await this.waitForSpinnerLoad();
},
waitForTransitionEnd: async function(selector) {
await this.evaluate(selector => {
return new Promise(resolve => {
const transition = document.querySelector(selector);
const onEnd = function() {
transition.removeEventListener('transitionend', onEnd);
resolve();
};
transition.addEventListener('transitionend', onEnd);
});
}, selector);
}
};

View File

@ -81,7 +81,7 @@ describe('Client Edit fiscalData path', () => {
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Invalid Tax number');
});
}, 15000);
it(`should edit the fiscal this time with a valid fiscal id`, async() => {
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);

View File

@ -1,32 +1,32 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
import openPage from '../../helpers/puppeteer';
describe('Worker pbx path', () => {
const nightmare = createNightmare();
let page;
beforeAll(async() => {
page = await openPage();
await page.loginAndModule('hr', 'worker');
await page.accessToSearchResult('employee');
await page.accessToSection('worker.card.pbx');
});
beforeAll(() => {
nightmare
.loginAndModule('hr', 'worker')
.accessToSearchResult('employee')
.accessToSection('worker.card.pbx');
afterAll(async() => {
page.close();
});
it('should receive an error when the extension exceeds 4 characters', async() => {
const result = await nightmare
.write(selectors.workerPbx.extensionInput, 55555)
.waitToClick(selectors.workerPbx.saveButton)
.waitForLastSnackbar();
await page.write(selectors.workerPbx.extensionInput, '55555');
await page.waitToClick(selectors.workerPbx.saveButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Extension format is invalid');
});
it('should sucessfully save the changes', async() => {
const result = await nightmare
.clearInput(selectors.workerPbx.extensionInput)
.write(selectors.workerPbx.extensionInput, 4444)
.waitToClick(selectors.workerPbx.saveButton)
.waitForLastSnackbar();
await page.clearInput(selectors.workerPbx.extensionInput);
await page.write(selectors.workerPbx.extensionInput, '4444');
await page.waitToClick(selectors.workerPbx.saveButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved! User must access web');
});

View File

@ -1,202 +1,173 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
import openPage from '../../helpers/puppeteer';
describe('Item summary path', () => {
const nightmare = createNightmare();
let page;
beforeAll(async() => {
page = await openPage();
await page.loginAndModule('employee', 'item');
});
beforeAll(() => {
nightmare
.loginAndModule('employee', 'item');
afterAll(async() => {
page.close();
});
it('should search for an item', async() => {
const result = await nightmare
.clearInput(selectors.itemsIndex.searchItemInput)
.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon longbow 2m')
.waitToClick(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult);
await page.clearInput(selectors.itemsIndex.searchItemInput);
await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon longbow 2m');
await page.waitToClick(selectors.itemsIndex.searchButton);
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
const result = await page.countElement(selectors.itemsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the search result summary button to open the item summary popup`, async() => {
const isVisible = await nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon longbow 2m')
.waitToClick(selectors.itemsIndex.searchResultPreviewButton)
.isVisible(selectors.itemSummary.basicData);
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon longbow 2m');
await page.waitToClick(selectors.itemsIndex.searchResultPreviewButton);
const isVisible = await page.isVisible(selectors.itemSummary.basicData);
expect(isVisible).toBeTruthy();
});
it(`should check the item summary preview shows fields from basic data`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.itemSummary.basicData, 'Ranged weapon longbow 2m')
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
await page.waitForTextInElement(selectors.itemSummary.basicData, 'Ranged weapon longbow 2m');
const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
expect(result).toContain('Ranged weapon longbow 2m');
});
it(`should check the item summary preview shows fields from tags`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.itemSummary.tags, 'Brown')
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
await page.waitForTextInElement(selectors.itemSummary.tags, 'Brown');
const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
expect(result).toContain('Brown');
});
it(`should check the item summary preview shows fields from niche`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.itemSummary.niche, 'A1')
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
await page.waitForTextInElement(selectors.itemSummary.niche, 'A1');
const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
expect(result).toContain('A1');
});
it(`should check the item summary preview shows fields from botanical`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.itemSummary.botanical, 'Hedera helix')
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
await page.waitForTextInElement(selectors.itemSummary.botanical, 'Hedera helix');
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
expect(result).toContain('Hedera helix');
});
it(`should check the item summary preview shows fields from barcode`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.itemSummary.barcode, '1')
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
await page.waitForTextInElement(selectors.itemSummary.barcode, '1');
const result = await page.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
expect(result).toContain('1');
});
it(`should close the summary popup`, async() => {
const result = await nightmare
.mousedown(selectors.itemsIndex.closeItemSummaryPreview)
.waitUntilNotPresent(selectors.itemSummary.basicData)
.visible(selectors.itemSummary.basicData);
expect(result).toBeFalsy();
await page.keyboard.press('Escape');
await page.waitUntilNotPresent(selectors.itemSummary.basicData);
await page.waitFor(selectors.itemSummary.basicData, {hidden: true});
});
it('should search for other item', async() => {
const result = await nightmare
.clearInput('vn-searchbar input')
.waitToClick(selectors.itemsIndex.searchButton)
.write(selectors.itemsIndex.searchItemInput, 'Melee weapon combat fist 15cm')
.waitToClick(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult);
await page.clearInput('vn-searchbar');
await page.waitToClick(selectors.itemsIndex.searchButton);
await page.write(selectors.itemsIndex.searchItemInput, 'Melee weapon combat fist 15cm');
await page.waitToClick(selectors.itemsIndex.searchButton);
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
const result = await page.countElement(selectors.itemsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should now click on the search result summary button to open the item summary popup`, async() => {
const isVisible = await nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Melee weapon combat fist 15cm')
.waitToClick(selectors.itemsIndex.searchResultPreviewButton)
.isVisible(selectors.itemSummary.basicData);
expect(isVisible).toBeTruthy();
await page.waitToClick(selectors.itemsIndex.searchResultPreviewButton);
await page.waitForSelector(selectors.itemSummary.basicData, {visible: true});
});
it(`should now check the item summary preview shows fields from basic data`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm')
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
await page.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm');
const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
expect(result).toContain('Melee weapon combat fist 15cm');
});
it(`should now check the item summary preview shows fields from tags`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.itemSummary.tags, 'Silver')
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
await page.waitForTextInElement(selectors.itemSummary.tags, 'Silver');
const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
expect(result).toContain('Silver');
});
it(`should now check the item summary preview shows fields from niche`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.itemSummary.niche, 'A4')
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
await page.waitForTextInElement(selectors.itemSummary.niche, 'A4');
const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
expect(result).toContain('A4');
});
it(`should now check the item summary preview shows fields from botanical`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.itemSummary.botanical, '-')
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
await page.waitForTextInElement(selectors.itemSummary.botanical, '-');
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
expect(result).toContain('-');
});
it(`should now check the item summary preview shows fields from barcode`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.itemSummary.barcode, '4')
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
await page.waitForTextInElement(selectors.itemSummary.barcode, '4');
const result = await page.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
expect(result).toContain('4');
});
it(`should now close the summary popup`, async() => {
const result = await nightmare
.mousedown(selectors.itemsIndex.closeItemSummaryPreview)
.waitUntilNotPresent(selectors.itemSummary.basicData)
.visible(selectors.itemSummary.basicData);
expect(result).toBeFalsy();
await page.keyboard.press('Escape');
await page.waitForSelector(selectors.itemSummary.basicData, {hidden: true});
});
it(`should navigate to the one of the items detailed section`, async() => {
const url = await nightmare
.waitToClick(selectors.itemsIndex.searchResult)
.waitForURL('summary')
.parsedUrl();
await page.waitToClick(selectors.itemsIndex.searchResult);
await page.waitForURL('summary');
const url = await page.parsedUrl();
expect(url.hash).toContain('summary');
});
it(`should check the descritor edit button is not visible for employee`, async() => {
const visibleButton = await nightmare
.isVisible(selectors.itemDescriptor.editButton);
const visibleButton = await page.isVisible(selectors.itemDescriptor.editButton);
expect(visibleButton).toBeFalsy();
});
it(`should check the item summary shows fields from basic data section`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm')
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
await page.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm');
const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
expect(result).toContain('Melee weapon combat fist 15cm');
});
it(`should check the item summary shows fields from tags section`, async() => {
const result = await nightmare
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
expect(result).toContain('Silver');
});
it(`should check the item summary shows fields from niches section`, async() => {
const result = await nightmare
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
expect(result).toContain('One A4');
});
it(`should check the item summary shows fields from botanical section`, async() => {
const result = await nightmare
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
expect(result).toContain('-');
});
it(`should check the item summary shows fields from barcodes section`, async() => {
const result = await nightmare
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
const result = await page.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
expect(result).toContain('4');
});

View File

@ -1,102 +1,100 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
import openPage from '../../helpers/puppeteer';
describe('Item Edit basic data path', () => {
const nightmare = createNightmare();
let page;
beforeAll(async() => {
page = await openPage();
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Melee weapon combat fist 15cm');
await page.accessToSection('item.card.basicData');
});
beforeAll(() => {
nightmare
.loginAndModule('buyer', 'item')
.accessToSearchResult('Melee weapon combat fist 15cm')
.accessToSection('item.card.basicData');
afterAll(async() => {
page.close();
});
it(`should check the descritor edit button is visible for buyer`, async() => {
const visibleButton = await nightmare
.isVisible(selectors.itemDescriptor.editButton);
expect(visibleButton).toBeTruthy();
await page.waitFor(selectors.itemDescriptor.editButton, {visible: true});
});
it(`should edit the item basic data`, async() => {
const result = await nightmare
.clearInput(selectors.itemBasicData.nameInput)
.write(selectors.itemBasicData.nameInput, 'Rose of Purity')
.autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Anthurium')
.autocompleteSearch(selectors.itemBasicData.intrastatAutocomplete, 'Coral y materiales similares')
.clearInput(selectors.itemBasicData.relevancyInput)
.write(selectors.itemBasicData.relevancyInput, '1')
.autocompleteSearch(selectors.itemBasicData.originAutocomplete, 'Spain')
.autocompleteSearch(selectors.itemBasicData.expenseAutocomplete, 'Alquiler VNH')
.clearInput(selectors.itemBasicData.longNameInput)
.write(selectors.itemBasicData.longNameInput, 'RS Rose of Purity')
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
.waitToClick(selectors.itemBasicData.priceInKgCheckbox)
.waitToClick(selectors.itemBasicData.submitBasicDataButton)
.waitForLastSnackbar();
await page.clearInput(selectors.itemBasicData.nameInput);
await page.write(selectors.itemBasicData.nameInput, 'Rose of Purity');
await page.autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Anthurium');
await page.autocompleteSearch(selectors.itemBasicData.intrastatAutocomplete, 'Coral y materiales similares');
await page.clearInput(selectors.itemBasicData.relevancyInput);
await page.write(selectors.itemBasicData.relevancyInput, '1');
await page.autocompleteSearch(selectors.itemBasicData.originAutocomplete, 'Spain');
await page.autocompleteSearch(selectors.itemBasicData.expenseAutocomplete, 'Alquiler VNH');
await page.clearInput(selectors.itemBasicData.longNameInput);
await page.write(selectors.itemBasicData.longNameInput, 'RS Rose of Purity');
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
await page.waitToClick(selectors.itemBasicData.priceInKgCheckbox);
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
}, 15000);
it(`should confirm the item name was edited`, async() => {
const result = await nightmare
.reloadSection('item.card.basicData')
.waitToGetProperty(selectors.itemBasicData.nameInput, 'value');
await page.reloadSection('item.card.basicData');
const result = await page.waitToGetProperty(`${selectors.itemBasicData.nameInput} input`, 'value');
expect(result).toEqual('Rose of Purity');
});
it(`should confirm the item type was edited`, async() => {
const result = await nightmare
const result = await page
.waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value');
expect(result).toEqual('Anthurium');
});
it(`should confirm the item intrastad was edited`, async() => {
const result = await nightmare
const result = await page
.waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value');
expect(result).toEqual('5080000 Coral y materiales similares');
});
it(`should confirm the item relevancy was edited`, async() => {
const result = await nightmare
.waitToGetProperty(selectors.itemBasicData.relevancyInput, 'value');
const result = await page
.waitToGetProperty(`${selectors.itemBasicData.relevancyInput} input`, 'value');
expect(result).toEqual('1');
});
it(`should confirm the item origin was edited`, async() => {
const result = await nightmare
const result = await page
.waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value');
expect(result).toEqual('Spain');
});
it(`should confirm the item expence was edited`, async() => {
const result = await nightmare
const result = await page
.waitToGetProperty(`${selectors.itemBasicData.expenseAutocomplete} input`, 'value');
expect(result).toEqual('Alquiler VNH');
});
it(`should confirm the item long name was edited`, async() => {
const result = await nightmare
.waitToGetProperty(selectors.itemBasicData.longNameInput, 'value');
const result = await page
.waitToGetProperty(`${selectors.itemBasicData.longNameInput} input`, 'value');
expect(result).toEqual('RS Rose of Purity');
});
it('should confirm isActive checkbox is unchecked', async() => {
const result = await nightmare
const result = await page
.checkboxState(selectors.itemBasicData.isActiveCheckbox);
expect(result).toBe('unchecked');
});
it('should confirm the priceInKg checkbox is checked', async() => {
const result = await nightmare
const result = await page
.checkboxState(selectors.itemBasicData.priceInKgCheckbox);
expect(result).toBe('checked');

View File

@ -1,61 +1,60 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
import openPage from '../../helpers/puppeteer';
describe('Item edit tax path', () => {
const nightmare = createNightmare();
let page;
beforeAll(async() => {
page = await openPage();
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Ranged weapon longbow 2m');
await page.accessToSection('item.card.tax');
});
beforeAll(() => {
nightmare
.loginAndModule('buyer', 'item')
.accessToSearchResult('Ranged weapon longbow 2m')
.accessToSection('item.card.tax');
afterAll(async() => {
page.close();
});
it(`should add the item tax to all countries`, async() => {
const result = await nightmare
.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'General VAT')
.autocompleteSearch(selectors.itemTax.secondClassAutocomplete, 'General VAT')
.autocompleteSearch(selectors.itemTax.thirdClassAutocomplete, 'General VAT')
.waitToClick(selectors.itemTax.submitTaxButton)
.waitForLastSnackbar();
await page.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'General VAT');
await page.autocompleteSearch(selectors.itemTax.secondClassAutocomplete, 'General VAT');
await page.autocompleteSearch(selectors.itemTax.thirdClassAutocomplete, 'General VAT');
await page.waitToClick(selectors.itemTax.submitTaxButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it(`should confirm the first item tax class was edited`, async() => {
const firstVatType = await nightmare
.reloadSection('item.card.tax')
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
await page.reloadSection('item.card.tax');
const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
expect(firstVatType).toEqual('General VAT');
});
it(`should confirm the second item tax class was edited`, async() => {
const secondVatType = await nightmare
const secondVatType = await page
.waitToGetProperty(`${selectors.itemTax.secondClassAutocomplete} input`, 'value');
expect(secondVatType).toEqual('General VAT');
});
it(`should confirm the third item tax class was edited`, async() => {
const thirdVatType = await nightmare
const thirdVatType = await page
.waitToGetProperty(`${selectors.itemTax.thirdClassAutocomplete} input`, 'value');
expect(thirdVatType).toEqual('General VAT');
});
it(`should edit the first class without saving the form`, async() => {
const firstVatType = await nightmare
.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT')
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
await page.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT');
const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
expect(firstVatType).toEqual('Reduced VAT');
});
it(`should now click the undo changes button and see the changes works`, async() => {
const firstVatType = await nightmare
.waitToClick(selectors.itemTax.undoChangesButton)
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
await page.waitToClick(selectors.itemTax.undoChangesButton);
const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
expect(firstVatType).toEqual('General VAT');
});

View File

@ -1,58 +1,59 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
import openPage from '../../helpers/puppeteer';
describe('Item create tags path', () => {
const nightmare = createNightmare();
let page;
beforeAll(async() => {
page = await openPage();
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Ranged weapon longbow 2m');
await page.accessToSection('item.card.tags');
});
beforeAll(() => {
nightmare
.loginAndModule('buyer', 'item')
.accessToSearchResult('Ranged weapon longbow 2m')
.accessToSection('item.card.tags');
afterAll(async() => {
page.close();
});
it(`should create a new tag and delete a former one`, async() => {
const result = await nightmare
.waitToClick(selectors.itemTags.fourthRemoveTagButton)
.waitToClick(selectors.itemTags.addItemTagButton)
.autocompleteSearch(selectors.itemTags.seventhTagAutocomplete, 'Ancho de la base')
.write(selectors.itemTags.seventhValueInput, '50')
.clearInput(selectors.itemTags.seventhRelevancyInput)
.write(selectors.itemTags.seventhRelevancyInput, '4')
.waitToClick(selectors.itemTags.submitItemTagsButton)
.waitForLastSnackbar();
await page.waitToClick(selectors.itemTags.fourthRemoveTagButton);
await page.waitToClick(selectors.itemTags.addItemTagButton);
await page.autocompleteSearch(selectors.itemTags.seventhTagAutocomplete, 'Ancho de la base');
await page.write(selectors.itemTags.seventhValueInput, '50');
await page.clearInput(selectors.itemTags.seventhRelevancyInput);
await page.write(selectors.itemTags.seventhRelevancyInput, '4');
await page.waitToClick(selectors.itemTags.submitItemTagsButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it(`should confirm the fourth row data is the expected one`, async() => {
let result = await nightmare
.reloadSection('item.card.tags')
.wait('vn-item-tags')
.waitToGetProperty(`${selectors.itemTags.fourthTagAutocomplete} input`, 'value');
await page.reloadSection('item.card.tags');
await page.wait('vn-item-tags');
let result = await page.waitToGetProperty(`${selectors.itemTags.fourthTagAutocomplete} input`, 'value');
expect(result).toEqual('Ancho de la base');
result = await nightmare
.waitToGetProperty(selectors.itemTags.fourthValueInput, 'value');
result = await page
.waitToGetProperty(`${selectors.itemTags.fourthValueInput} input`, 'value');
expect(result).toEqual('50');
result = await nightmare
.waitToGetProperty(selectors.itemTags.fourthRelevancyInput, 'value');
result = await page
.waitToGetProperty(`${selectors.itemTags.fourthRelevancyInput} input`, 'value');
expect(result).toEqual('4');
});
it(`should confirm the fifth row data is the expected one`, async() => {
let tag = await nightmare
let tag = await page
.waitToGetProperty(`${selectors.itemTags.fifthTagAutocomplete} input`, 'value');
let value = await nightmare
.waitToGetProperty(selectors.itemTags.fifthValueInput, 'value');
let value = await page
.waitToGetProperty(`${selectors.itemTags.fifthValueInput} input`, 'value');
let relevancy = await nightmare
.waitToGetProperty(selectors.itemTags.fifthRelevancyInput, 'value');
let relevancy = await page
.waitToGetProperty(`${selectors.itemTags.fifthRelevancyInput} input`, 'value');
expect(tag).toEqual('Color');
expect(value).toEqual('Brown');
@ -60,14 +61,14 @@ describe('Item create tags path', () => {
});
it(`should confirm the sixth row data is the expected one`, async() => {
let tag = await nightmare
let tag = await page
.waitToGetProperty(`${selectors.itemTags.sixthTagAutocomplete} input`, 'value');
let value = await nightmare
.waitToGetProperty(selectors.itemTags.sixthValueInput, 'value');
let value = await page
.waitToGetProperty(`${selectors.itemTags.sixthValueInput} input`, 'value');
let relevancy = await nightmare
.waitToGetProperty(selectors.itemTags.sixthRelevancyInput, 'value');
let relevancy = await page
.waitToGetProperty(`${selectors.itemTags.sixthRelevancyInput} input`, 'value');
expect(tag).toEqual('Categoria');
expect(value).toEqual('+1 precission');

View File

@ -1,61 +1,63 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
import openPage from '../../helpers/puppeteer';
describe('Item create niche path', () => {
const nightmare = createNightmare();
let page;
beforeAll(async() => {
page = await openPage();
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Ranged weapon longbow 2m');
await page.accessToSection('item.card.niche');
});
beforeAll(() => {
nightmare
.loginAndModule('buyer', 'item')
.accessToSearchResult('Ranged weapon longbow 2m')
.accessToSection('item.card.niche');
afterAll(async() => {
page.close();
});
it(`should click create a new niche and delete a former one`, async() => {
const result = await nightmare
.waitForTextInInput(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'Warehouse One')
.waitToClick(selectors.itemNiches.addNicheButton)
.waitToClick(selectors.itemNiches.secondNicheRemoveButton)
.autocompleteSearch(selectors.itemNiches.thirdWarehouseAutocomplete, 'Warehouse Two')
.write(selectors.itemNiches.thirdCodeInput, 'A4')
.waitToClick(selectors.itemNiches.submitNichesButton)
.waitForLastSnackbar();
await page.waitForTextInInput(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One');
await page.waitToClick(selectors.itemNiches.addNicheButton);
await page.waitToClick(selectors.itemNiches.secondNicheRemoveButton);
await page.autocompleteSearch(selectors.itemNiches.thirdWarehouseAutocomplete, 'Warehouse Two');
await page.write(selectors.itemNiches.thirdCodeInput, 'A4');
await page.waitToClick(selectors.itemNiches.submitNichesButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it(`should confirm the first niche is the expected one`, async() => {
let result = await nightmare
.reloadSection('item.card.niche')
.waitForTextInInput(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'Warehouse One')
await page.reloadSection('item.card.niche');
await page.waitForTextInInput(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One');
let result = await page
.waitToGetProperty(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'value');
expect(result).toEqual('Warehouse One');
result = await nightmare
.waitToGetProperty(selectors.itemNiches.firstCodeInput, 'value');
result = await page
.waitToGetProperty(`${selectors.itemNiches.firstCodeInput} input`, 'value');
expect(result).toEqual('A1');
});
it(`should confirm the second niche is the expected one`, async() => {
let result = await nightmare
let result = await page
.waitToGetProperty(`${selectors.itemNiches.secondWarehouseAutocomplete} input`, 'value');
expect(result).toEqual('Warehouse Three');
result = await nightmare
.waitToGetProperty(selectors.itemNiches.secondCodeInput, 'value');
result = await page
.waitToGetProperty(`${selectors.itemNiches.secondCodeInput} input`, 'value');
expect(result).toEqual('A3');
});
it(`should confirm the third niche is the expected one`, async() => {
let result = await nightmare
let result = await page
.waitToGetProperty(`${selectors.itemNiches.thirdWarehouseAutocomplete} input`, 'value');
expect(result).toEqual('Warehouse Two');
result = await nightmare
.waitToGetProperty(selectors.itemNiches.thirdCodeInput, 'value');
result = await page
.waitToGetProperty(`${selectors.itemNiches.thirdCodeInput} input`, 'value');
expect(result).toEqual('A4');
});

View File

@ -1,82 +1,83 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
import openPage from '../../helpers/puppeteer';
describe('Item Create botanical path', () => {
const nightmare = createNightmare();
let page;
beforeAll(async() => {
page = await openPage();
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Ranged weapon pistol 9mm');
await page.accessToSection('item.card.botanical');
});
beforeAll(() => {
nightmare
.loginAndModule('buyer', 'item')
.accessToSearchResult('Ranged weapon pistol 9mm')
.accessToSection('item.card.botanical');
afterAll(async() => {
page.close();
});
it(`should create a new botanical for the item`, async() => {
const result = await nightmare
.write(selectors.itemBotanical.botanicalInput, 'Cicuta maculata')
.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abelia')
.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'dealbata')
.waitToClick(selectors.itemBotanical.submitBotanicalButton)
.waitForLastSnackbar();
await page.write(selectors.itemBotanical.botanicalInput, 'Cicuta maculata');
await page.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abelia');
await page.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'dealbata');
await page.waitToClick(selectors.itemBotanical.submitBotanicalButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it(`should confirm the botanical for the item was created`, async() => {
const result = await nightmare
.reloadSection('item.card.botanical')
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata')
.waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value');
await page.reloadSection('item.card.botanical');
await page.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata');
const result = await page
.waitToGetProperty(`${selectors.itemBotanical.botanicalInput} input`, 'value');
expect(result).toEqual('Cicuta maculata');
});
it(`should confirm the Genus for the item was created`, async() => {
const result = await nightmare
.waitForTextInInput(`${selectors.itemBotanical.genusAutocomplete} input`, 'Abelia')
await page.waitForTextInInput(selectors.itemBotanical.genusAutocomplete, 'Abelia');
const result = await page
.waitToGetProperty(`${selectors.itemBotanical.genusAutocomplete} input`, 'value');
expect(result).toEqual('Abelia');
});
it(`should confirm the Species for the item was created`, async() => {
const result = await nightmare
const result = await page
.waitToGetProperty(`${selectors.itemBotanical.speciesAutocomplete} input`, 'value');
expect(result).toEqual('dealbata');
});
it(`should edit botanical for the item`, async() => {
const result = await nightmare
.clearInput(selectors.itemBotanical.botanicalInput)
.write(selectors.itemBotanical.botanicalInput, 'Herp Derp')
.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abies')
.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'decurrens')
.waitToClick(selectors.itemBotanical.submitBotanicalButton)
.waitForLastSnackbar();
await page.clearInput(selectors.itemBotanical.botanicalInput);
await page.write(selectors.itemBotanical.botanicalInput, 'Herp Derp');
await page.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abies');
await page.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'decurrens');
await page.waitToClick(selectors.itemBotanical.submitBotanicalButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it(`should confirm the botanical for the item was edited`, async() => {
const result = await nightmare
.reloadSection('item.card.botanical')
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp')
.waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value');
await page.reloadSection('item.card.botanical');
await page.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp');
const result = await page
.waitToGetProperty(`${selectors.itemBotanical.botanicalInput} input`, 'value');
expect(result).toEqual('Herp Derp');
});
it(`should confirm the Genus for the item was edited`, async() => {
const result = await nightmare
.waitForTextInInput(`${selectors.itemBotanical.genusAutocomplete} input`, 'Abies')
await page.waitForTextInInput(selectors.itemBotanical.genusAutocomplete, 'Abies');
const result = await page
.waitToGetProperty(`${selectors.itemBotanical.genusAutocomplete} input`, 'value');
expect(result).toEqual('Abies');
});
it(`should confirm the Species for the item was edited`, async() => {
const result = await nightmare
const result = await page
.waitToGetProperty(`${selectors.itemBotanical.speciesAutocomplete} input`, 'value');
expect(result).toEqual('decurrens');

View File

@ -1,32 +1,34 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
import openPage from '../../helpers/puppeteer';
describe('Item Create barcodes path', () => {
const nightmare = createNightmare();
let page;
beforeAll(async() => {
page = await openPage();
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Ranged weapon longbow 2m');
await page.accessToSection('item.card.itemBarcode');
});
beforeAll(() => {
nightmare
.loginAndModule('buyer', 'item')
.accessToSearchResult('Ranged weapon longbow 2m')
.accessToSection('item.card.itemBarcode');
afterAll(async() => {
page.close();
});
it(`should click create a new code and delete a former one`, async() => {
const result = await nightmare
.waitToClick(selectors.itemBarcodes.firstCodeRemoveButton)
.waitToClick(selectors.itemBarcodes.addBarcodeButton)
.write(selectors.itemBarcodes.thirdCodeInput, '5')
.waitToClick(selectors.itemBarcodes.submitBarcodesButton)
.waitForLastSnackbar();
await page.waitToClick(selectors.itemBarcodes.firstCodeRemoveButton);
await page.waitToClick(selectors.itemBarcodes.addBarcodeButton);
await page.write(selectors.itemBarcodes.thirdCodeInput, '5');
await page.waitToClick(selectors.itemBarcodes.submitBarcodesButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, async() => {
const result = await nightmare
.reloadSection('item.card.itemBarcode')
.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5')
.waitToGetProperty(selectors.itemBarcodes.thirdCodeInput, 'value');
await page.reloadSection('item.card.itemBarcode');
await page.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5');
const result = await page
.waitToGetProperty(`${selectors.itemBarcodes.thirdCodeInput} input`, 'value');
expect(result).toEqual('5');
});

View File

@ -1,82 +1,81 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
import openPage from '../../helpers/puppeteer';
describe('Item Create/Clone path', () => {
const nightmare = createNightmare();
describe('create', () => {
beforeAll(() => {
nightmare
.loginAndModule('buyer', 'item');
});
let page;
beforeAll(async() => {
page = await openPage();
await page.loginAndModule('buyer', 'item');
});
afterAll(async() => {
page.close();
});
describe('create', () => {
it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, async() => {
const result = await nightmare
.clearInput(selectors.itemsIndex.searchItemInput)
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
.waitToClick(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0)
.countElement(selectors.itemsIndex.searchResult);
await page.clearInput(selectors.itemsIndex.searchItemInput);
await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet');
await page.waitToClick(selectors.itemsIndex.searchButton);
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0);
const result = await page.countElement(selectors.itemsIndex.searchResult);
expect(result).toEqual(0);
});
it('should access to the create item view by clicking the create floating button', async() => {
const url = await nightmare
.waitToClick(selectors.itemsIndex.createItemButton)
.wait(selectors.itemCreateView.createButton)
.parsedUrl();
await page.waitToClick(selectors.itemsIndex.createItemButton);
await page.wait(selectors.itemCreateView.createButton);
const url = await page.parsedUrl();
expect(url.hash).toEqual('#!/item/create');
});
it('should return to the item index by clickig the cancel button', async() => {
const url = await nightmare
.waitToClick(selectors.itemCreateView.cancelButton)
.wait(selectors.itemsIndex.createItemButton)
.parsedUrl();
await page.waitToClick(selectors.itemCreateView.cancelButton);
await page.wait(selectors.itemsIndex.createItemButton);
const url = await page.parsedUrl();
expect(url.hash).toEqual('#!/item/index');
});
it('should now access to the create item view by clicking the create floating button', async() => {
const url = await nightmare
.waitToClick(selectors.itemsIndex.createItemButton)
.wait(selectors.itemCreateView.createButton)
.parsedUrl();
await page.waitToClick(selectors.itemsIndex.createItemButton);
await page.wait(selectors.itemCreateView.createButton);
const url = await page.parsedUrl();
expect(url.hash).toEqual('#!/item/create');
});
it('should create the Infinity Gauntlet item', async() => {
const result = await nightmare
.write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet')
.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo')
.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares')
.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand')
.waitToClick(selectors.itemCreateView.createButton)
.waitForLastSnackbar();
await page.write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet');
await page.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo');
await page.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares');
await page.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand');
await page.waitToClick(selectors.itemCreateView.createButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm Infinity Gauntlet item was created', async() => {
let result = await nightmare
.waitToGetProperty(selectors.itemBasicData.nameInput, 'value');
let result = await page
.waitToGetProperty(`${selectors.itemBasicData.nameInput} input`, 'value');
expect(result).toEqual('Infinity Gauntlet');
result = await nightmare
result = await page
.waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value');
expect(result).toEqual('Crisantemo');
result = await nightmare
result = await page
.waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value');
expect(result).toEqual('5080000 Coral y materiales similares');
result = await nightmare
result = await page
.waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value');
expect(result).toEqual('Holand');
@ -85,45 +84,41 @@ describe('Item Create/Clone path', () => {
describe('clone', () => {
it('should return to the items index by clicking the return to items button', async() => {
const url = await nightmare
.waitToClick(selectors.itemBasicData.goToItemIndexButton)
.wait(selectors.itemsIndex.createItemButton)
.waitForURL('#!/item/index')
.parsedUrl();
await page.waitToClick(selectors.itemBasicData.goToItemIndexButton);
await page.wait(selectors.itemsIndex.createItemButton);
await page.waitForURL('#!/item/index');
const url = await page.parsedUrl();
expect(url.hash).toContain('#!/item/index');
});
it(`should search for the item Infinity Gauntlet`, async() => {
const result = await nightmare
.clearInput(selectors.itemsIndex.searchItemInput)
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
.waitToClick(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult);
await page.clearInput(selectors.itemsIndex.searchItemInput);
await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet');
await page.waitToClick(selectors.itemsIndex.searchButton);
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
const result = await page.countElement(selectors.itemsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should clone the Infinity Gauntlet`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet')
.waitToClick(selectors.itemsIndex.searchResultCloneButton)
.waitToClick(selectors.itemsIndex.acceptClonationAlertButton)
.waitForURL('tags')
.parsedUrl();
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet');
await page.waitToClick(selectors.itemsIndex.searchResultCloneButton);
await page.waitToClick(selectors.itemsIndex.acceptClonationAlertButton);
await page.waitForURL('tags');
const url = await page.parsedUrl();
expect(url.hash).toContain('tags');
});
it('should search for the item Infinity Gauntlet and find two', async() => {
const result = await nightmare
.waitToClick(selectors.itemTags.goToItemIndexButton)
.clearInput(selectors.itemsIndex.searchItemInput)
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
.waitToClick(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2)
.countElement(selectors.itemsIndex.searchResult);
await page.waitToClick(selectors.itemTags.goToItemIndexButton);
await page.clearInput(selectors.itemsIndex.searchItemInput);
await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet');
await page.waitToClick(selectors.itemsIndex.searchButton);
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2);
const result = await page.countElement(selectors.itemsIndex.searchResult);
expect(result).toEqual(2);
});

View File

@ -1,206 +1,201 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
import openPage from '../../helpers/puppeteer';
describe('Item regularize path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('employee', 'item');
let page;
beforeAll(async() => {
page = await openPage();
await page.loginAndModule('employee', 'item');
});
afterAll(async() => {
page.close();
});
it('should edit the user local warehouse', async() => {
let result = await nightmare
.waitForSpinnerLoad()
.waitToClick(selectors.globalItems.userMenuButton)
.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four')
.waitForLastSnackbar();
await page.waitForSpinnerLoad();
await page.waitToClick(selectors.globalItems.userMenuButton);
await page.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four');
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should open the user config form to check the local settings', async() => {
let userLocalWarehouse = await nightmare
.waitToClick(selectors.globalItems.userMenuButton)
await page.waitToClick(selectors.globalItems.userMenuButton);
const userLocalWarehouse = await page
.waitToGetProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
expect(userLocalWarehouse).toContain('Warehouse Four');
});
it('should search for an item', async() => {
const resultCount = await nightmare
.clearInput(selectors.itemsIndex.searchItemInput)
.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm')
.waitToClick(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult);
it('should search for an specific item', async() => {
await page.clearInput(selectors.itemsIndex.searchItemInput);
await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm');
await page.waitToClick(selectors.itemsIndex.searchButton);
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
const resultCount = await page.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, 'Ranged weapon pistol 9mm')
.waitToClick(selectors.itemsIndex.searchResult)
.waitForURL('/summary')
.parsedUrl();
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm');
await page.waitToClick(selectors.itemsIndex.searchResult);
await page.waitForURL('/summary');
const url = await page.parsedUrl();
expect(url.hash).toContain('/summary');
});
it('should open the regularize dialog and check the warehouse matches the local user settings', async() => {
const result = await nightmare
.waitToClick(selectors.itemDescriptor.moreMenu)
.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton)
.waitToGetProperty(`${selectors.itemDescriptor.regularizeWarehouseAutocomplete} input`, 'value');
await page.waitToClick(selectors.itemDescriptor.moreMenu);
await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton);
const result = await page.waitToGetProperty(`${selectors.itemDescriptor.regularizeWarehouseAutocomplete} input`, 'value');
expect(result).toEqual('Warehouse Four');
});
it('should regularize the item', async() => {
const result = await nightmare
.write(selectors.itemDescriptor.regularizeQuantityInput, 100)
.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One')
.waitToClick(selectors.itemDescriptor.regularizeSaveButton)
.waitForLastSnackbar();
await page.write(selectors.itemDescriptor.regularizeQuantityInput, '100');
await page.wait(1000); // time for autocomplete to load
await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One');
await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton);
const result = await page.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();
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)
]);
const url = await page.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
});
it('should clear the user local settings now', async() => {
let result = await nightmare
.waitToClick(selectors.globalItems.userMenuButton)
.waitToClick(selectors.globalItems.userConfigFirstAutocompleteClear)
.waitForLastSnackbar();
await page.waitForTransitionEnd('vn-searchbar');
await page.waitToClick(selectors.globalItems.userMenuButton);
await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
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);
await page.keyboard.press('Escape');
await page.waitForTransitionEnd('.vn-popover');
await page.write(selectors.ticketsIndex.searchTicketInput, 'missing');
await page.waitToClick(selectors.ticketsIndex.searchButton);
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
const result = await page.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();
await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Missing');
await page.waitToClick(selectors.ticketsIndex.searchResult);
await page.waitForURL('/summary');
const url = await page.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')
await page.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100');
const result = await page
.waitToGetProperty(selectors.ticketSummary.firstSaleQuantity, 'innerText');
expect(result).toContain('-100');
});
it(`should check the ticket sale discount is 100%`, async() => {
const result = await nightmare
const result = await page
.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();
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.wait(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.itemsButton);
await page.wait(selectors.itemsIndex.searchItemInput);
const url = await page.parsedUrl();
expect(url.hash).toEqual('#!/item/index');
});
it('should search for the item once again', async() => {
const resultCount = await nightmare
.clearInput(selectors.itemsIndex.searchItemInput)
.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm')
.waitToClick(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult);
await page.clearInput(selectors.itemsIndex.searchItemInput);
await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm');
await page.waitToClick(selectors.itemsIndex.searchButton);
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
const resultCount = await page.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, 'Ranged weapon pistol 9mm')
.waitToClick(selectors.itemsIndex.searchResult)
.waitForURL('/summary')
.parsedUrl();
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm');
await page.waitToClick(selectors.itemsIndex.searchResult);
await page.waitForURL('/summary');
const url = await page.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();
await page.waitToClick(selectors.itemDescriptor.moreMenu);
await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton);
await page.write(selectors.itemDescriptor.regularizeQuantityInput, '100');
await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One');
await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton);
const result = await page.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();
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');
const url = await page.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
});
it('should search for the ticket with id 25 once again', async() => {
const result = await nightmare
.write(selectors.ticketsIndex.searchTicketInput, 25)
.waitToClick(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
await page.write(selectors.ticketsIndex.searchTicketInput, '25');
await page.waitToClick(selectors.ticketsIndex.searchButton);
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
const result = await page.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, '25')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitForURL('/summary')
.parsedUrl();
await page.waitForTextInElement(selectors.ticketsIndex.searchResult, '25');
await page.waitToClick(selectors.ticketsIndex.searchResult);
await page.waitForURL('/summary');
const url = await page.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);
await page.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100');
const result = await page.countElement(selectors.ticketSummary.sale);
expect(result).toEqual(2);
});

View File

@ -1,86 +1,84 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
import openPage from '../../helpers/puppeteer';
describe('Item index path', () => {
const nightmare = createNightmare();
let page;
beforeAll(async() => {
page = await openPage();
await page.loginAndModule('salesPerson', 'item');
await page.waitToClick(selectors.itemsIndex.searchIcon);
});
beforeAll(() => {
nightmare
.loginAndModule('salesPerson', 'item')
.waitToClick(selectors.itemsIndex.searchIcon);
afterAll(async() => {
page.close();
});
it('should click on the fields to show button to open the list of columns to show', async() => {
const visible = await nightmare
.waitToClick(selectors.itemsIndex.fieldsToShowButton)
.isVisible(selectors.itemsIndex.fieldsToShowForm);
await page.waitToClick(selectors.itemsIndex.fieldsToShowButton);
const visible = await page.isVisible(selectors.itemsIndex.fieldsToShowForm);
expect(visible).toBeTruthy();
});
it('should unmark all checkboxes except the first and the last ones', async() => {
const result = await nightmare
.waitToClick(selectors.itemsIndex.idCheckbox)
.waitToClick(selectors.itemsIndex.stemsCheckbox)
.waitToClick(selectors.itemsIndex.sizeCheckbox)
.waitToClick(selectors.itemsIndex.nicheCheckbox)
.waitToClick(selectors.itemsIndex.typeCheckbox)
.waitToClick(selectors.itemsIndex.categoryCheckbox)
.waitToClick(selectors.itemsIndex.intrastadCheckbox)
.waitToClick(selectors.itemsIndex.originCheckbox)
.waitToClick(selectors.itemsIndex.buyerCheckbox)
.waitToClick(selectors.itemsIndex.destinyCheckbox)
.waitToClick(selectors.itemsIndex.saveFieldsButton)
.waitForLastSnackbar();
await page.waitToClick(selectors.itemsIndex.idCheckbox);
await page.waitToClick(selectors.itemsIndex.stemsCheckbox);
await page.waitToClick(selectors.itemsIndex.sizeCheckbox);
await page.waitToClick(selectors.itemsIndex.nicheCheckbox);
await page.waitToClick(selectors.itemsIndex.typeCheckbox);
await page.waitToClick(selectors.itemsIndex.categoryCheckbox);
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
await page.waitToClick(selectors.itemsIndex.originCheckbox);
await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
await page.waitToClick(selectors.itemsIndex.destinyCheckbox);
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should navigate forth and back to see the images column is still visible', async() => {
const imageVisible = await nightmare
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton)
.waitToClick(selectors.itemsIndex.searchIcon)
.wait(selectors.itemsIndex.searchResult)
.waitImgLoad(selectors.itemsIndex.firstItemImage)
.isVisible(selectors.itemsIndex.firstItemImageTd);
await page.waitToClick(selectors.itemsIndex.searchResult);
await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton);
await page.waitToClick(selectors.itemsIndex.searchIcon);
await page.wait(selectors.itemsIndex.searchResult);
await page.waitImgLoad(selectors.itemsIndex.firstItemImage);
const imageVisible = await page.isVisible(selectors.itemsIndex.firstItemImageTd);
expect(imageVisible).toBeTruthy();
});
it('should check the ids column is not visible', async() => {
const idVisible = await nightmare
const idVisible = await page
.isVisible(selectors.itemsIndex.firstItemId);
expect(idVisible).toBeFalsy();
});
it('should mark all unchecked boxes to leave the index as it was', async() => {
const result = await nightmare
.waitToClick(selectors.itemsIndex.fieldsToShowButton)
.waitToClick(selectors.itemsIndex.idCheckbox)
.waitToClick(selectors.itemsIndex.stemsCheckbox)
.waitToClick(selectors.itemsIndex.sizeCheckbox)
.waitToClick(selectors.itemsIndex.nicheCheckbox)
.waitToClick(selectors.itemsIndex.typeCheckbox)
.waitToClick(selectors.itemsIndex.categoryCheckbox)
.waitToClick(selectors.itemsIndex.intrastadCheckbox)
.waitToClick(selectors.itemsIndex.originCheckbox)
.waitToClick(selectors.itemsIndex.buyerCheckbox)
.waitToClick(selectors.itemsIndex.destinyCheckbox)
.waitToClick(selectors.itemsIndex.saveFieldsButton)
.waitForLastSnackbar();
await page.waitToClick(selectors.itemsIndex.fieldsToShowButton);
await page.waitToClick(selectors.itemsIndex.idCheckbox);
await page.waitToClick(selectors.itemsIndex.stemsCheckbox);
await page.waitToClick(selectors.itemsIndex.sizeCheckbox);
await page.waitToClick(selectors.itemsIndex.nicheCheckbox);
await page.waitToClick(selectors.itemsIndex.typeCheckbox);
await page.waitToClick(selectors.itemsIndex.categoryCheckbox);
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
await page.waitToClick(selectors.itemsIndex.originCheckbox);
await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
await page.waitToClick(selectors.itemsIndex.destinyCheckbox);
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should now navigate forth and back to see the ids column is now visible', async() => {
const idVisible = await nightmare
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton)
.waitToClick(selectors.itemsIndex.searchIcon)
.wait(selectors.itemsIndex.searchResult)
.isVisible(selectors.itemsIndex.firstItemId);
await page.waitToClick(selectors.itemsIndex.searchResult);
await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton);
await page.waitToClick(selectors.itemsIndex.searchIcon);
await page.wait(selectors.itemsIndex.searchResult);
const idVisible = await page.isVisible(selectors.itemsIndex.firstItemId);
expect(idVisible).toBeTruthy();
});

View File

@ -1,74 +1,72 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
import openPage from '../../helpers/puppeteer';
describe('Item log path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('developer', 'item');
let page;
beforeAll(async() => {
page = await openPage();
await page.loginAndModule('developer', 'item');
});
afterAll(async() => {
page.close();
});
it(`should search for the Knowledge artifact to confirm it isn't created yet`, async() => {
const result = await nightmare
.write(selectors.itemsIndex.searchItemInput, 'Knowledge artifact')
.waitToClick(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0)
.countElement(selectors.itemsIndex.searchResult);
await page.write(selectors.itemsIndex.searchItemInput, 'Knowledge artifact');
await page.waitToClick(selectors.itemsIndex.searchButton);
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0);
const result = await page.countElement(selectors.itemsIndex.searchResult);
expect(result).toEqual(0);
});
it('should access to the create item view by clicking the create floating button', async() => {
const url = await nightmare
.waitToClick(selectors.itemsIndex.createItemButton)
.wait(selectors.itemCreateView.createButton)
.parsedUrl();
await page.waitToClick(selectors.itemsIndex.createItemButton);
await page.wait(selectors.itemCreateView.createButton);
const url = await page.parsedUrl();
expect(url.hash).toEqual('#!/item/create');
});
it('should create the Knowledge artifact item', async() => {
const result = await nightmare
.write(selectors.itemCreateView.temporalName, 'Knowledge artifact')
.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo')
.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares')
.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand')
.waitToClick(selectors.itemCreateView.createButton)
.waitForLastSnackbar();
await page.write(selectors.itemCreateView.temporalName, 'Knowledge artifact');
await page.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo');
await page.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares');
await page.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand');
await page.waitToClick(selectors.itemCreateView.createButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should return to the items index by clicking the return to items button', async() => {
const url = await nightmare
.waitToClick(selectors.itemBasicData.goToItemIndexButton)
.wait(selectors.itemsIndex.createItemButton)
.waitForURL('#!/item/index')
.parsedUrl();
await page.waitToClick(selectors.itemBasicData.goToItemIndexButton);
await page.wait(selectors.itemsIndex.createItemButton);
await page.waitForURL('#!/item/index');
const url = await page.parsedUrl();
expect(url.hash).toContain('#!/item/index');
});
it(`should search for the created item and navigate to it's log section`, async() => {
const url = await nightmare
.accessToSearchResult('Knowledge artifact')
.accessToSection('item.card.log')
.waitForURL('/log')
.parsedUrl();
await page.accessToSearchResult('Knowledge artifact');
await page.accessToSection('item.card.log');
await page.waitForURL('/log');
const url = await page.parsedUrl();
expect(url.hash).toContain('/log');
});
it(`should confirm the log is showing 5 entries`, async() => {
const anyLineCreatedCount = await nightmare
.wait(selectors.itemLog.anyLineCreated)
.countElement(selectors.itemLog.anyLineCreated);
await page.wait(selectors.itemLog.anyLineCreated);
const anyLineCreatedCount = await page.countElement(selectors.itemLog.anyLineCreated);
expect(anyLineCreatedCount).toEqual(5);
});
it(`should confirm the log is showing the intrastat for the created item`, async() => {
const fifthLineCreatedProperty = await nightmare
const fifthLineCreatedProperty = await page
.waitToGetProperty(selectors.itemLog.fifthLineCreatedProperty, 'innerText');
expect(fifthLineCreatedProperty).toEqual('Coral y materiales similares');

View File

@ -1,47 +1,47 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
import openPage from '../../helpers/puppeteer';
describe('Item descriptor path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('buyer', 'item')
.accessToSearchResult(1)
.accessToSection('item.card.basicData');
let page;
beforeAll(async() => {
page = await openPage();
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('1');
await page.accessToSection('item.card.basicData');
});
afterAll(async() => {
page.close();
});
it('should check the descriptor inactive icon is dark as the item is active', async() => {
let darkIcon = await nightmare
.wait(selectors.itemDescriptor.inactiveIcon)
.waitForClassNotPresent(selectors.itemDescriptor.inactiveIcon, 'bright')
.isVisible(selectors.itemDescriptor.inactiveIcon);
await page.wait(selectors.itemDescriptor.inactiveIcon);
await page.waitForClassNotPresent(selectors.itemDescriptor.inactiveIcon, 'bright');
let darkIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
expect(darkIcon).toBeTruthy();
});
it('should set the item to inactive', async() => {
let result = await nightmare
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
.waitToClick(selectors.itemBasicData.submitBasicDataButton)
.waitForLastSnackbar();
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
let result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should reload the section and check the inactive icon is bright', async() => {
let brightIcon = await nightmare
.reloadSection('item.card.basicData')
.waitForClassPresent(selectors.itemDescriptor.inactiveIcon, 'bright')
.isVisible(selectors.itemDescriptor.inactiveIcon);
await page.reloadSection('item.card.basicData');
await page.waitForClassPresent(selectors.itemDescriptor.inactiveIcon, 'bright');
let brightIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
expect(brightIcon).toBeTruthy();
});
it('should set the item back to active', async() => {
let result = await nightmare
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
.waitToClick(selectors.itemBasicData.submitBasicDataButton)
.waitForLastSnackbar();
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
let result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});

4224
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,36 +10,35 @@
},
"dependencies": {
"compression": "^1.7.3",
"electron": "^7.1.2",
"fs-extra": "^5.0.0",
"helmet": "^3.21.1",
"i18n": "^0.8.3",
"helmet": "^3.21.2",
"i18n": "^0.8.4",
"loopback": "^3.26.0",
"loopback-boot": "^2.27.1",
"loopback-component-explorer": "^6.3.1",
"loopback-component-storage": "^3.6.1",
"loopback-connector-mysql": "^5.3.1",
"loopback-component-explorer": "^6.5.0",
"loopback-component-storage": "^3.6.3",
"loopback-connector-mysql": "^5.4.2",
"loopback-connector-remote": "^3.4.1",
"loopback-context": "^3.4.0",
"md5": "^2.2.1",
"object-diff": "0.0.4",
"object.pick": "^1.3.0",
"request": "^2.88.0",
"request-promise-native": "^1.0.7",
"request-promise-native": "^1.0.8",
"require-yaml": "0.0.1",
"soap": "^0.26.0",
"strong-error-handler": "^2.3.2",
"uuid": "^3.3.2",
"uuid": "^3.3.3",
"vn-loopback": "file:./loopback",
"xml2js": "^0.4.19"
"xml2js": "^0.4.23"
},
"devDependencies": {
"@babel/core": "^7.6.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/polyfill": "^7.2.5",
"@babel/preset-env": "^7.6.0",
"@babel/register": "^7.0.0",
"angular-mocks": "^1.7.7",
"@babel/core": "^7.7.7",
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
"@babel/polyfill": "^7.7.0",
"@babel/preset-env": "^7.7.7",
"@babel/register": "^7.7.7",
"angular-mocks": "^1.7.9",
"babel-jest": "^24.9.0",
"babel-loader": "^8.0.6",
"babel-preset-es2015": "^6.24.1",
@ -63,9 +62,9 @@
"gulp-yaml": "^1.0.1",
"html-loader": "^0.4.5",
"html-loader-jest": "^0.2.1",
"html-webpack-plugin": "^4.0.0-beta.5",
"html-webpack-plugin": "^4.0.0-beta.11",
"identity-obj-proxy": "^3.0.0",
"jasmine": "^3.4.0",
"jasmine": "^3.5.0",
"jasmine-reporters": "^2.3.2",
"jasmine-spec-reporter": "^4.2.1",
"jest": "^24.9.0",
@ -73,19 +72,18 @@
"json-loader": "^0.5.7",
"merge-stream": "^1.0.1",
"minimist": "^1.2.0",
"mysql2": "^1.6.5",
"nightmare": "^3.0.2",
"puppeteer": "^2.0.0",
"node-sass": "^4.9.3",
"nodemon": "^1.18.10",
"mysql2": "^1.7.0",
"node-sass": "^4.13.0",
"nodemon": "^1.19.4",
"plugin-error": "^1.0.1",
"puppeteer": "^2.0.0",
"raw-loader": "^1.0.0",
"sass-loader": "^7.1.0",
"sass-loader": "^7.3.1",
"style-loader": "^0.23.1",
"webpack": "^4.29.5",
"webpack-cli": "^3.2.3",
"webpack-dev-server": "^3.1.14",
"webpack-merge": "^4.2.1",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.1",
"webpack-merge": "^4.2.2",
"yaml-loader": "^0.5.0"
},
"scripts": {