customs agent e2e path + small fixes
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2020-05-28 09:54:31 +02:00
parent dfa6472fcf
commit 9bf509cd5d
6 changed files with 21 additions and 6 deletions

View File

@ -1 +1,4 @@
UPDATE `salix`.`ACL` SET `accessType`='WRITE' WHERE `id`='213';
INSERT IGNORE INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('CustomsAgent', '*', '*', 'ALLOW', 'ROLE', 'employee');

View File

@ -122,6 +122,12 @@ export default {
mobileInput: 'vn-textfield[ng-model="$ctrl.address.mobile"]',
defaultAddress: 'vn-client-address-index div:nth-child(1) div[name="street"]',
incoterms: 'vn-autocomplete[ng-model="$ctrl.address.incotermsId"]',
addNewCustomsAgent: 'vn-client-address-create vn-autocomplete[ng-model="$ctrl.address.customsAgentId"] vn-icon-button[icon="add_circle"]',
newCustomsAgentFiscalID: 'vn-textfield[ng-model="$ctrl.newCustomsAgent.nif"]',
newCustomsAgentFiscalName: 'vn-textfield[ng-model="$ctrl.newCustomsAgent.fiscalName"]',
newCustomsAgentStreet: 'vn-textfield[ng-model="$ctrl.newCustomsAgent.street"]',
newCustomsAgentPhone: 'vn-textfield[ng-model="$ctrl.newCustomsAgent.phone"]',
saveNewCustomsAgentButton: 'button[response="accept"]',
customsAgent: 'vn-autocomplete[ng-model="$ctrl.address.customsAgentId"]',
secondMakeDefaultStar: 'vn-client-address-index vn-card div:nth-child(2) vn-icon-button[icon="star_border"]',
firstEditAddress: 'vn-client-address-index div:nth-child(1) > a',

View File

@ -61,12 +61,18 @@ describe('Client Add address path', () => {
expect(message.text).toBe('Customs agent is required for a non UEE member');
});
it(`should create a new address with all it's data`, async() => {
await page.autocompleteSearch(selectors.clientAddresses.customsAgent, 'Agent one');
it(`should create a new custom agent and then save the address`, async() => {
await page.waitToClick(selectors.clientAddresses.addNewCustomsAgent);
await page.write(selectors.clientAddresses.newCustomsAgentFiscalID, 'ID');
await page.write(selectors.clientAddresses.newCustomsAgentFiscalName, 'name');
await page.write(selectors.clientAddresses.newCustomsAgentStreet, 'street');
await page.write(selectors.clientAddresses.newCustomsAgentPhone, '555555555');
await page.waitToClick(selectors.clientAddresses.saveNewCustomsAgentButton);
await page.waitToClick(selectors.clientAddresses.saveButton);
const message = await page.waitForSnackbar();
expect(message.type).toBe('success');
expect(message.text).toBe('Data saved!');
});
it(`should navigate back to the addresses index`, async() => {

View File

@ -29,7 +29,7 @@ export default class Controller extends Section {
onCustomAgentAccept() {
return this.$http.post(`CustomsAgents`, this.newCustomsAgent)
.then(res => this.address.customsAgentFk = res.data.id);
.then(res => this.address.customsAgentId = res.data.id);
}
get town() {

View File

@ -123,7 +123,7 @@ describe('Client', () => {
controller.onCustomAgentAccept();
$httpBackend.flush();
expect(controller.address.customsAgentFk).toEqual(1);
expect(controller.address.customsAgentId).toEqual(1);
});
});
});

View File

@ -64,7 +64,7 @@ describe('Client', () => {
});
describe('onCustomAgentAccept()', () => {
it(`should create a new customs agent and then set the customsAgentFk property on the address`, () => {
it(`should now create a new customs agent and then set the customsAgentFk property on the address`, () => {
const expectedResult = {id: 1, fiscalName: 'Customs agent one'};
$httpBackend.when('POST', 'CustomsAgents').respond(200, expectedResult);
controller.onCustomAgentAccept();