#942 e2e client.descriptor

This commit is contained in:
Carlos Jimenez 2019-01-16 15:02:50 +01:00
parent 3a38156fe6
commit b53dcc80be
8 changed files with 92 additions and 54 deletions

View File

@ -34,6 +34,10 @@ export default {
createButton: `${components.vnSubmit}`,
cancelButton: `vn-button[href="#!/client/index"]`
},
clientDescriptor: {
moreMenu: `vn-client-descriptor > vn-card > div vn-icon-menu > div > vn-icon`,
simpleTicketButton: 'vn-client-descriptor vn-popover > div > div.content > div > div.list > ul > li'
},
clientBasicData: {
basicDataButton: `vn-left-menu a[ui-sref="client.card.basicData"]`,
nameInput: `${components.vnTextfield}[name="name"]`,

View File

@ -11,7 +11,7 @@ describe('Client Edit web access path', () => {
.accessToSection('client.card.webAccess');
});
it(`should uncheck the Enable web access checkbox and update the name`, async () => {
it(`should uncheck the Enable web access checkbox and update the name`, async() => {
const result = await nightmare
.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox)
.clearInput(selectors.clientWebAccess.userNameInput)
@ -22,7 +22,7 @@ describe('Client Edit web access path', () => {
expect(result).toEqual('Data saved!');
});
it('should confirm web access is now unchecked', async () => {
it('should confirm web access is now unchecked', async() => {
const result = await nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
@ -36,7 +36,7 @@ describe('Client Edit web access path', () => {
expect(result).toBeFalsy();
});
it('should confirm web access name have been updated', async () => {
it('should confirm web access name have been updated', async() => {
const result = await nightmare
.waitToGetProperty(selectors.clientWebAccess.userNameInput, 'value');

View File

@ -11,7 +11,7 @@ describe('Client Add notes path', () => {
.accessToSection('client.card.note.index');
});
it(`should click on the add note button`, async () => {
it(`should click on the add note button`, async() => {
const url = await nightmare
.waitToClick(selectors.clientNotes.addNoteFloatButton)
.waitForURL('/note/create')
@ -20,7 +20,7 @@ describe('Client Add notes path', () => {
expect(url.hash).toContain('/note/create');
});
it(`should create a note`, async () => {
it(`should create a note`, async() => {
const result = await nightmare
.type(selectors.clientNotes.noteInput, 'Meeting with Black Widow 21st 9am')
.click(selectors.clientNotes.saveButton)
@ -29,7 +29,7 @@ describe('Client Add notes path', () => {
expect(result).toEqual('Data saved!');
});
it('should confirm the note was created', async () => {
it('should confirm the note was created', async() => {
const result = await nightmare
.waitToGetProperty(selectors.clientNotes.firstNoteText, 'innerText');

View File

@ -11,7 +11,7 @@ describe('Client Add credit path', () => {
.accessToSection('client.card.credit.index');
});
it(`should click on the add credit button`, async () => {
it(`should click on the add credit button`, async() => {
const url = await nightmare
.waitToClick(selectors.clientCredit.addCreditFloatButton)
.waitForURL('/credit/create')
@ -20,7 +20,7 @@ describe('Client Add credit path', () => {
expect(url.hash).toContain('/credit/create');
});
it(`should edit the credit`, async () => {
it(`should edit the credit`, async() => {
const result = await nightmare
.clearInput(selectors.clientCredit.creditInput)
.type(selectors.clientCredit.creditInput, 999)
@ -30,7 +30,7 @@ describe('Client Add credit path', () => {
expect(result).toEqual('Data saved!');
});
it('should confirm the credit was updated', async () => {
it('should confirm the credit was updated', async() => {
const result = await nightmare
.waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText');

View File

@ -11,7 +11,7 @@ describe('Client mandate path', () => {
.accessToSection('client.card.mandate');
});
it('should confirm the client has a mandate of the CORE type', async () => {
it('should confirm the client has a mandate of the CORE type', async() => {
const result = await nightmare
.waitToGetProperty(selectors.clientMandate.firstMandateText, 'innerText');

View File

@ -12,7 +12,7 @@ describe('Client lock verified data path', () => {
.accessToSection('client.card.fiscalData');
});
it('should confirm verified data button is disabled for salesPerson', async () => {
it('should confirm verified data button is disabled for salesPerson', async() => {
const result = await nightmare
.wait(200)
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
@ -23,7 +23,7 @@ describe('Client lock verified data path', () => {
expect(result).toBeTruthy();
});
it('should edit the social name', async () => {
it('should edit the social name', async() => {
const result = await nightmare
.wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput)
@ -34,7 +34,7 @@ describe('Client lock verified data path', () => {
expect(result).toEqual('Data saved!');
});
it('should confirm the social name have been edited', async () => {
it('should confirm the social name have been edited', async() => {
const result = await nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
@ -52,7 +52,7 @@ describe('Client lock verified data path', () => {
.waitForLogin('administrative');
});
it('should navigate to clients index', async () => {
it('should navigate to clients index', async() => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
@ -63,7 +63,7 @@ describe('Client lock verified data path', () => {
expect(url.hash).toEqual('#!/client/index');
});
it('should search again for the user Petter Parker', async () => {
it('should search again for the user Petter Parker', async() => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
@ -74,7 +74,7 @@ describe('Client lock verified data path', () => {
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the Petter Parkers fiscal data`, async () => {
it(`should click on the search result to access to the Petter Parkers fiscal data`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
@ -85,7 +85,7 @@ describe('Client lock verified data path', () => {
expect(url.hash).toContain('fiscal-data');
});
it(`should click on the fiscal data button`, async () => {
it(`should click on the fiscal data button`, async() => {
const url = await nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
@ -94,7 +94,7 @@ describe('Client lock verified data path', () => {
expect(url.hash).toContain('fiscal-data');
});
it('should confirm verified data button is enabled for administrative', async () => {
it('should confirm verified data button is enabled for administrative', async() => {
const result = await nightmare
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
.evaluate(selector => {
@ -104,7 +104,7 @@ describe('Client lock verified data path', () => {
expect(result).not.toBeTruthy();
});
it('should check the Verified data checkbox', async () => {
it('should check the Verified data checkbox', async() => {
const result = await nightmare
.waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput)
.waitToClick(selectors.clientFiscalData.saveButton)
@ -113,7 +113,7 @@ describe('Client lock verified data path', () => {
expect(result).toEqual('Data saved!');
});
it('should confirm Verified data checkbox is checked', async () => {
it('should confirm Verified data checkbox is checked', async() => {
const result = await nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
@ -126,7 +126,7 @@ describe('Client lock verified data path', () => {
expect(result).toBeTruthy();
});
it('should again edit the social name', async () => {
it('should again edit the social name', async() => {
const result = await nightmare
.wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput)
@ -137,7 +137,7 @@ describe('Client lock verified data path', () => {
expect(result).toEqual('Data saved!');
});
it('should again confirm the social name have been edited', async () => {
it('should again confirm the social name have been edited', async() => {
const result = await nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
@ -155,7 +155,7 @@ describe('Client lock verified data path', () => {
.waitForLogin('salesPerson');
});
it('should again click on the Clients button of the top bar menu', async () => {
it('should again click on the Clients button of the top bar menu', async() => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
@ -166,7 +166,7 @@ describe('Client lock verified data path', () => {
expect(url.hash).toEqual('#!/client/index');
});
it('should again search for the user Petter Parker', async () => {
it('should again search for the user Petter Parker', async() => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
@ -177,7 +177,7 @@ describe('Client lock verified data path', () => {
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the client's fiscal data`, async () => {
it(`should click on the search result to access to the client's fiscal data`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
@ -188,7 +188,7 @@ describe('Client lock verified data path', () => {
expect(url.hash).toContain('fiscal-data');
});
it(`should click on the fiscal data button to start editing`, async () => {
it(`should click on the fiscal data button to start editing`, async() => {
const url = await nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
@ -197,7 +197,7 @@ describe('Client lock verified data path', () => {
expect(url.hash).toContain('fiscal-data');
});
it('should confirm verified data button is disabled once again for salesPerson', async () => {
it('should confirm verified data button is disabled once again for salesPerson', async() => {
const result = await nightmare
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
.evaluate(selector => {
@ -207,7 +207,7 @@ describe('Client lock verified data path', () => {
expect(result).toBe(true);
});
it('should not be able to save change throwing a verified data error', async () => {
it('should not be able to save change throwing a verified data error', async() => {
const result = await nightmare
.wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput)
@ -226,7 +226,7 @@ describe('Client lock verified data path', () => {
.waitForLogin('salesAssistant');
});
it('should now navigate to clients index', async () => {
it('should now navigate to clients index', async() => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
@ -237,7 +237,7 @@ describe('Client lock verified data path', () => {
expect(url.hash).toEqual('#!/client/index');
});
it('should now search again for the user Petter Parker', async () => {
it('should now search again for the user Petter Parker', async() => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
@ -248,7 +248,7 @@ describe('Client lock verified data path', () => {
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the Petter Parkers fiscal data`, async () => {
it(`should click on the search result to access to the Petter Parkers fiscal data`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
@ -259,7 +259,7 @@ describe('Client lock verified data path', () => {
expect(url.hash).toContain('fiscal-data');
});
it(`should click on the fiscal data button`, async () => {
it(`should click on the fiscal data button`, async() => {
const url = await nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
@ -268,7 +268,7 @@ describe('Client lock verified data path', () => {
expect(url.hash).toContain('fiscal-data');
});
it('should confirm verified data button is enabled for salesAssistant', async () => {
it('should confirm verified data button is enabled for salesAssistant', async() => {
const result = await nightmare
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
.evaluate(selector => {
@ -278,7 +278,7 @@ describe('Client lock verified data path', () => {
expect(result).toBeFalsy();
});
it('should now edit the social name', async () => {
it('should now edit the social name', async() => {
const result = await nightmare
.wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput)
@ -289,7 +289,7 @@ describe('Client lock verified data path', () => {
expect(result).toEqual('Data saved!');
});
it('should now confirm the social name have been edited once and for all', async () => {
it('should now confirm the social name have been edited once and for all', async() => {
const result = await nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
@ -307,7 +307,7 @@ describe('Client lock verified data path', () => {
.waitForLogin('salesPerson');
});
it('should now click on the Clients button of the top bar menu', async () => {
it('should now click on the Clients button of the top bar menu', async() => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
@ -318,7 +318,7 @@ describe('Client lock verified data path', () => {
expect(url.hash).toEqual('#!/client/index');
});
it('should once again search for the user Petter Parker', async () => {
it('should once again search for the user Petter Parker', async() => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
@ -329,7 +329,7 @@ describe('Client lock verified data path', () => {
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the client's fiscal data`, async () => {
it(`should click on the search result to access to the client's fiscal data`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
@ -340,7 +340,7 @@ describe('Client lock verified data path', () => {
expect(url.hash).toContain('fiscal-data');
});
it(`should click on the fiscal data button to start editing`, async () => {
it(`should click on the fiscal data button to start editing`, async() => {
const url = await nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
@ -349,7 +349,7 @@ describe('Client lock verified data path', () => {
expect(url.hash).toContain('fiscal-data');
});
it('should confirm verified data button is enabled once again', async () => {
it('should confirm verified data button is enabled once again', async() => {
const result = await nightmare
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
.evaluate(selector => {
@ -359,7 +359,7 @@ describe('Client lock verified data path', () => {
expect(result).toBe(true);
});
it('should confirm the form is enabled for salesPerson', async () => {
it('should confirm the form is enabled for salesPerson', async() => {
const result = await nightmare
.wait(selectors.clientFiscalData.socialNameInput)
.evaluate(selector => {

View File

@ -11,7 +11,7 @@ describe('Client risk path', () => {
.accessToSection('client.card.risk.index');
});
it('should click the new payment button', async () => {
it('should click the new payment button', async() => {
let url = await nightmare
.waitToClick(selectors.clientRisk.newPaymentButton)
.waitForURL('/risk')
@ -20,7 +20,7 @@ describe('Client risk path', () => {
expect(url.hash).toContain('/risk');
});
it('should create a new payment that clears the debt', async () => {
it('should create a new payment that clears the debt', async() => {
let result = await nightmare
.clearInput(selectors.clientRisk.newPaymentBankInut)
.type(selectors.clientRisk.newPaymentBankInut, '2')
@ -30,14 +30,14 @@ describe('Client risk path', () => {
expect(result).toContain('Data saved!');
});
it('should check balance is now 0', async () => {
it('should check balance is now 0', async() => {
let result = await nightmare
.waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText');
expect(result).toEqual('0.00 €');
});
it('should now click the new payment button', async () => {
it('should now click the new payment button', async() => {
let url = await nightmare
.waitToClick(selectors.clientRisk.newPaymentButton)
.waitForURL('/risk')
@ -46,7 +46,7 @@ describe('Client risk path', () => {
expect(url.hash).toContain('/risk');
});
it('should create a new payment that sets the balance to positive value', async () => {
it('should create a new payment that sets the balance to positive value', async() => {
let result = await nightmare
.clearInput(selectors.clientRisk.newPaymentAmountInput)
.type(selectors.clientRisk.newPaymentAmountInput, '100')
@ -56,14 +56,14 @@ describe('Client risk path', () => {
expect(result).toContain('Data saved!');
});
it('should check balance is now 100', async () => {
it('should check balance is now 100', async() => {
let result = await nightmare
.waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText');
expect(result).toEqual('100.00 €');
});
it('should again click the new payment button', async () => {
it('should again click the new payment button', async() => {
let url = await nightmare
.waitToClick(selectors.clientRisk.newPaymentButton)
.waitForURL('/risk')
@ -72,7 +72,7 @@ describe('Client risk path', () => {
expect(url.hash).toContain('/risk');
});
it('should create a new payment that sets the balance back to the original negative value', async () => {
it('should create a new payment that sets the balance back to the original negative value', async() => {
let result = await nightmare
.clearInput(selectors.clientRisk.newPaymentAmountInput)
.type(selectors.clientRisk.newPaymentAmountInput, '-150')
@ -82,14 +82,14 @@ describe('Client risk path', () => {
expect(result).toContain('Data saved!');
});
it('should check balance is now -50', async () => {
it('should check balance is now -50', async() => {
let result = await nightmare
.waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText');
expect(result).toEqual('-50.00 €');
});
it('should now click on the Clients button of the top bar menu', async () => {
it('should now click on the Clients button of the top bar menu', async() => {
let url = await nightmare
.waitForLogin('employee')
.waitToClick(selectors.globalItems.applicationsMenuButton)
@ -101,7 +101,7 @@ describe('Client risk path', () => {
expect(url.hash).toEqual('#!/client/index');
});
it('should now search for the user Petter Parker', async () => {
it('should now search for the user Petter Parker', async() => {
let resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
@ -112,7 +112,7 @@ describe('Client risk path', () => {
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the client's risk`, async () => {
it(`should click on the search result to access to the client's risk`, async() => {
let url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
@ -123,7 +123,7 @@ describe('Client risk path', () => {
expect(url.hash).toContain('/risk');
});
it('should not be able to click the new payment button as it isnt present', async () => {
it('should not be able to click the new payment button as it isnt present', async() => {
let result = await nightmare
.exists(selectors.clientRisk.newPaymentButton);

View File

@ -0,0 +1,34 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Ticket create from client path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('employee', 'client')
.accessToSearchResult('Petter Parker');
});
it('should click the create simple ticket on the descriptor menu', async() => {
const url = await nightmare
.waitToClick(selectors.clientDescriptor.moreMenu)
.waitToClick(selectors.clientDescriptor.simpleTicketButton)
.waitForURL('#!/ticket/create?clientFk=102')
.parsedUrl();
expect(url.hash).toContain('clientFk=102');
});
it('should check if the client details are the expected ones', async() => {
const client = await nightmare
.waitToGetProperty(`${selectors.createTicketView.clientAutocomplete} input`, 'value');
const address = await nightmare
.waitToGetProperty(`${selectors.createTicketView.addressAutocomplete} input`, 'value');
expect(client).toContain('Petter Parker');
expect(address).toContain('20 Ingram Street');
});
});