customs agent e2e path + small fixes
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
dfa6472fcf
commit
9bf509cd5d
|
@ -1 +1,4 @@
|
||||||
UPDATE `salix`.`ACL` SET `accessType`='WRITE' WHERE `id`='213';
|
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');
|
||||||
|
|
||||||
|
|
|
@ -122,6 +122,12 @@ export default {
|
||||||
mobileInput: 'vn-textfield[ng-model="$ctrl.address.mobile"]',
|
mobileInput: 'vn-textfield[ng-model="$ctrl.address.mobile"]',
|
||||||
defaultAddress: 'vn-client-address-index div:nth-child(1) div[name="street"]',
|
defaultAddress: 'vn-client-address-index div:nth-child(1) div[name="street"]',
|
||||||
incoterms: 'vn-autocomplete[ng-model="$ctrl.address.incotermsId"]',
|
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"]',
|
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"]',
|
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',
|
firstEditAddress: 'vn-client-address-index div:nth-child(1) > a',
|
||||||
|
|
|
@ -61,12 +61,18 @@ describe('Client Add address path', () => {
|
||||||
expect(message.text).toBe('Customs agent is required for a non UEE member');
|
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() => {
|
it(`should create a new custom agent and then save the address`, async() => {
|
||||||
await page.autocompleteSearch(selectors.clientAddresses.customsAgent, 'Agent one');
|
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);
|
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||||
const message = await page.waitForSnackbar();
|
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() => {
|
it(`should navigate back to the addresses index`, async() => {
|
||||||
|
|
|
@ -29,7 +29,7 @@ export default class Controller extends Section {
|
||||||
|
|
||||||
onCustomAgentAccept() {
|
onCustomAgentAccept() {
|
||||||
return this.$http.post(`CustomsAgents`, this.newCustomsAgent)
|
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() {
|
get town() {
|
||||||
|
|
|
@ -123,7 +123,7 @@ describe('Client', () => {
|
||||||
controller.onCustomAgentAccept();
|
controller.onCustomAgentAccept();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.address.customsAgentFk).toEqual(1);
|
expect(controller.address.customsAgentId).toEqual(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -64,7 +64,7 @@ describe('Client', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('onCustomAgentAccept()', () => {
|
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'};
|
const expectedResult = {id: 1, fiscalName: 'Customs agent one'};
|
||||||
$httpBackend.when('POST', 'CustomsAgents').respond(200, expectedResult);
|
$httpBackend.when('POST', 'CustomsAgents').respond(200, expectedResult);
|
||||||
controller.onCustomAgentAccept();
|
controller.onCustomAgentAccept();
|
||||||
|
|
Loading…
Reference in New Issue