7658-devToTest_2428 #2663
|
@ -33,106 +33,4 @@ describe('Travel descriptor path', () => {
|
|||
|
||||
expect(state).toBe('travel.card.summary');
|
||||
});
|
||||
|
||||
it('should be redirected to the create entry view', async() => {
|
||||
await page.waitToClick(selectors.travelDescriptor.dotMenu);
|
||||
await page.waitToClick(selectors.travelDescriptor.dotMenuAddEntry);
|
||||
await page.waitForState('entry.create');
|
||||
const state = await page.getState();
|
||||
|
||||
expect(state).toBe('entry.create');
|
||||
});
|
||||
|
||||
it('should check some data was imported from the travel', async() => {
|
||||
const travel = await page.waitToGetProperty(selectors.entryCreate.travel, 'value');
|
||||
const campany = await page.waitToGetProperty(selectors.entryCreate.company, 'value');
|
||||
|
||||
expect(travel).toContain('Warehouse');
|
||||
expect(campany).toContain('VNL');
|
||||
});
|
||||
|
||||
it('should navigate back to the travel index', async() => {
|
||||
await page.waitToClick('.cancel');
|
||||
await page.waitToClick(selectors.globalItems.homeButton);
|
||||
await page.selectModule('travel');
|
||||
await page.waitForState('travel.index');
|
||||
const state = await page.getState();
|
||||
|
||||
expect(state).toBe('travel.index');
|
||||
});
|
||||
|
||||
it('should click on the add entry button of the third result to be redirected to create entry', async() => {
|
||||
await page.keyboard.press('Enter');
|
||||
await page.waitToClick(selectors.travelIndex.firstTravelAddEntryButton);
|
||||
await page.waitForState('entry.create');
|
||||
const state = await page.getState();
|
||||
|
||||
expect(state).toBe('entry.create');
|
||||
});
|
||||
|
||||
it('should check again some data was imported from the travel', async() => {
|
||||
const travel = await page.waitToGetProperty(selectors.entryCreate.travel, 'value');
|
||||
const campany = await page.waitToGetProperty(selectors.entryCreate.company, 'value');
|
||||
|
||||
expect(travel).toContain('Warehouse');
|
||||
expect(campany).toContain('VNL');
|
||||
});
|
||||
|
||||
it('should navigate to the travel summary of a given travel', async() => {
|
||||
await page.waitToClick('.cancel');
|
||||
await page.waitToClick(selectors.globalItems.homeButton);
|
||||
await page.selectModule('travel');
|
||||
await page.write(selectors.travelIndex.generalSearchFilter, '3');
|
||||
await page.keyboard.press('Enter');
|
||||
await page.waitForState('travel.card.summary');
|
||||
const state = await page.getState();
|
||||
|
||||
expect(state).toBe('travel.card.summary');
|
||||
});
|
||||
|
||||
it('should be redirected to the create travel when using the clone option of the dot menu', async() => {
|
||||
await page.waitToClick(selectors.travelDescriptor.dotMenu);
|
||||
await page.waitToClick(selectors.travelDescriptor.dotMenuClone);
|
||||
await page.respondToDialog('accept');
|
||||
await page.waitForState('travel.create');
|
||||
const state = await page.getState();
|
||||
|
||||
expect(state).toBe('travel.create');
|
||||
});
|
||||
|
||||
it('should edit the data to clone and then get redirected to the cloned travel basic data', async() => {
|
||||
await page.clearInput(selectors.travelCreate.reference);
|
||||
await page.write(selectors.travelCreate.reference, 'reference');
|
||||
await page.autocompleteSearch(selectors.travelCreate.agency, 'entanglement');
|
||||
await page.pickDate(selectors.travelCreate.shipped);
|
||||
await page.pickDate(selectors.travelCreate.landed);
|
||||
await page.autocompleteSearch(selectors.travelCreate.warehouseOut, 'warehouse one');
|
||||
await page.autocompleteSearch(selectors.travelCreate.warehouseIn, 'warehouse two');
|
||||
await page.waitToClick(selectors.travelCreate.saveButton);
|
||||
await page.waitForState('travel.card.basicData');
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should update the landed date to a future date to enable cloneWithEntries', async() => {
|
||||
const nextMonth = Date.vnNew();
|
||||
nextMonth.setMonth(nextMonth.getMonth() + 1);
|
||||
await page.pickDate(selectors.travelBasicData.deliveryDate, nextMonth);
|
||||
await page.waitToClick(selectors.travelBasicData.save);
|
||||
await page.waitForState('travel.card.basicData');
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should navigate to the summary and then clone the travel and its entries using the descriptor menu to get redirected to the cloned travel basic data', async() => {
|
||||
await page.waitToClick('vn-icon[icon="launch"]');
|
||||
await page.waitForState('travel.card.summary');
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitToClick(selectors.travelDescriptor.dotMenu);
|
||||
await page.waitToClick(selectors.travelDescriptor.dotMenuCloneWithEntries);
|
||||
await page.waitToClick(selectors.travelDescriptor.acceptClonation);
|
||||
await page.waitForState('travel.card.basicData');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Entry summary path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'entry');
|
||||
await page.accessToSearchResult('4');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should reach the second entry summary section', async() => {
|
||||
await page.waitForState('entry.card.summary');
|
||||
});
|
||||
|
||||
it(`should display details from the entry on the header`, async() => {
|
||||
await page.waitForTextInElement(selectors.entrySummary.header, 'The farmer');
|
||||
const result = await page.waitToGetProperty(selectors.entrySummary.header, 'innerText');
|
||||
|
||||
expect(result).toContain('The farmer');
|
||||
});
|
||||
|
||||
it('should display some entry details like the reference', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.entrySummary.reference, 'innerText');
|
||||
|
||||
expect(result).toContain('Movement 4');
|
||||
});
|
||||
|
||||
it('should display other entry details like the confirmed', async() => {
|
||||
const result = await page.checkboxState(selectors.entrySummary.confirmed, 'innerText');
|
||||
|
||||
expect(result).toContain('unchecked');
|
||||
});
|
||||
|
||||
it('should display all buys for the entry', async() => {
|
||||
const result = await page.countElement(selectors.entrySummary.anyBuyLine);
|
||||
|
||||
expect(result).toEqual(4);
|
||||
});
|
||||
});
|
|
@ -1,49 +0,0 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Entry descriptor path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'entry');
|
||||
await page.accessToSearchResult('2');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should reach the second entry summary section', async() => {
|
||||
await page.waitForState('entry.card.summary');
|
||||
});
|
||||
|
||||
it('should show some entry information', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.entryDescriptor.agency, 'innerText');
|
||||
|
||||
expect(result).toContain('inhouse pickup');
|
||||
});
|
||||
|
||||
it('should click the travels button to be redirected to the travels index filtered by the current agency', async() => {
|
||||
await page.waitToClick(selectors.entryDescriptor.travelsQuicklink);
|
||||
await page.expectURL('/travel/index');
|
||||
await page.expectURL('agencyModeFk');
|
||||
});
|
||||
|
||||
it('should go back to the entry summary', async() => {
|
||||
await page.waitToClick(selectors.globalItems.homeButton);
|
||||
await page.selectModule('entry');
|
||||
await page.accessToSearchResult('2');
|
||||
await page.waitForState('entry.card.summary');
|
||||
});
|
||||
|
||||
it('should click the entries button to be redirected to the entries index filtered by the current supplier', async() => {
|
||||
await page.waitToClick(selectors.entryDescriptor.entriesQuicklink);
|
||||
await page.expectURL('/entry/index');
|
||||
await page.expectURL('supplierFk');
|
||||
await page.expectURL('to');
|
||||
await page.expectURL('from');
|
||||
});
|
||||
});
|
|
@ -1,116 +0,0 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Entry lastest buys path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
const httpRequests = [];
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
page.on('request', req => {
|
||||
if (req.url().includes(`Buys/latestBuysFilter`))
|
||||
httpRequests.push(req.url());
|
||||
});
|
||||
await page.loginAndModule('buyer', 'entry');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should access the latest buys seccion and search not seeing the edit buys button yet', async() => {
|
||||
await page.waitToClick(selectors.entryLatestBuys.latestBuysSectionButton);
|
||||
await page.waitForSelector(selectors.entryLatestBuys.editBuysButton, {visible: false});
|
||||
});
|
||||
|
||||
it('should filter by name', async() => {
|
||||
await page.write(selectors.entryLatestBuys.generalSearchInput, 'Melee');
|
||||
await page.keyboard.press('Enter');
|
||||
await page.waitToClick(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('search=Melee')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should filter by reign and type', async() => {
|
||||
await page.click(selectors.entryLatestBuys.firstReignIcon);
|
||||
await page.autocompleteSearch(selectors.entryLatestBuys.typeInput, 'Alstroemeria');
|
||||
await page.click(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('categoryFk')))).toBeDefined();
|
||||
expect(httpRequests.find(req => req.includes(('typeFk')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should filter by sales person', async() => {
|
||||
await page.autocompleteSearch(selectors.entryLatestBuys.salesPersonInput, 'buyerNick');
|
||||
await page.waitToClick(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('salesPersonFk')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should filter by supplier', async() => {
|
||||
await page.autocompleteSearch(selectors.entryLatestBuys.supplierInput, 'Farmer King');
|
||||
await page.waitToClick(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('supplierFk')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should filter by active', async() => {
|
||||
await page.waitToClick(selectors.entryLatestBuys.activeCheck);
|
||||
await page.waitToClick(selectors.entryLatestBuys.activeCheck);
|
||||
await page.waitToClick(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('active=true')))).toBeDefined();
|
||||
expect(httpRequests.find(req => req.includes(('active=false')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should filter by visible', async() => {
|
||||
await page.waitToClick(selectors.entryLatestBuys.visibleCheck);
|
||||
await page.waitToClick(selectors.entryLatestBuys.visibleCheck);
|
||||
await page.waitToClick(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('visible=true')))).toBeDefined();
|
||||
expect(httpRequests.find(req => req.includes(('visible=false')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should filter by floramondo', async() => {
|
||||
await page.waitToClick(selectors.entryLatestBuys.floramondoCheck);
|
||||
await page.waitToClick(selectors.entryLatestBuys.floramondoCheck);
|
||||
await page.waitToClick(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('floramondo=true')))).toBeDefined();
|
||||
expect(httpRequests.find(req => req.includes(('floramondo=false')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should filter by tag Color', async() => {
|
||||
await page.waitToClick(selectors.entryLatestBuys.addTagButton);
|
||||
await page.autocompleteSearch(selectors.entryLatestBuys.itemTagInput, 'Color');
|
||||
await page.autocompleteSearch(selectors.entryLatestBuys.itemTagValueInput, 'Brown');
|
||||
await page.waitToClick(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('tags')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should select all lines but one and then check the edit buys button appears', async() => {
|
||||
await page.waitToClick(selectors.entryLatestBuys.allBuysCheckBox);
|
||||
await page.waitToClick(selectors.entryLatestBuys.secondBuyCheckBox);
|
||||
await page.waitForSelector(selectors.entryLatestBuys.editBuysButton, {visible: true});
|
||||
});
|
||||
|
||||
it('should open the edit dialog', async() => {
|
||||
await page.waitToClick(selectors.entryLatestBuys.editBuysButton);
|
||||
await page.waitForSelector(selectors.entryLatestBuys.fieldAutocomplete, {visible: true});
|
||||
});
|
||||
|
||||
it('should search for the "Description" and type a new one for the items in each selected buy', async() => {
|
||||
await page.autocompleteSearch(selectors.entryLatestBuys.fieldAutocomplete, 'Description');
|
||||
await page.write(selectors.entryLatestBuys.newValueInput, 'Crafted item');
|
||||
await page.waitToClick(selectors.entryLatestBuys.acceptEditBuysDialog);
|
||||
});
|
||||
|
||||
it('should navigate to the entry.buy section by clicking one of the buys', async() => {
|
||||
await page.waitToClick(selectors.entryLatestBuys.firstBuy);
|
||||
await page.waitForState('entry.card.buy.index');
|
||||
});
|
||||
});
|
|
@ -1,34 +0,0 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Entry create path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'entry');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should click the create entry button to open the form', async() => {
|
||||
await page.waitToClick(selectors.entryIndex.createEntryButton);
|
||||
await page.waitForState('entry.create');
|
||||
});
|
||||
|
||||
it('should fill the form to create a valid entry then redirect to basic Data', async() => {
|
||||
await page.autocompleteSearch(selectors.entryIndex.newEntrySupplier, 'The farmer');
|
||||
await page.autocompleteSearch(selectors.entryIndex.newEntryTravel, 'Warehouse');
|
||||
await page.autocompleteSearch(selectors.entryIndex.newEntryCompany, 'ORN');
|
||||
|
||||
await page.waitToClick(selectors.entryIndex.saveNewEntry);
|
||||
await page.waitForNavigation({
|
||||
waitUntil: 'load',
|
||||
});
|
||||
await page.waitForState('entry.card.basicData');
|
||||
});
|
||||
});
|
|
@ -1,81 +0,0 @@
|
|||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
const $ = {
|
||||
reference: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.reference"]',
|
||||
invoiceNumber: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.invoiceNumber"]',
|
||||
notes: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.notes"]',
|
||||
observations: 'vn-entry-basic-data vn-textarea[ng-model="$ctrl.entry.observation"]',
|
||||
supplier: 'vn-entry-basic-data vn-autocomplete[ng-model="$ctrl.entry.supplierFk"]',
|
||||
currency: 'vn-entry-basic-data vn-autocomplete[ng-model="$ctrl.entry.currencyFk"]',
|
||||
commission: 'vn-entry-basic-data vn-input-number[ng-model="$ctrl.entry.commission"]',
|
||||
company: 'vn-entry-basic-data vn-autocomplete[ng-model="$ctrl.entry.companyFk"]',
|
||||
ordered: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isOrdered"]',
|
||||
confirmed: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isConfirmed"]',
|
||||
inventory: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isExcludedFromAvailable"]',
|
||||
raid: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isRaid"]',
|
||||
booked: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isBooked"]',
|
||||
save: 'vn-entry-basic-data button[type=submit]',
|
||||
};
|
||||
|
||||
describe('Entry basic data path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'entry');
|
||||
await page.accessToSearchResult('2');
|
||||
await page.accessToSection('entry.card.basicData');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should edit the basic data and confirm the reference was edited', async() => {
|
||||
await page.write($.reference, 'new movement 8');
|
||||
await page.write($.invoiceNumber, 'new movement 8');
|
||||
await page.write($.observations, ' edited');
|
||||
await page.autocompleteSearch($.supplier, 'Plants nick');
|
||||
await page.autocompleteSearch($.currency, 'eur');
|
||||
await page.clearInput($.commission);
|
||||
await page.write($.commission, '100');
|
||||
await page.autocompleteSearch($.company, 'CCs');
|
||||
await page.waitToClick($.ordered);
|
||||
await page.waitToClick($.confirmed);
|
||||
await page.waitToClick($.inventory);
|
||||
await page.waitToClick($.raid);
|
||||
await page.waitToClick($.booked);
|
||||
await page.waitToClick($.save);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
await page.reloadSection('entry.card.basicData');
|
||||
const reference = await page.waitToGetProperty($.reference, 'value');
|
||||
const supplier = await page.waitToGetProperty($.supplier, 'value');
|
||||
const invoiceNumber = await page.waitToGetProperty($.invoiceNumber, 'value');
|
||||
const observations = await page.waitToGetProperty($.observations, 'value');
|
||||
const currency = await page.waitToGetProperty($.currency, 'value');
|
||||
const commission = await page.waitToGetProperty($.commission, 'value');
|
||||
const company = await page.waitToGetProperty($.company, 'value');
|
||||
const ordered = await page.checkboxState($.ordered);
|
||||
const confirmed = await page.checkboxState($.confirmed);
|
||||
const inventory = await page.checkboxState($.inventory);
|
||||
const raid = await page.checkboxState($.raid);
|
||||
const booked = await page.checkboxState($.booked);
|
||||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
expect(reference).toEqual('new movement 8');
|
||||
expect(supplier).toEqual('Plants nick');
|
||||
expect(invoiceNumber).toEqual('new movement 8');
|
||||
expect(observations).toEqual('observation two edited');
|
||||
expect(currency).toEqual('EUR');
|
||||
expect(commission).toEqual('100');
|
||||
expect(company).toEqual('CCs');
|
||||
expect(ordered).toBe('checked');
|
||||
expect(confirmed).toBe('checked');
|
||||
expect(inventory).toBe('checked');
|
||||
expect(raid).toBe('checked');
|
||||
expect(booked).toBe('unchecked');
|
||||
});
|
||||
});
|
|
@ -1,65 +0,0 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Entry observations path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'entry');
|
||||
await page.accessToSearchResult('2');
|
||||
await page.accessToSection('entry.card.observation');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should add two new observations of the same type then fail to save as they can't be repeated`, async() => {
|
||||
await page.waitToClick(selectors.entryObservations.addNewObservation);
|
||||
await page.waitToClick(selectors.entryObservations.addNewObservation);
|
||||
await page.autocompleteSearch(selectors.entryObservations.firstObservationType, 'SalesPerson');
|
||||
await page.autocompleteSearch(selectors.entryObservations.secondObservationType, 'SalesPerson');
|
||||
await page.write(selectors.entryObservations.firstObservationDescription, 'first observation');
|
||||
await page.write(selectors.entryObservations.secondObservationDescription, 'second observation');
|
||||
await page.waitToClick(selectors.entryObservations.saveObservationsButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain(`The observation type can't be repeated`);
|
||||
});
|
||||
|
||||
it('should set the 2nd observation of a different one and successfully save both', async() => {
|
||||
await page.autocompleteSearch(selectors.entryObservations.secondObservationType, 'Delivery');
|
||||
await page.waitToClick(selectors.entryObservations.saveObservationsButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should reload the section and make sure the first observation type was saved correctly', async() => {
|
||||
await page.reloadSection('entry.card.observation');
|
||||
const result = await page.waitToGetProperty(selectors.entryObservations.firstObservationType, 'value');
|
||||
|
||||
expect(result).toEqual('SalesPerson');
|
||||
});
|
||||
|
||||
it('should make sure the first observation description was saved correctly', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.entryObservations.firstObservationDescription, 'value');
|
||||
|
||||
expect(result).toEqual('first observation');
|
||||
});
|
||||
|
||||
it('should make sure the second observation type was saved correctly', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.entryObservations.secondObservationType, 'value');
|
||||
|
||||
expect(result).toEqual('Delivery');
|
||||
});
|
||||
|
||||
it('should make sure the second observation description was saved correctly', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.entryObservations.secondObservationDescription, 'value');
|
||||
|
||||
expect(result).toEqual('second observation');
|
||||
});
|
||||
});
|
|
@ -1,69 +0,0 @@
|
|||
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('3');
|
||||
});
|
||||
|
||||
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(2);
|
||||
});
|
||||
|
||||
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 a JSON file and select items for each import and confirm import', async() => {
|
||||
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.waitForTextInField(selectors.entryBuys.ref, '200573095, 200573106, 200573117, 200573506');
|
||||
await page.waitForTextInField(selectors.entryBuys.observation, '729-6340 2846');
|
||||
|
||||
await page.autocompleteSearch(selectors.entryBuys.firstImportedItem, 'Ranged weapon longbow 200cm');
|
||||
await page.autocompleteSearch(selectors.entryBuys.secondImportedItem, 'Ranged weapon longbow 200cm');
|
||||
await page.autocompleteSearch(selectors.entryBuys.thirdImportedItem, 'Ranged weapon sniper rifle 113cm');
|
||||
await page.autocompleteSearch(selectors.entryBuys.fourthImportedItem, 'Melee weapon heavy shield 100cm');
|
||||
|
||||
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, 6);
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
|
@ -1,3 +1,24 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="Entries/filter"
|
||||
limit="20"
|
||||
auto-load="true"
|
||||
order="landed DESC, id DESC">
|
||||
</vn-crud-model>
|
||||
<vn-portal slot="topbar">
|
||||
<vn-searchbar
|
||||
vn-focus
|
||||
panel="vn-entry-search-panel"
|
||||
info="Search entry by id or a suppliers by name or alias"
|
||||
model="model">
|
||||
</vn-searchbar>
|
||||
</vn-portal>
|
||||
<vn-portal slot="menu">
|
||||
<vn-left-menu></vn-left-menu>
|
||||
</vn-portal>
|
||||
<ui-view></ui-view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,10 +2,7 @@ import ngModule from '../module';
|
|||
import ModuleMain from 'salix/components/module-main';
|
||||
|
||||
export default class Entry extends ModuleMain {
|
||||
async $onInit() {
|
||||
this.$state.go('home');
|
||||
window.location.href = await this.vnApp.getUrl(`entry/`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ngModule.vnComponent('vnEntry', {
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
Delete travel
|
||||
</vn-item>
|
||||
<a class="vn-item"
|
||||
ui-sref="entry.create({travelFk: $ctrl.travel.id})"
|
||||
name="addEntry"
|
||||
ng-click="$ctrl.redirectToCreateEntry()"
|
||||
translate>
|
||||
Add entry
|
||||
</a>
|
||||
|
@ -35,7 +35,7 @@
|
|||
</vn-menu>
|
||||
|
||||
<!-- Clone travel popup -->
|
||||
<vn-confirm
|
||||
<vn-confirm
|
||||
vn-id="clone"
|
||||
on-accept="$ctrl.onCloneAccept()"
|
||||
question="Do you want to clone this travel?"
|
||||
|
@ -43,7 +43,7 @@
|
|||
</vn-confirm>
|
||||
|
||||
<!-- Delete travel popup -->
|
||||
<vn-confirm
|
||||
<vn-confirm
|
||||
vn-id="delete"
|
||||
on-accept="$ctrl.onDeleteAccept()"
|
||||
question="Do you want to delete this travel?"
|
||||
|
@ -51,7 +51,7 @@
|
|||
</vn-confirm>
|
||||
|
||||
<!-- Clone travel popup -->
|
||||
<vn-confirm
|
||||
<vn-confirm
|
||||
vn-id="cloneWithEntries"
|
||||
on-accept="$ctrl.onCloneWithEntriesAccept()"
|
||||
question="Do you want to clone this travel and all containing entries?"
|
||||
|
|
|
@ -73,6 +73,11 @@ class Controller extends Section {
|
|||
this.$state.go('travel.create', {q: params});
|
||||
}
|
||||
|
||||
async redirectToCreateEntry() {
|
||||
this.$state.go('home');
|
||||
window.location.href = await this.vnApp.getUrl(`entry/create?travelFk=${this.travelId}`);
|
||||
}
|
||||
|
||||
onCloneWithEntriesAccept() {
|
||||
this.$http.post(`Travels/${this.travelId}/cloneWithEntries`)
|
||||
.then(res => this.$state.go('travel.card.basicData', {id: res.data}));
|
||||
|
|
Loading…
Reference in New Issue