#775 e2e client.log

This commit is contained in:
Carlos Jimenez 2018-10-30 10:22:47 +01:00
parent 82f58c8bc0
commit 3ab11cffc5
2 changed files with 119 additions and 36 deletions

View File

@ -7,18 +7,18 @@ export default {
applicationsMenuVisible: `vn-main-menu [vn-id="apps-menu"] ul`,
clientsButton: `vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="client.index"]`,
ticketsButton: `vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="ticket.index"]`,
claimsButton: `vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="claim.index"]`,
claimsButton: `vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="claim.index"]`
},
moduleAccessView: {
clientsSectionButton: `vn-home a[ui-sref="client.index"]`,
itemsSectionButton: `vn-home a[ui-sref="item.index"]`,
ticketsSectionButton: `vn-home a[ui-sref="ticket.index"]`,
ticketsSectionButton: `vn-home a[ui-sref="ticket.index"]`
},
clientsIndex: {
searchClientInput: `${components.vnTextfield}`,
searchButton: `vn-searchbar vn-icon[icon="search"]`,
searchResult: `vn-item-client a`,
createClientButton: `${components.vnFloatButton}`,
createClientButton: `${components.vnFloatButton}`
},
createClientView: {
name: `${components.vnTextfield}[name="name"]`,
@ -29,7 +29,7 @@ export default {
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}`,
cancelButton: `vn-button[href="#!/client/index"]`,
cancelButton: `vn-button[href="#!/client/index"]`
},
clientBasicData: {
basicDataButton: `vn-menu-item a[ui-sref="client.card.basicData"]`,
@ -44,7 +44,7 @@ export default {
channelInput: `vn-autocomplete[field="$ctrl.client.contactChannelFk"] input`,
channelMetropolisOption: `vn-autocomplete[field="$ctrl.client.contactChannelFk"] vn-drop-down ul > li:nth-child(3)`,
channelRumorsOption: `vn-autocomplete[field="$ctrl.client.contactChannelFk"] vn-drop-down ul > li:nth-child(4)`,
saveButton: `${components.vnSubmit}`,
saveButton: `${components.vnSubmit}`
},
clientFiscalData: {
fiscalDataButton: `vn-menu-item a[ui-sref="client.card.fiscalData"]`,
@ -71,7 +71,7 @@ export default {
invoiceByMailCheckboxLabel: `vn-check[label='Invoice by mail'] > label`,
invoiceByMailCheckboxInput: `vn-check[label='Invoice by mail'] input`,
viesCheckboxInput: `vn-check[label='Vies'] > label > input`,
saveButton: `${components.vnSubmit}`,
saveButton: `${components.vnSubmit}`
},
clientPayMethod: {
payMethodButton: `vn-menu-item a[ui-sref="client.card.billingData"]`,
@ -88,7 +88,7 @@ export default {
newBankEntityName: 'vn-client-billing-data > vn-dialog vn-textfield[label="Name"] input',
newBankEntityBIC: 'vn-client-billing-data > vn-dialog vn-textfield[label="Swift / BIC"] input',
acceptBankEntityButton: 'vn-client-billing-data > vn-dialog button[response="ACCEPT"]',
saveButton: `${components.vnSubmit}`,
saveButton: `${components.vnSubmit}`
},
clientAddresses: {
addressesButton: `vn-menu-item a[ui-sref="client.card.address.index"]`,
@ -121,27 +121,27 @@ export default {
thirdObservationDescriptionInput: `vn-client-address-edit [name=observations] :nth-child(3) [model="observation.description"] input`,
addObservationButton: `vn-client-address-edit vn-icon-button[icon="add_circle"]`,
saveButton: `${components.vnSubmit}`,
cancelButton: `button[ui-sref="client.card.address.index"]`,
cancelButton: `button[ui-sref="client.card.address.index"]`
},
clientWebAccess: {
webAccessButton: `vn-menu-item a[ui-sref="client.card.webAccess"]`,
enableWebAccessCheckbox: `vn-check[label='Enable web access'] > label > input`,
userNameInput: `${components.vnTextfield}[name="name"]`,
saveButton: `${components.vnSubmit}`,
saveButton: `${components.vnSubmit}`
},
clientNotes: {
notesButton: `vn-menu-item a[ui-sref="client.card.note.index"]`,
addNoteFloatButton: `${components.vnFloatButton}`,
noteInput: `vn-textarea[label="Note"]`,
saveButton: `${components.vnSubmit}`,
firstNoteText: 'vn-client-note .text',
firstNoteText: 'vn-client-note .text'
},
clientCredit: {
creditButton: `vn-menu-item a[ui-sref="client.card.credit.index"]`,
addCreditFloatButton: `${components.vnFloatButton}`,
creditInput: `${components.vnTextfield}[name="credit"]`,
saveButton: `${components.vnSubmit}`,
firstCreditText: 'vn-client-credit-index vn-card > div vn-table vn-tbody > vn-tr',
firstCreditText: 'vn-client-credit-index vn-card > div vn-table vn-tbody > vn-tr'
},
clientGreuge: {
greugeButton: `vn-menu-item a[ui-sref="client.card.greuge.index"]`,
@ -151,15 +151,21 @@ export default {
typeInput: `vn-autocomplete[field="$ctrl.greuge.greugeTypeFk"] input`,
typeSecondOption: `vn-autocomplete[field="$ctrl.greuge.greugeTypeFk"] vn-drop-down ul > li`,
saveButton: `${components.vnSubmit}`,
firstGreugeText: 'vn-client-greuge-index vn-card > div vn-table vn-tbody > vn-tr',
firstGreugeText: 'vn-client-greuge-index vn-card > div vn-table vn-tbody > vn-tr'
},
clientMandate: {
mandateButton: `vn-menu-item a[ui-sref="client.card.mandate"]`,
firstMandateText: 'vn-client-mandate vn-card > div vn-table vn-tbody > vn-tr',
firstMandateText: 'vn-client-mandate vn-card > div vn-table vn-tbody > vn-tr'
},
clientInvoices: {
invoicesButton: `vn-menu-item a[ui-sref="client.card.invoice"]`,
firstInvoiceText: 'vn-client-invoice vn-card > div vn-table vn-tbody > vn-tr',
firstInvoiceText: 'vn-client-invoice vn-card > div vn-table vn-tbody > vn-tr'
},
clientLog: {
logButton: `vn-menu-item a[ui-sref="client.card.log"]`,
lastModificationPreviousValue: 'vn-client-log vn-table vn-td.before',
lastModificationCurrentValue: 'vn-client-log vn-table vn-td.after'
},
itemsIndex: {
goBackToModuleIndexButton: `vn-ticket-descriptor a[href="#!/ticket/index"]`,
@ -170,7 +176,7 @@ export default {
acceptClonationAlertButton: `vn-item-index [vn-id="clone"] [response="ACCEPT"]`,
searchItemInput: `vn-searchbar vn-textfield input`,
searchButton: `vn-searchbar vn-icon[icon="search"]`,
closeItemSummaryPreview: 'vn-item-index [vn-id="preview"] button.close',
closeItemSummaryPreview: 'vn-item-index [vn-id="preview"] button.close'
},
itemCreateView: {
name: `${components.vnTextfield}[name="name"]`,
@ -181,8 +187,7 @@ export default {
originSelect: `vn-autocomplete[field="$ctrl.item.originFk"] input`,
originSelectOptionOne: `vn-autocomplete[field="$ctrl.item.originFk"] vn-drop-down ul > li:nth-child(2)`,
createButton: `${components.vnSubmit}`,
cancelButton: `button[ui-sref="item.index"]`,
cancelButton: `button[ui-sref="item.index"]`
},
itemBasicData: {
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',
@ -199,7 +204,7 @@ export default {
expenceSelectOptionThree: `vn-autocomplete[field="$ctrl.item.expenceFk"] vn-drop-down ul > li:nth-child(3)`,
longNameInput: `vn-textfield[label="Full name"] input`,
isActiveCheckbox: `vn-check[label='Active'] > label > input`,
submitBasicDataButton: `${components.vnSubmit}`,
submitBasicDataButton: `${components.vnSubmit}`
},
itemTags: {
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',
@ -229,7 +234,7 @@ export default {
seventhValueInput: `vn-item-tags vn-horizontal:nth-child(8) > vn-textfield[label="Value"] input`,
seventhRelevancyInput: `vn-horizontal:nth-child(8) > vn-textfield[label="Relevancy"] input`,
addItemTagButton: `vn-icon-button[icon="add_circle"]`,
submitItemTagsButton: `${components.vnSubmit}`,
submitItemTagsButton: `${components.vnSubmit}`
},
itemTax: {
taxButton: `vn-menu-item a[ui-sref="item.card.tax"]`,
@ -239,14 +244,14 @@ export default {
secondClassSelectOptionOne: `vn-horizontal:nth-child(3) > vn-autocomplete vn-drop-down ul > li:nth-child(1)`,
thirdClassSelect: `vn-horizontal:nth-child(4) > vn-autocomplete[field="tax.taxClassFk"] input`,
thirdClassSelectOptionTwo: `vn-horizontal:nth-child(4) > vn-autocomplete vn-drop-down ul > li:nth-child(2)`,
submitTaxButton: `${components.vnSubmit}`,
submitTaxButton: `${components.vnSubmit}`
},
itemBarcodes: {
barcodeButton: `vn-menu-item a[ui-sref="item.card.itemBarcode"]`,
addBarcodeButton: `vn-icon[icon="add_circle"]`,
thirdCodeInput: `vn-item-barcode vn-horizontal:nth-child(4) > ${components.vnTextfield}`,
submitBarcodesButton: `${components.vnSubmit}`,
firstCodeRemoveButton: `vn-item-barcode vn-horizontal vn-none vn-icon[icon="remove_circle_outline"]`,
firstCodeRemoveButton: `vn-item-barcode vn-horizontal vn-none vn-icon[icon="remove_circle_outline"]`
},
itemNiches: {
nicheButton: `vn-menu-item a[ui-sref="item.card.niche"]`,
@ -260,7 +265,7 @@ export default {
thirdWarehouseSelect: `vn-horizontal:nth-child(4) > vn-autocomplete[field="niche.warehouseFk"] input`,
thirdWarehouseSelectFourthOption: `vn-horizontal:nth-child(4) > vn-autocomplete[field="niche.warehouseFk"] vn-drop-down ul > li:nth-child(4)`,
thirdCodeInput: `vn-horizontal:nth-child(4) > vn-textfield[label="Code"] input`,
submitNichesButton: `${components.vnSubmit}`,
submitNichesButton: `${components.vnSubmit}`
},
itemBotanical: {
botanicalButton: `vn-menu-item a[ui-sref="item.card.botanical"]`,
@ -271,7 +276,7 @@ export default {
speciesSelect: `vn-autocomplete[field="$ctrl.botanical.specieFk"] input`,
speciesSelectOptionOne: `vn-autocomplete[field="$ctrl.botanical.specieFk"] vn-drop-down ul > li:nth-child(1)`,
speciesSelectOptionTwo: `vn-autocomplete[field="$ctrl.botanical.specieFk"] vn-drop-down ul > li:nth-child(2)`,
submitBotanicalButton: `${components.vnSubmit}`,
submitBotanicalButton: `${components.vnSubmit}`
},
itemSummary: {
basicData: `vn-item-summary vn-vertical[name="basicData"]`,
@ -279,14 +284,14 @@ export default {
tags: `vn-item-summary vn-vertical[name="tags"]`,
niche: `vn-item-summary vn-vertical[name="niche"]`,
botanical: `vn-item-summary vn-vertical[name="botanical"]`,
barcode: `vn-item-summary vn-vertical[name="barcode"]`,
barcode: `vn-item-summary vn-vertical[name="barcode"]`
},
ticketsIndex: {
searchResult: `vn-ticket-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr`,
searchResultDate: `vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)`,
searchResultAddress: `vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(6)`,
searchTicketInput: `vn-ticket-index ${components.vnTextfield}`,
searchButton: `vn-ticket-index vn-searchbar vn-icon[icon="search"]`,
searchButton: `vn-ticket-index vn-searchbar vn-icon[icon="search"]`
},
ticketNotes: {
notesButton: `vn-menu-item a[ui-sref="ticket.card.observation"]`,
@ -295,13 +300,13 @@ export default {
firstNoteSelect: `vn-autocomplete[field="observation.observationTypeFk"] input`,
firstNoteSelectSecondOption: `vn-autocomplete[field="observation.observationTypeFk"] vn-drop-down ul > li:nth-child(2)`,
firstDescriptionInput: `vn-textfield[label="Description"] input`,
submitNotesButton: `${components.vnSubmit}`,
submitNotesButton: `${components.vnSubmit}`
},
ticketExpedition: {
expeditionButton: `vn-menu-item a[ui-sref="ticket.card.expedition"]`,
secondExpeditionRemoveButton: `vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button[icon="delete"]`,
acceptDeleteRowButton: `vn-ticket-expedition > vn-confirm[vn-id="delete-expedition"] button[response=ACCEPT]`,
expeditionRow: `vn-ticket-expedition vn-table vn-tbody > vn-tr`,
expeditionRow: `vn-ticket-expedition vn-table vn-tbody > vn-tr`
},
ticketPackages: {
packagesButton: `vn-menu-item a[ui-sref="ticket.card.package.index"]`,
@ -311,7 +316,7 @@ export default {
firstRemovePackageButton: `vn-icon[vn-tooltip="Remove package"]`,
addPackageButton: `vn-icon-button[vn-tooltip="Add package"]`,
clearPackageSelectButton: `vn-autocomplete[label="Package"] > div > div > div > vn-icon > i`,
savePackagesButton: `${components.vnSubmit}`,
savePackagesButton: `${components.vnSubmit}`
},
ticketSales: {
saleLine: `vn-table div > vn-tbody > vn-tr`,
@ -359,7 +364,7 @@ export default {
moreMenuUnmarkResevedOption: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(5)',
moreMenuUpdateDiscount: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(6)',
moreMenuUpdateDiscountInput: 'vn-ticket-sale vn-dialog.shown vn-ticket-sale-edit-discount input',
moreMenuCreateClaim: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(1)',
moreMenuCreateClaim: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(1)'
},
ticketTracking: {
trackingButton: `vn-left-menu a[ui-sref="ticket.card.tracking.index"]`,
@ -367,7 +372,7 @@ export default {
stateSelect: 'vn-ticket-tracking-edit vn-autocomplete[field="$ctrl.ticket.stateFk"] input',
stateSelectInput: 'vn-ticket-tracking-edit vn-autocomplete > vn-drop-down > vn-popover vn-textfield input',
stateSelectFirstResult: 'vn-ticket-tracking-edit vn-autocomplete > vn-drop-down > vn-popover ul > li:nth-child(1)',
saveButton: `${components.vnSubmit}`,
saveButton: `${components.vnSubmit}`
},
ticketBasicData: {
basicDataButton: `vn-menu-item a[ui-sref="ticket.card.data.stepOne"]`,
@ -382,24 +387,24 @@ export default {
stepTwoTotalPriceDif: `vn-ticket-data-step-two > form > vn-card > div > vn-horizontal > table > tfoot > tr > td:nth-child(4)`,
chargesReason: `vn-autocomplete[field="$ctrl.ticket.option"] input`,
chargesReasonFourthOption: `vn-autocomplete[field="$ctrl.ticket.option"] vn-drop-down ul > li:nth-child(4)`,
chargesReasonFirstOption: `vn-autocomplete[field="$ctrl.ticket.option"] vn-drop-down ul > li:nth-child(1)`,
chargesReasonFirstOption: `vn-autocomplete[field="$ctrl.ticket.option"] vn-drop-down ul > li:nth-child(1)`
},
ticketComponents: {
componentsButton: `vn-menu-item a[ui-sref="ticket.card.components"]`,
base: 'vn-ticket-components tfoot > tr:nth-child(1) > td',
margin: 'vn-ticket-components tfoot > tr:nth-child(2) > td',
total: 'vn-ticket-components tfoot > tr:nth-child(3) > td',
total: 'vn-ticket-components tfoot > tr:nth-child(3) > td'
},
createStateView: {
stateInput: `vn-autocomplete[field="$ctrl.ticket.stateFk"] > div > div > input`,
stateInputOptionOne: `vn-autocomplete[field="$ctrl.ticket.stateFk"] vn-drop-down ul > li:nth-child(1)`,
clearStateInputButton: `vn-autocomplete[field="$ctrl.ticket.stateFk"] > div > div > div > vn-icon > i`,
saveStateButton: `${components.vnSubmit}`,
saveStateButton: `${components.vnSubmit}`
},
claimsIndex: {
searchClaimInput: `vn-claim-index ${components.vnTextfield}`,
searchResult: `vn-claim-index vn-card > div > vn-table > div > vn-tbody > vn-tr`,
searchButton: `vn-claim-index vn-searchbar vn-icon[icon="search"]`,
searchButton: `vn-claim-index vn-searchbar vn-icon[icon="search"]`
},
claimBasicData: {
basicDataButton: `vn-menu-item a[ui-sref="claim.card.basicData"]`,
@ -409,10 +414,10 @@ export default {
isPaidWithManaCheckbox: `vn-check[field="$ctrl.claim.isChargedToMana"] > label > input`,
responsabilityInputRange: `vn-input-range`,
observationInput: `vn-textarea[label="Observation"] textarea`,
saveButton: `${components.vnSubmit}`,
saveButton: `${components.vnSubmit}`
},
claimDetails: {
detailsButton: `vn-menu-item a[ui-sref="claim.card.detail"]`,
addItemButton: `vn-claim-detail a vn-float-button`,
addItemButton: `vn-claim-detail a vn-float-button`
},
};

View File

@ -0,0 +1,78 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Client log path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('employee');
});
it('should click on the Clients button of the top bar menu', async () => {
let url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
});
it('should search for the user David Charles Haller', async () => {
let resultCount = await nightmare
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'DavidCharlesHaller')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the client's fiscal data`, async () => {
let url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'DavidCharlesHaller')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientBasicData.basicDataButton)
.waitForURL('basic-data')
.parsedUrl();
expect(url.hash).toContain('basic-data');
});
it('should update the clients name', async () => {
let result = await nightmare
.wait(selectors.clientBasicData.nameInput)
.clearInput(selectors.clientBasicData.nameInput)
.type(selectors.clientBasicData.nameInput, 'this is a test')
.waitToClick(selectors.clientBasicData.saveButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should navigate to the log section', async () => {
let url = await nightmare
.waitToClick(selectors.clientLog.logButton)
.waitForURL('log')
.parsedUrl();
expect(url.hash).toContain('log');
});
it('should check the previous value of the last logged change', async () => {
let lastModificationPreviousValue = await nightmare
.getInnerText(selectors.clientLog.lastModificationPreviousValue);
expect(lastModificationPreviousValue).toContain('DavidCharlesHaller');
});
it('should check the current value of the last logged change', async () => {
let lastModificationCurrentValue = await nightmare
.getInnerText(selectors.clientLog.lastModificationCurrentValue);
expect(lastModificationCurrentValue).toContain('this is a test');
});
});