e2e path for entry buy after entry import path
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
9ef4497ea6
commit
3c280eed2e
|
@ -1036,6 +1036,21 @@ export default {
|
|||
entriesQuicklink: 'vn-entry-descriptor vn-quick-link[icon="icon-entry"] > a'
|
||||
},
|
||||
entryBuys: {
|
||||
anyBuyLine: 'vn-entry-buy-index tr.dark-row',
|
||||
allBuyCheckbox: 'vn-entry-buy-index thead vn-check',
|
||||
firstBuyCheckbox: 'vn-entry-buy-index tbody:nth-child(2) vn-check',
|
||||
deleteBuysButton: 'vn-entry-buy-index vn-button[icon="delete"]',
|
||||
addBuyButton: 'vn-entry-buy-index vn-icon[icon="add_circle"]',
|
||||
secondBuyPackingPrice: 'vn-entry-buy-index tbody:nth-child(3) > tr:nth-child(1) vn-input-number[ng-model="buy.price3"]',
|
||||
secondBuyGroupingPrice: 'vn-entry-buy-index tbody:nth-child(3) > tr:nth-child(1) vn-input-number[ng-model="buy.price2"]',
|
||||
secondBuyPrice: 'vn-entry-buy-index tbody:nth-child(3) > tr:nth-child(1) vn-input-number[ng-model="buy.buyingValue"]',
|
||||
secondBuyGrouping: 'vn-entry-buy-index tbody:nth-child(3) > tr:nth-child(1) vn-input-number[ng-model="buy.grouping"]',
|
||||
secondBuyPacking: 'vn-entry-buy-index tbody:nth-child(3) > tr:nth-child(1) vn-input-number[ng-model="buy.packing"]',
|
||||
secondBuyWeight: 'vn-entry-buy-index tbody:nth-child(3) > tr:nth-child(1) vn-input-number[ng-model="buy.weight"]',
|
||||
secondBuyStickers: 'vn-entry-buy-index tbody:nth-child(3) > tr:nth-child(1) vn-input-number[ng-model="buy.stickers"]',
|
||||
secondBuyPackage: 'vn-entry-buy-index tbody:nth-child(3) > tr:nth-child(1) vn-autocomplete[ng-model="buy.packageFk"]',
|
||||
secondBuyQuantity: 'vn-entry-buy-index tbody:nth-child(3) > tr:nth-child(1) vn-input-number[ng-model="buy.quantity"]',
|
||||
secondBuyItem: 'vn-entry-buy-index tbody:nth-child(3) > tr:nth-child(1) vn-autocomplete[ng-model="buy.itemFk"]',
|
||||
importButton: 'vn-entry-buy-index vn-icon[icon="publish"]',
|
||||
ref: 'vn-entry-buy-import vn-textfield[ng-model="$ctrl.import.ref"]',
|
||||
observation: 'vn-entry-buy-import vn-textarea[ng-model="$ctrl.import.observation"]',
|
||||
|
|
|
@ -0,0 +1,187 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Entry import, create and edit buys path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'entry');
|
||||
await page.accessToSearchResult('1');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should count the summary buys and find there only one at this point', async() => {
|
||||
const buysCount = await page.countElement(selectors.entrySummary.anyBuyLine);
|
||||
|
||||
expect(buysCount).toEqual(1);
|
||||
});
|
||||
|
||||
it('should navigate to the buy section and then click the import button opening the import form', async() => {
|
||||
await page.accessToSection('entry.card.buy.index');
|
||||
await page.waitToClick(selectors.entryBuys.importButton);
|
||||
await page.waitForState('entry.card.buy.import');
|
||||
});
|
||||
|
||||
it('should fill the form, import the designated JSON file and select items for each import and confirm import', async() => {
|
||||
await page.write(selectors.entryBuys.ref, 'a reference');
|
||||
await page.write(selectors.entryBuys.observation, 'an observation');
|
||||
|
||||
let currentDir = process.cwd();
|
||||
let filePath = `${currentDir}/e2e/assets/07_import_buys.json`;
|
||||
|
||||
const [fileChooser] = await Promise.all([
|
||||
page.waitForFileChooser(),
|
||||
page.waitToClick(selectors.entryBuys.file)
|
||||
]);
|
||||
await fileChooser.accept([filePath]);
|
||||
|
||||
await page.autocompleteSearch(selectors.entryBuys.firstImportedItem, 'Ranged Reinforced weapon pistol 9mm');
|
||||
await page.autocompleteSearch(selectors.entryBuys.secondImportedItem, 'Melee Reinforced weapon heavy shield 1x0.5m');
|
||||
await page.autocompleteSearch(selectors.entryBuys.thirdImportedItem, 'Container medical box 1m');
|
||||
await page.autocompleteSearch(selectors.entryBuys.fourthImportedItem, 'Container ammo box 1m');
|
||||
|
||||
await page.waitToClick(selectors.entryBuys.importBuysButton);
|
||||
|
||||
const message = await page.waitForSnackbar();
|
||||
const state = await page.getState();
|
||||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
expect(state).toBe('entry.card.buy.index');
|
||||
});
|
||||
|
||||
it('should count the buys to find 4 buys have been added', async() => {
|
||||
await page.waitForNumberOfElements(selectors.entryBuys.anyBuyLine, 5);
|
||||
});
|
||||
|
||||
it('should delete the four buys that were just added', async() => {
|
||||
await page.waitToClick(selectors.entryBuys.allBuyCheckbox);
|
||||
await page.waitToClick(selectors.entryBuys.firstBuyCheckbox);
|
||||
await page.waitToClick(selectors.entryBuys.deleteBuysButton);
|
||||
await page.waitToClick(selectors.globalItems.acceptButton);
|
||||
await page.waitForNumberOfElements(selectors.entryBuys.anyBuyLine, 1);
|
||||
});
|
||||
|
||||
it('should add a new buy', async() => {
|
||||
await page.waitToClick(selectors.entryBuys.addBuyButton);
|
||||
await page.write(selectors.entryBuys.secondBuyPackingPrice, '999');
|
||||
await page.write(selectors.entryBuys.secondBuyGroupingPrice, '999');
|
||||
await page.write(selectors.entryBuys.secondBuyPrice, '999');
|
||||
await page.write(selectors.entryBuys.secondBuyGrouping, '999');
|
||||
await page.write(selectors.entryBuys.secondBuyPacking, '999');
|
||||
await page.write(selectors.entryBuys.secondBuyWeight, '999');
|
||||
await page.write(selectors.entryBuys.secondBuyStickers, '999');
|
||||
await page.autocompleteSearch(selectors.entryBuys.secondBuyPackage, '1');
|
||||
await page.write(selectors.entryBuys.secondBuyQuantity, '999');
|
||||
await page.autocompleteSearch(selectors.entryBuys.secondBuyItem, '1');
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
|
||||
await page.waitForNumberOfElements(selectors.entryBuys.anyBuyLine, 2);
|
||||
});
|
||||
|
||||
it('should edit the newest buy', async() => {
|
||||
await page.clearInput(selectors.entryBuys.secondBuyPackingPrice);
|
||||
await page.waitForTextInField(selectors.entryBuys.secondBuyPackingPrice, '');
|
||||
await page.write(selectors.entryBuys.secondBuyPackingPrice, '100');
|
||||
await page.waitForSnackbar();
|
||||
|
||||
await page.clearInput(selectors.entryBuys.secondBuyGroupingPrice);
|
||||
await page.waitForTextInField(selectors.entryBuys.secondBuyGroupingPrice, '');
|
||||
await page.write(selectors.entryBuys.secondBuyGroupingPrice, '200');
|
||||
await page.waitForSnackbar();
|
||||
|
||||
await page.clearInput(selectors.entryBuys.secondBuyPrice);
|
||||
await page.waitForTextInField(selectors.entryBuys.secondBuyPrice, '');
|
||||
await page.write(selectors.entryBuys.secondBuyPrice, '300');
|
||||
await page.waitForSnackbar();
|
||||
|
||||
await page.clearInput(selectors.entryBuys.secondBuyGrouping);
|
||||
await page.waitForTextInField(selectors.entryBuys.secondBuyGrouping, '');
|
||||
await page.write(selectors.entryBuys.secondBuyGrouping, '400');
|
||||
await page.waitForSnackbar();
|
||||
|
||||
await page.clearInput(selectors.entryBuys.secondBuyPacking);
|
||||
await page.waitForTextInField(selectors.entryBuys.secondBuyPacking, '');
|
||||
await page.write(selectors.entryBuys.secondBuyPacking, '500');
|
||||
await page.waitForSnackbar();
|
||||
|
||||
await page.clearInput(selectors.entryBuys.secondBuyWeight);
|
||||
await page.waitForTextInField(selectors.entryBuys.secondBuyWeight, '');
|
||||
await page.write(selectors.entryBuys.secondBuyWeight, '600');
|
||||
await page.waitForSnackbar();
|
||||
|
||||
await page.clearInput(selectors.entryBuys.secondBuyStickers);
|
||||
await page.waitForTextInField(selectors.entryBuys.secondBuyStickers, '');
|
||||
await page.write(selectors.entryBuys.secondBuyStickers, '700');
|
||||
await page.waitForSnackbar();
|
||||
|
||||
await page.autocompleteSearch(selectors.entryBuys.secondBuyPackage, '94');
|
||||
await page.waitForSnackbar();
|
||||
|
||||
await page.clearInput(selectors.entryBuys.secondBuyQuantity);
|
||||
await page.waitForTextInField(selectors.entryBuys.secondBuyQuantity, '');
|
||||
await page.write(selectors.entryBuys.secondBuyQuantity, '800');
|
||||
});
|
||||
|
||||
it('should reload the section and check the packing price is as expected', async() => {
|
||||
await page.reloadSection('entry.card.buy.index');
|
||||
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyPackingPrice, 'value');
|
||||
|
||||
expect(result).toEqual('100');
|
||||
});
|
||||
|
||||
it('should reload the section and check the grouping price is as expected', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyGroupingPrice, 'value');
|
||||
|
||||
expect(result).toEqual('200');
|
||||
});
|
||||
|
||||
it('should reload the section and check the price is as expected', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyPrice, 'value');
|
||||
|
||||
expect(result).toEqual('300');
|
||||
});
|
||||
|
||||
it('should reload the section and check the grouping is as expected', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyGrouping, 'value');
|
||||
|
||||
expect(result).toEqual('400');
|
||||
});
|
||||
|
||||
it('should reload the section and check the packing is as expected', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyPacking, 'value');
|
||||
|
||||
expect(result).toEqual('500');
|
||||
});
|
||||
|
||||
it('should reload the section and check the weight is as expected', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyWeight, 'value');
|
||||
|
||||
expect(result).toEqual('600');
|
||||
});
|
||||
|
||||
it('should reload the section and check the stickers are as expected', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyStickers, 'value');
|
||||
|
||||
expect(result).toEqual('700');
|
||||
});
|
||||
|
||||
it('should reload the section and check the package is as expected', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyPackage, 'value');
|
||||
|
||||
expect(result).toEqual('94');
|
||||
});
|
||||
|
||||
it('should reload the section and check the quantity is as expected', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.entryBuys.secondBuyQuantity, 'value');
|
||||
|
||||
expect(result).toEqual('800');
|
||||
});
|
||||
});
|
|
@ -1,62 +0,0 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Entry import buys path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'entry');
|
||||
await page.accessToSearchResult('1');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should count the summary buys and find there only one at this point', async() => {
|
||||
const buysCount = await page.countElement(selectors.entrySummary.anyBuyLine);
|
||||
|
||||
expect(buysCount).toEqual(1);
|
||||
});
|
||||
|
||||
it('should navigate to the buy section and then click the import button opening the import form', async() => {
|
||||
await page.accessToSection('entry.card.buy.index');
|
||||
await page.waitToClick(selectors.entryBuys.importButton);
|
||||
await page.waitForState('entry.card.buy.import');
|
||||
});
|
||||
|
||||
it('should fill the form, import the designated JSON file and select items for each import and confirm import', async() => {
|
||||
await page.write(selectors.entryBuys.ref, 'a reference');
|
||||
await page.write(selectors.entryBuys.observation, 'an observation');
|
||||
|
||||
let currentDir = process.cwd();
|
||||
let filePath = `${currentDir}/e2e/assets/07_import_buys.json`;
|
||||
|
||||
const [fileChooser] = await Promise.all([
|
||||
page.waitForFileChooser(),
|
||||
page.waitToClick(selectors.entryBuys.file)
|
||||
]);
|
||||
await fileChooser.accept([filePath]);
|
||||
|
||||
await page.autocompleteSearch(selectors.entryBuys.firstImportedItem, 'Ranged Reinforced weapon pistol 9mm');
|
||||
await page.autocompleteSearch(selectors.entryBuys.secondImportedItem, 'Melee Reinforced weapon heavy shield 1x0.5m');
|
||||
await page.autocompleteSearch(selectors.entryBuys.thirdImportedItem, 'Container medical box 1m');
|
||||
await page.autocompleteSearch(selectors.entryBuys.fourthImportedItem, 'Container ammo box 1m');
|
||||
|
||||
await page.waitToClick(selectors.entryBuys.importBuysButton);
|
||||
|
||||
const message = await page.waitForSnackbar();
|
||||
const state = await page.getState();
|
||||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
expect(state).toBe('entry.card.buy.index');
|
||||
});
|
||||
|
||||
it('should navigate to the entry summary and count the buys to find 4 buys have been added', async() => {
|
||||
await page.waitToClick('vn-icon[icon="preview"]');
|
||||
await page.waitForNumberOfElements(selectors.entrySummary.anyBuyLine, 5);
|
||||
});
|
||||
});
|
|
@ -55,7 +55,7 @@ class Controller extends Section {
|
|||
|
||||
fetchBuys(buys) {
|
||||
const params = {buys};
|
||||
const query = `Entries/${this.entry.id}/importBuysPreview`;
|
||||
const query = `Entries/${this.$params.id}/importBuysPreview`;
|
||||
this.$http.get(query, {params}).then(res => {
|
||||
this.import.buys = res.data;
|
||||
});
|
||||
|
@ -71,7 +71,7 @@ class Controller extends Section {
|
|||
if (hasAnyEmptyRow)
|
||||
throw new Error(`Some of the imported buys doesn't have an item`);
|
||||
|
||||
const query = `Entries/${this.entry.id}/importBuys`;
|
||||
const query = `Entries/${this.$params.id}/importBuys`;
|
||||
return this.$http.post(query, params)
|
||||
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')))
|
||||
.then(() => this.$state.go('entry.card.buy.index'));
|
||||
|
|
Loading…
Reference in New Issue