#781 Extensiones nightmare for search and access sections

This commit is contained in:
Carlos Jimenez 2018-12-03 00:45:34 +01:00
parent f9a05238e6
commit 4d42e417c0
32 changed files with 130 additions and 768 deletions

View File

@ -10,7 +10,7 @@
<span translate>{{::item.description}}</span> <span translate>{{::item.description}}</span>
</a> </a>
<ul ng-if="item.childs.length > 0 && item.active"> <ul ng-show="item.childs.length > 0 && item.active">
<li ng-repeat="child in ::item.childs"> <li ng-repeat="child in ::item.childs">
<a ui-sref="{{::child.state}}" ng-class="{active: child.active}"> <a ui-sref="{{::child.state}}" ng-class="{active: child.active}">
<vn-icon icon="{{::child.icon}}"></vn-icon> <vn-icon icon="{{::child.icon}}"></vn-icon>

View File

@ -1,6 +1,5 @@
/* eslint no-invalid-this: "off" */ /* eslint no-invalid-this: "off" */
import selectors from './selectors.js';
import config from './config.js'; import config from './config.js';
import Nightmare from 'nightmare'; import Nightmare from 'nightmare';
import {URL} from 'url'; import {URL} from 'url';
@ -176,7 +175,6 @@ let actions = {
}, selector, count) }, selector, count)
.then(done) .then(done)
.catch(err => { .catch(err => {
console.error(err.name, err.message);
done(new Error(`.waitForNumberOfElements() for ${selector}, count ${count} timed out`)); done(new Error(`.waitForNumberOfElements() for ${selector}, count ${count} timed out`));
}); });
}, },
@ -285,15 +283,39 @@ let actions = {
}).catch(done); }).catch(done);
}, },
// indexSearchToSection: function(searchValue, sectionName, done) { accessToSearchResult: function(searchValue, done) {
// this.wait(`vn-${sectionName}-index vn-searchbar input`) this.wait(`vn-searchbar input`)
// .type(`vn-${sectionName}-index vn-searchbar input`, searchValue) .type(`vn-searchbar input`, searchValue)
// .click(`vn-${sectionName}-index vn-searchbar vn-icon[icon="search"]`) .click(`vn-searchbar vn-icon[icon="search"]`)
// .waitForNumberOfElements(`vn-${sectionName}-index > div > div > vn-card:nth-child(2) > div > vn-item-client > a`, 1) .evaluate(() => {
// .countElement(selectors.clientsIndex.searchResult); return document.querySelector('ui-view vn-card vn-table') != null;
})
.then(result => {
if (result)
return this.waitToClick('ui-view vn-card vn-td');
// expect(resultCount).toEqual(1); return this.waitToClick('ui-view vn-card a');
// } })
.then(done)
.catch(done);
},
accessToSection: function(sectionRoute, done) {
this.wait(`vn-left-menu`)
.evaluate(sectionRoute => {
return document.querySelector(`vn-left-menu ul li ul li > a[ui-sref="${sectionRoute}"]`) != null;
}, sectionRoute)
.then(nested => {
if (!nested)
return this.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
return this.waitToClick('vn-left-menu .collapsed')
.wait('vn-left-menu .expanded')
.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
})
.then(done)
.catch(done);
}
}; };
Object.keys(actions).forEach(function(name) { Object.keys(actions).forEach(function(name) {

View File

@ -6,28 +6,9 @@ describe('Claim edit basic data path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('salesAssistant', 'claim'); .loginAndModule('salesAssistant', 'claim')
}); .accessToSearchResult('1')
.accessToSection('claim.card.basicData');
it('should search for the claim with id 1', async () => {
const resultCount = await nightmare
.wait(selectors.claimsIndex.searchClaimInput)
.type(selectors.claimsIndex.searchClaimInput, '1')
.click(selectors.claimsIndex.searchButton)
.waitForNumberOfElements(selectors.claimsIndex.searchResult, 1)
.countElement(selectors.claimsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the claim Basic Data`, async () => {
const url = await nightmare
.waitToClick(selectors.claimsIndex.searchResult)
.waitToClick(selectors.claimBasicData.basicDataButton)
.waitForURL('basic-data')
.parsedUrl();
expect(url.hash).toContain('basic-data');
}); });
it(`should edit claim state, is paid with mana and observation fields`, async () => { it(`should edit claim state, is paid with mana and observation fields`, async () => {

View File

@ -20,24 +20,6 @@ describe('Client create path', () => {
expect(result).toEqual(0); expect(result).toEqual(0);
}); });
it('should access to the create client view by clicking the create-client floating button', async () => {
const url = await nightmare
.click(selectors.clientsIndex.createClientButton)
.wait(selectors.createClientView.createButton)
.parsedUrl();
expect(url.hash).toEqual('#!/client/create');
});
it('should return to the client index by clicking the cancel button', async () => {
const url = await nightmare
.click(selectors.createClientView.cancelButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
});
it('should now access to the create client view by clicking the create-client floating button', async () => { it('should now access to the create client view by clicking the create-client floating button', async () => {
const url = await nightmare const url = await nightmare
.click(selectors.clientsIndex.createClientButton) .click(selectors.clientsIndex.createClientButton)

View File

@ -6,33 +6,13 @@ describe('Client Edit basicData path', () => {
describe('as employee', () => { describe('as employee', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('employee', 'client'); .loginAndModule('employee', 'client')
}); .accessToSearchResult('Bruce Wayne')
.accessToSection('client.card.basicData');
it('should search for the user Bruce Wayne', async () => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Wayne')
.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 summary', async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Wayne')
.waitToClick(selectors.clientsIndex.searchResult)
.waitForURL('summary')
.parsedUrl();
expect(url.hash).toContain('summary');
}); });
it('should not be able to change the salesPerson', async () => { it('should not be able to change the salesPerson', async () => {
const result = await nightmare const result = await nightmare
.click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput) .wait(selectors.clientBasicData.nameInput)
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
@ -111,33 +91,13 @@ describe('Client Edit basicData path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.waitToClick(selectors.globalItems.logOutButton) .waitToClick(selectors.globalItems.logOutButton)
.loginAndModule('salesASsistant', 'client'); .loginAndModule('salesASsistant', 'client')
}); .accessToSearchResult('Ptonomy Wallace')
.accessToSection('client.card.basicData');
it('should now search for the user Ptonomy Wallace', async () => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Ptonomy Wallace')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it('should now click on the search result to access to the client summary', async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Ptonomy Wallace')
.waitToClick(selectors.clientsIndex.searchResult)
.waitForURL('summary')
.parsedUrl();
expect(url.hash).toContain('summary');
}); });
it('should be able to change the salesPerson', async () => { it('should be able to change the salesPerson', async () => {
const result = await nightmare const result = await nightmare
.click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput) .wait(selectors.clientBasicData.nameInput)
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;

View File

@ -6,33 +6,12 @@ describe('Client Edit fiscalData path', () => {
describe('as employee', () => { describe('as employee', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('employee', 'client'); .loginAndModule('employee', 'client')
}); .accessToSearchResult('Bruce Banner')
.accessToSection('client.card.address.index');
it('should search for the user Bruce Banner', async () => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
}); });
// Confirms all addresses have EQtax false for future propagation test step 1 // Confirms all addresses have EQtax false for future propagation test step 1
it(`should click on the search result to access to the client's addresses`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('/address/index')
.parsedUrl();
expect(url.hash).toContain('/address/index');
});
// Confirms all addresses have EQtax false for future propagation test step 2
it(`should click on the 1st edit icon to check EQtax isnt checked`, async () => { it(`should click on the 1st edit icon to check EQtax isnt checked`, async () => {
const result = await nightmare const result = await nightmare
.waitToClick(selectors.clientAddresses.firstEditButton) .waitToClick(selectors.clientAddresses.firstEditButton)
@ -44,7 +23,7 @@ describe('Client Edit fiscalData path', () => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); });
// Confirms all addresses have EQtax false for future propagation test step 3 // Confirms all addresses have EQtax false for future propagation test step 2
it(`should go back to addresses then select the second one and confirm the EQtax isnt checked`, async () => { it(`should go back to addresses then select the second one and confirm the EQtax isnt checked`, async () => {
const result = await nightmare const result = await nightmare
.waitToClick(selectors.clientAddresses.addressesButton) .waitToClick(selectors.clientAddresses.addressesButton)
@ -79,40 +58,9 @@ describe('Client Edit fiscalData path', () => {
describe('as administrative', () => { describe('as administrative', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.waitForLogin('administrative'); .loginAndModule('administrative', 'client')
}); .accessToSearchResult('Bruce Banner')
.accessToSection('client.card.fiscalData');
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)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
});
it('should now search for the user Bruce Banner', async () => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should access to the client fiscal data`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
.parsedUrl();
expect(url.hash).toContain('fiscal-data');
}); });
it('should receive an error if VIES and EQtax are being ticked together', async () => { it('should receive an error if VIES and EQtax are being ticked together', async () => {

View File

@ -6,29 +6,9 @@ describe('Client Edit pay method path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('administrative', 'client'); .loginAndModule('administrative', 'client')
}); .accessToSearchResult('Bruce Banner')
.accessToSection('client.card.billingData');
it('should search for the user Bruce Banner', async () => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
.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 pay method`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientPayMethod.payMethodButton)
.waitForURL('billing-data')
.parsedUrl();
expect(url.hash).toContain('billing-data');
}); });
it(`should attempt to edit the Pay method without an IBAN but fail`, async () => { it(`should attempt to edit the Pay method without an IBAN but fail`, async () => {
@ -54,8 +34,8 @@ describe('Client Edit pay method path', () => {
it(`should add the IBAN but fail as it requires a BIC code`, async () => { it(`should add the IBAN but fail as it requires a BIC code`, async () => {
const snackbarMessage = await nightmare const snackbarMessage = await nightmare
.clearInput(selectors.clientPayMethod.IBANInput) .clearInput(selectors.clientPayMethod.IBANInput)
.type(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332') .type(selectors.clientPayMethod.IBANInput, 'ES9121000418450200051332')
.waitForTextInInput(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332') .waitForTextInInput(selectors.clientPayMethod.IBANInput, 'ES9121000418450200051332')
.waitToClick(selectors.clientPayMethod.clearswiftBicButton) .waitToClick(selectors.clientPayMethod.clearswiftBicButton)
.waitToClick(selectors.clientPayMethod.saveButton) .waitToClick(selectors.clientPayMethod.saveButton)
.waitForLastSnackbar(); .waitForLastSnackbar();
@ -92,7 +72,7 @@ describe('Client Edit pay method path', () => {
const IBAN = await nightmare const IBAN = await nightmare
.waitToGetProperty(selectors.clientPayMethod.IBANInput, 'value'); .waitToGetProperty(selectors.clientPayMethod.IBANInput, 'value');
expect(IBAN).toEqual('ES91 2100 0418 4502 0005 1332'); expect(IBAN).toEqual('ES9121000418450200051332');
}); });
it('should confirm the swift / BIC code was saved', async () => { it('should confirm the swift / BIC code was saved', async () => {

View File

@ -6,29 +6,9 @@ describe('Client Add address path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('employee', 'client'); .loginAndModule('employee', 'client')
}); .accessToSearchResult('Bruce Banner')
.accessToSection('client.card.address.index');
it('should search for the user Bruce Banner', async () => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
.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 addresses`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('address/index')
.parsedUrl();
expect(url.hash).toContain('address/index');
}); });
it(`should click on the add new address button to access to the new address form`, async () => { it(`should click on the add new address button to access to the new address form`, async () => {

View File

@ -6,29 +6,9 @@ describe('Client add address notes path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('employee', 'client'); .loginAndModule('employee', 'client')
}); .accessToSearchResult('Petter Parker')
.accessToSection('client.card.address.index');
it('should search for the user Petter Parker', async () => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.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 addresses`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('address/index')
.parsedUrl();
expect(url.hash).toContain('address/index');
}); });
it(`should click on the edit icon of the default address`, async () => { it(`should click on the edit icon of the default address`, async () => {

View File

@ -6,30 +6,9 @@ describe('Client Edit web access path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('employee', 'client'); .loginAndModule('employee', 'client')
}); .accessToSearchResult('Bruce Banner')
.accessToSection('client.card.webAccess');
it('should search for the user Bruce Banner', async () => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
.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 web access`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientsIndex.othersButton)
.waitToClick(selectors.clientWebAccess.webAccessButton)
.waitForURL('web-access')
.parsedUrl();
expect(url.hash).toContain('web-access');
}); });
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 () => {

View File

@ -6,29 +6,9 @@ describe('Client Add notes path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('employee', 'client'); .loginAndModule('employee', 'client')
}); .accessToSearchResult('Bruce Banner')
.accessToSection('client.card.note.index');
it('should search for the user Bruce Banner', async () => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
.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 notes`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientNotes.notesButton)
.waitForURL('note/index')
.parsedUrl();
expect(url.hash).toContain('note/index');
}); });
it(`should click on the add note button`, async () => { it(`should click on the add note button`, async () => {

View File

@ -6,29 +6,9 @@ describe('Client Add credit path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('salesAssistant', 'client'); .loginAndModule('salesAssistant', 'client')
}); .accessToSearchResult('Hank Pym')
.accessToSection('client.card.credit.index');
it('should search for the user Hank Pym', async () => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Hank Pym')
.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 credit`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Hank Pym')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientCredit.creditButton)
.waitForURL('credit/index')
.parsedUrl();
expect(url.hash).toContain('credit/index');
}); });
it(`should click on the add credit button`, async () => { it(`should click on the add credit button`, async () => {

View File

@ -6,29 +6,9 @@ describe('Client Add greuge path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('salesAssistant', 'client'); .loginAndModule('salesAssistant', 'client')
}); .accessToSearchResult('Petter Parker')
.accessToSection('client.card.greuge.index');
it('should search for the user Petter Parker', async () => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.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 greuge`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientGreuge.greugeButton)
.waitForURL('greuge/index')
.parsedUrl();
expect(url.hash).toContain('greuge/index');
}); });
it(`should click on the add greuge button`, async () => { it(`should click on the add greuge button`, async () => {

View File

@ -6,30 +6,9 @@ describe('Client mandate path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('salesPerson', 'client'); .loginAndModule('salesPerson', 'client')
}); .accessToSearchResult('Petter Parker')
.accessToSection('client.card.mandate');
it('should search for the user Petter Parker', async () => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.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 mandate`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientsIndex.othersButton)
.waitToClick(selectors.clientMandate.mandateButton)
.waitForURL('mandate')
.parsedUrl();
expect(url.hash).toContain('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 () => {

View File

@ -7,38 +7,9 @@ describe('Client lock verified data path', () => {
describe('as salesPerson', () => { describe('as salesPerson', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('salesPerson', 'client'); .loginAndModule('salesPerson', 'client')
}); .accessToSearchResult('Petter Parker')
.accessToSection('client.card.fiscalData');
it('should search for the user Petter Parker', async () => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.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 () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
.parsedUrl();
expect(url.hash).toContain('fiscal-data');
});
it(`should click on the fiscal data button to start editing`, async () => {
const url = await nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
.parsedUrl();
expect(url.hash).toContain('fiscal-data');
}); });
it('should confirm verified data button is disabled for salesPerson', async () => { it('should confirm verified data button is disabled for salesPerson', async () => {

View File

@ -6,29 +6,9 @@ describe('Client log path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('employee', 'client'); .loginAndModule('employee', 'client')
}); .accessToSearchResult('DavidCharlesHaller')
.accessToSection('client.card.basicData');
it('should search for the user David Charles Haller', async () => {
let resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.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 () => { it('should update the clients name', async () => {

View File

@ -6,29 +6,9 @@ describe('Client risk path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('administrative', 'client'); .loginAndModule('administrative', 'client')
}); .accessToSearchResult('Petter Parker')
.accessToSection('client.card.risk.index');
it('should search for the user Petter Parker', async () => {
let resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.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 risk`, async () => {
let url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientRisk.riskButton)
.waitForURL('/risk')
.parsedUrl();
expect(url.hash).toContain('/risk');
}); });
it('should click the new payment button', async () => { it('should click the new payment button', async () => {

View File

@ -6,29 +6,9 @@ describe('Item Edit basic data path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('buyer', 'item'); .loginAndModule('buyer', 'item')
}); .accessToSearchResult('Gem of Mind')
.accessToSection('item.card.data');
it('should search for the item Gem of Mind', async () => {
const resultCount = await nightmare
.wait(selectors.itemsIndex.searchItemInput)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Mind')
.click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the item basic data`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind')
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemBasicData.basicDataButton)
.waitForURL('data')
.parsedUrl();
expect(url.hash).toContain('data');
}); });
it(`should edit the item basic data`, async () => { it(`should edit the item basic data`, async () => {

View File

@ -6,29 +6,9 @@ describe('Item edit tax path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('buyer', 'item'); .loginAndModule('buyer', 'item')
}); .accessToSearchResult('Gem of Time')
.accessToSection('item.card.tax');
it('should search for the item Gem of Time', async () => {
const resultCount = await nightmare
.wait(selectors.itemsIndex.searchItemInput)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
.click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the item tax`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemTax.taxButton)
.waitForURL('tax')
.parsedUrl();
expect(url.hash).toContain('tax');
}); });
it(`should add the item tax to all countries`, async () => { it(`should add the item tax to all countries`, async () => {

View File

@ -6,29 +6,9 @@ describe('Item create tags path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('buyer', 'item'); .loginAndModule('buyer', 'item')
}); .accessToSearchResult('Gem of Time')
.accessToSection('item.card.tags');
it('should search for the item Gem of Time', async () => {
const resultCount = await nightmare
.wait(selectors.itemsIndex.searchItemInput)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
.click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the item tags`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemTags.tagsButton)
.waitForURL('tags')
.parsedUrl();
expect(url.hash).toContain('tags');
}); });
it(`should create a new tag and delete a former one`, async () => { it(`should create a new tag and delete a former one`, async () => {

View File

@ -6,29 +6,9 @@ describe('Item create niche path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('buyer', 'item'); .loginAndModule('buyer', 'item')
}); .accessToSearchResult('Gem of Time')
.accessToSection('item.card.niche');
it('should search for the item Gem of Time', async () => {
const resultCount = await nightmare
.wait(selectors.itemsIndex.searchItemInput)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
.click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the item niches`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemNiches.nicheButton)
.waitForURL('niche')
.parsedUrl();
expect(url.hash).toContain('niche');
}); });
it(`should click create a new niche and delete a former one`, async () => { it(`should click create a new niche and delete a former one`, async () => {

View File

@ -6,29 +6,9 @@ describe('Item Create botanical path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('buyer', 'item'); .loginAndModule('buyer', 'item')
}); .accessToSearchResult('Mjolnir')
.accessToSection('item.card.botanical');
it('should search for the item Mjolnir', async () => {
const result = await nightmare
.wait(selectors.itemsIndex.searchItemInput)
.type(selectors.itemsIndex.searchItemInput, 'Mjolnir')
.click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the search result to access to the item botanical`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir')
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemBotanical.botanicalButton)
.waitForURL('botanical')
.parsedUrl();
expect(url.hash).toContain('botanical');
}); });
it(`should create a new botanical for the item with id Mjolnir`, async () => { it(`should create a new botanical for the item with id Mjolnir`, async () => {

View File

@ -6,29 +6,9 @@ describe('Item Create barcodes path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('buyer', 'item'); .loginAndModule('buyer', 'item')
}); .accessToSearchResult('Gem of Time')
.accessToSection('item.card.itemBarcode');
it('should search for the item Gem of Time', async () => {
const result = await nightmare
.wait(selectors.itemsIndex.searchItemInput)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
.click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the search result to access to the item barcodes`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemBarcodes.barcodeButton)
.waitForURL('barcode')
.parsedUrl();
expect(url.hash).toContain('barcode');
}); });
it(`should click create a new code and delete a former one`, async () => { it(`should click create a new code and delete a former one`, async () => {

View File

@ -7,29 +7,9 @@ describe('Ticket', () => {
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.loginAndModule('employee', 'ticket'); .loginAndModule('employee', 'ticket')
}); .accessToSearchResult('id:1')
.accessToSection('ticket.card.observation');
it('should search for the ticket with id 1', async () => {
let result = await nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the search result to access to the ticket notes`, async () => {
let url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketNotes.notesButton)
.waitForURL('observation')
.parsedUrl();
expect(url.hash).toContain('observation');
}); });
it(`should click create a new note and delete a former one`, async () => { it(`should click create a new note and delete a former one`, async () => {

View File

@ -7,29 +7,9 @@ describe('Ticket', () => {
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.loginAndModule('production', 'ticket'); .loginAndModule('production', 'ticket')
}); .accessToSearchResult('id:1')
.accessToSection('ticket.card.expedition');
it('should search for the ticket with id 1', async () => {
const result = await nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the search result to access to the ticket expeditions`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketExpedition.expeditionButton)
.waitForURL('expedition')
.parsedUrl();
expect(url.hash).toContain('expedition');
}); });
it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async () => { it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async () => {

View File

@ -6,29 +6,9 @@ describe('Ticket List sale path', () => {
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.loginAndModule('employee', 'ticket'); .loginAndModule('employee', 'ticket')
}); .accessToSearchResult('id:1')
.accessToSection('ticket.card.sale');
it('should search for the ticket 8', async () => {
const result = await nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:8')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the search result to access to the ticket's sale`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 24')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale')
.parsedUrl();
expect(url.hash).toContain('/sale');
}); });
it('should confirm the first ticket sale contains the colour', async () => { it('should confirm the first ticket sale contains the colour', async () => {

View File

@ -6,29 +6,9 @@ describe('Ticket Create packages path', () => {
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.loginAndModule('employee', 'ticket'); .loginAndModule('employee', 'ticket')
}); .accessToSearchResult('id:1')
.accessToSection('ticket.card.package.index');
it('should search for the ticket 1', async () => {
const result = await nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the search result to access to the ticket packages`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResultAddress, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketPackages.packagesButton)
.waitForURL('package/index')
.parsedUrl();
expect(url.hash).toContain('package/index');
}); });
it(`should delete the first package and receive and error to save a new one with blank quantity`, async () => { it(`should delete the first package and receive and error to save a new one with blank quantity`, async () => {

View File

@ -7,29 +7,9 @@ describe('Ticket', () => {
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.loginAndModule('production', 'ticket'); .loginAndModule('production', 'ticket')
}); .accessToSearchResult('id:1')
.accessToSection('ticket.card.tracking.index');
it('should search for the ticket 1', async () => {
let result = await nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the search result to access to the ticket Tracking`, async () => {
let url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketTracking.trackingButton)
.waitForURL('tracking/index')
.parsedUrl();
expect(url.hash).toContain('tracking/index');
}); });
it('should access to the create state view by clicking the create floating button', async () => { it('should access to the create state view by clicking the create floating button', async () => {

View File

@ -6,29 +6,9 @@ describe('Ticket Edit basic data path', () => {
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.loginAndModule('employee', 'ticket'); .loginAndModule('employee', 'ticket')
}); .accessToSearchResult('id:11')
.accessToSection('ticket.card.data.stepOne');
it('should search for the ticket 11', async () => {
let result = await nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:11')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the search result to access to the ticket Basic Data`, async () => {
let url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') // should be Bruce Wayne
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketBasicData.basicDataButton)
.waitForURL('data/step-one')
.parsedUrl();
expect(url.hash).toContain('data/step-one');
}); });
it(`should edit the client and address of the ticket then click next`, async () => { it(`should edit the client and address of the ticket then click next`, async () => {

View File

@ -6,29 +6,9 @@ describe('Ticket Edit sale path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('salesPerson', 'ticket'); .loginAndModule('salesPerson', 'ticket')
}); .accessToSearchResult('id:16')
.accessToSection('ticket.card.sale');
it('should search for a specific ticket', async () => {
const result = await nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:16')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the search result to access to the ticket Sale`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale')
.parsedUrl();
expect(url.hash).toContain('/sale');
}); });
it(`should click on the first claim id to navigate over there`, async () => { it(`should click on the first claim id to navigate over there`, async () => {

View File

@ -6,29 +6,9 @@ describe('Ticket List components path', () => {
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.loginAndModule('employee', 'ticket'); .loginAndModule('employee', 'ticket')
}); .accessToSearchResult('id:1')
.accessToSection('ticket.card.components');
it('should search for the ticket 1', async () => {
const result = await nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the search result to access to the ticket components`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketComponents.componentsButton)
.waitForURL('components')
.parsedUrl();
expect(url.hash).toContain('components');
}); });
it('should confirm the total base is correct', async () => { it('should confirm the total base is correct', async () => {

View File

@ -6,29 +6,9 @@ describe('Ticket purchase request path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('salesPerson', 'ticket'); .loginAndModule('salesPerson', 'ticket')
}); .accessToSearchResult('id:16')
.accessToSection('ticket.card.request.index');
it('should search for a specific ticket', async () => {
const result = await nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:16')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the search result to access to the ticket Purchase request`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketRequests.requestButton)
.waitForURL('/request')
.parsedUrl();
expect(url.hash).toContain('/request');
}); });
it(`should add a new request`, async () => { it(`should add a new request`, async () => {