#186 cancel button + e2e path refactor CR pending

This commit is contained in:
Carlos Jimenez 2018-04-22 16:25:44 +02:00
parent 03c61bb30f
commit 27a08dc2a1
7 changed files with 84 additions and 3 deletions

View File

@ -41,5 +41,11 @@
</vn-card>
<vn-button-bar>
<vn-submit label="Save"></vn-submit>
<button
class="mdl-button mdl-button--raised mdl-button--colored"
translate
ui-sref="clientCard.addresses.list"
>Cancel
</button>
</vn-button-bar>
</form>

View File

@ -60,6 +60,12 @@
</vn-card>
<vn-button-bar>
<vn-submit label="Create"></vn-submit>
<button
class="mdl-button mdl-button--raised mdl-button--colored"
translate
ui-sref="clients"
>Cancel
</button>
</vn-button-bar>
</div>
</form>

View File

@ -44,6 +44,12 @@
</vn-card>
<vn-button-bar>
<vn-submit label="Create"></vn-submit>
<button
class="mdl-button mdl-button--raised mdl-button--colored"
translate
ui-sref="item.index"
>Cancel
</button>
</vn-button-bar>
</div>
</form>

View File

@ -29,7 +29,8 @@ export default {
email: `${components.vnTextfield}[name="email"]`,
salesPersonInput: `vn-autocomplete[field="$ctrl.client.salesPersonFk"] input`,
salesBruceBannerOption: `vn-autocomplete[field="$ctrl.client.salesPersonFk"] vn-drop-down ul > li:nth-child(1)`,
createButton: `${components.vnSubmit}`
createButton: `${components.vnSubmit}`,
cancelButton: `button[href="#!/clients"]`
},
clientBasicData: {
basicDataButton: `${components.vnMenuItem}[ui-sref="clientCard.basicData"]`,
@ -110,7 +111,8 @@ export default {
thirdObservationTypeSelectOptionThree: `${components.vnAutocomplete}[field="observation.observationTypeFk"] vn-drop-down ul > li:nth-child(3)`,
thirdObservationDescriptionInput: `vn-horizontal:nth-child(5) > vn-textfield[label="Description"] > div > input`,
addObservationButton: `${components.vnIcon}[icon="add_circle"]`,
saveButton: `${components.vnSubmit}`
saveButton: `${components.vnSubmit}`,
cancelButton: `button[ui-sref="clientCard.addresses.list"]`
},
clientWebAccess: {
webAccessButton: `${components.vnMenuItem}[ui-sref="clientCard.webAccess"]`,
@ -168,7 +170,8 @@ export default {
intrastatSelectOptionOne: `${components.vnAutocomplete}[field="$ctrl.item.intrastatFk"] vn-drop-down ul > li:nth-child(2)`,
originSelect: `${components.vnAutocomplete}[field="$ctrl.item.originFk"] input`,
originSelectOptionOne: `${components.vnAutocomplete}[field="$ctrl.item.originFk"] vn-drop-down ul > li:nth-child(2)`,
createButton: `${components.vnSubmit}`
createButton: `${components.vnSubmit}`,
cancelButton: `button[ui-sref="item.index"]`
},
itemBasicData: {

View File

@ -42,6 +42,26 @@ describe('Client', () => {
});
});
it('should return to the client index by clicking the cancel button', () => {
return nightmare
.click(selectors.createClientView.cancelButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/clients');
});
});
it('should now access to the create client view by clicking the create-client floating button', () => {
return nightmare
.click(selectors.clientsIndex.createClientButton)
.wait(selectors.createClientView.createButton)
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/create');
});
});
it('should receive an error when clicking the create button having all the form fields empty', () => {
return nightmare
.click(selectors.createClientView.createButton)

View File

@ -56,6 +56,26 @@ describe('Client', () => {
});
});
it(`should return to the addreses section by clicking the cancel button`, () => {
return nightmare
.waitToClick(selectors.clientAddresses.cancelButton)
.waitForURL('addresses/list')
.url()
.then(url => {
expect(url).toContain('addresses/list');
});
});
it(`should now click on the add new address button to access to the new address form`, () => {
return nightmare
.waitToClick(selectors.clientAddresses.createAddress)
.waitForURL('addresses/create')
.url()
.then(url => {
expect(url).toContain('addresses/create');
});
});
it('should receive an error after clicking save button as consignee, street and town fields are empty', () => {
return nightmare
.waitToClick(selectors.clientAddresses.defaultCheckboxInput)

View File

@ -41,6 +41,26 @@ describe('Item', () => {
});
});
it('should return to the item index by clickig the cancel button', () => {
return nightmare
.click(selectors.itemCreateView.cancelButton)
.wait(selectors.itemsIndex.createItemButton)
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/item/list');
});
});
it('should now access to the create item view by clicking the create floating button', () => {
return nightmare
.click(selectors.itemsIndex.createItemButton)
.wait(selectors.itemCreateView.createButton)
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/item/create');
});
});
it('should create the Infinity Gauntlet item', () => {
return nightmare
.type(selectors.itemCreateView.name, 'Infinity Gauntlet')