#884 e2e claim.detail + bug fixes en autocompleteSearch extension

This commit is contained in:
Carlos Jimenez Ruiz 2019-01-22 13:18:20 +01:00
parent 5cbeac7d6f
commit 5f850e76e2
11 changed files with 78 additions and 8 deletions

View File

@ -287,6 +287,7 @@ let actions = {
this.wait(`vn-searchbar input`) this.wait(`vn-searchbar input`)
.type(`vn-searchbar input`, searchValue) .type(`vn-searchbar input`, searchValue)
.click(`vn-searchbar vn-icon[icon="search"]`) .click(`vn-searchbar vn-icon[icon="search"]`)
.waitForNumberOfElements('.searchResult', 1)
.evaluate(() => { .evaluate(() => {
return document.querySelector('ui-view vn-card vn-table') != null; return document.querySelector('ui-view vn-card vn-table') != null;
}) })

View File

@ -459,7 +459,10 @@ export default {
detailButton: `vn-left-menu a[ui-sref="claim.card.detail"]`, detailButton: `vn-left-menu a[ui-sref="claim.card.detail"]`,
addItemButton: `vn-claim-detail a vn-float-button`, addItemButton: `vn-claim-detail a vn-float-button`,
firstClaimableSaleFromTicket: 'vn-claim-detail > vn-dialog vn-tbody > vn-tr', firstClaimableSaleFromTicket: 'vn-claim-detail > vn-dialog vn-tbody > vn-tr',
claimDetailLine: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr' claimDetailLine: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr',
secondItemQuantityInput: 'vn-claim-detail vn-tr:nth-child(2) vn-textfield[model="saleClaimed.quantity"] input',
totalClaimed: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-horizontal > div > vn-label-value:nth-child(2) > section > span',
secondItemDeleteButton: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(9) > vn-icon-button > button > vn-icon > i'
}, },
claimDevelopment: { claimDevelopment: {
developmentButton: 'vn-left-menu a[ui-sref="claim.card.development"]', developmentButton: 'vn-left-menu a[ui-sref="claim.card.development"]',

View File

@ -25,8 +25,8 @@ describe('Claim edit basic data path', () => {
it('should confirm the claim state was edited', async() => { it('should confirm the claim state was edited', async() => {
const result = await nightmare const result = await nightmare
.click(selectors.claimDetails.detailsButton) .click(selectors.claimDetail.detailButton)
.wait(selectors.claimDetails.addItemButton) .wait(selectors.claimDetail.addItemButton)
.click(selectors.claimBasicData.basicDataButton) .click(selectors.claimBasicData.basicDataButton)
.wait(selectors.claimBasicData.claimStateAutocomplete) .wait(selectors.claimBasicData.claimStateAutocomplete)
.waitToGetProperty(`${selectors.claimBasicData.claimStateAutocomplete} input`, 'value'); .waitToGetProperty(`${selectors.claimBasicData.claimStateAutocomplete} input`, 'value');

View File

@ -0,0 +1,64 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Claim detail', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('salesPerson', 'claim')
.accessToSearchResult('4')
.accessToSection('claim.card.detail');
});
it('should add the first claimable item from ticket to the claim', async() => {
const result = await nightmare
.waitToClick(selectors.claimDetail.addItemButton)
.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the claim contains now two items', async() => {
const result = await nightmare
.countElement(selectors.claimDetail.claimDetailLine);
expect(result).toEqual(2);
});
it('should edit de second item claimed quantity', async() => {
const result = await nightmare
.write(selectors.claimDetail.secondItemQuantityInput, 10)
.type('body', '\u000d') // simulates enter
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the second item, and the claimed total were correctly edited', async() => {
const claimedQuantity = await nightmare
.getProperty(selectors.claimDetail.secondItemQuantityInput, 'value');
const totalClaimed = await nightmare
.getProperty(selectors.claimDetail.totalClaimed, 'innerText');
expect(claimedQuantity).toEqual('10');
expect(totalClaimed).toEqual('29.50 €');
});
it('should delete the second item from the claim', async() => {
const result = await nightmare
.waitToClick(selectors.claimDetail.secondItemDeleteButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the claim contains now one item', async() => {
const result = await nightmare
.countElement(selectors.claimDetail.claimDetailLine);
expect(result).toEqual(1);
});
});

View File

@ -31,7 +31,7 @@
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="zone in zones" ui-sref="zone.card.location({id: zone.id})" class=clickable> <vn-tr ng-repeat="zone in zones" ui-sref="zone.card.location({id: zone.id})" class="clickable searchResult">
<vn-td number>{{::zone.id}}</vn-td> <vn-td number>{{::zone.id}}</vn-td>
<vn-td>{{::zone.name}}</vn-td> <vn-td>{{::zone.name}}</vn-td>
<vn-td>{{::zone.agencyMode.name}}</vn-td> <vn-td>{{::zone.agencyMode.name}}</vn-td>

View File

@ -33,7 +33,7 @@
<vn-tbody> <vn-tbody>
<a <a
ng-repeat="claim in claims" ng-repeat="claim in claims"
class="{{::$ctrl.compareDate(ticket.shipped)}} clickable vn-tr" class="{{::$ctrl.compareDate(ticket.shipped)}} clickable vn-tr searchResult"
ui-sref="claim.card.summary({id: claim.id})"> ui-sref="claim.card.summary({id: claim.id})">
<vn-td number>{{::claim.id}}</vn-td> <vn-td number>{{::claim.id}}</vn-td>
<vn-td> <vn-td>

View File

@ -18,6 +18,7 @@
</vn-card> </vn-card>
<vn-card margin-medium-v> <vn-card margin-medium-v>
<vn-item-client <vn-item-client
class="searchResult"
ng-repeat="client in clients track by client.id" ng-repeat="client in clients track by client.id"
client="::client"> client="::client">
</vn-item-client> </vn-item-client>

View File

@ -19,6 +19,7 @@
</vn-card> </vn-card>
<vn-card margin-medium-v> <vn-card margin-medium-v>
<vn-item-product <vn-item-product
class="searchResult"
ng-repeat="item in items track by item.id" ng-repeat="item in items track by item.id"
item="::item"> item="::item">
</vn-item-product> </vn-item-product>

View File

@ -30,7 +30,7 @@
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="order in orders" class="clickable" <vn-tr ng-repeat="order in orders" class="clickable searchResult"
ui-sref="order.card.summary({id: {{::order.id}}})"> ui-sref="order.card.summary({id: {{::order.id}}})">
<vn-td>{{::order.id}}</vn-td> <vn-td>{{::order.id}}</vn-td>
<vn-td> <vn-td>

View File

@ -50,7 +50,7 @@
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<a ng-repeat="ticket in tickets" class="clickable vn-tr" <a ng-repeat="ticket in tickets" class="clickable vn-tr searchResult"
ui-sref="ticket.card.summary({id: {{::ticket.id}}})"> ui-sref="ticket.card.summary({id: {{::ticket.id}}})">
<vn-td> <vn-td>
<vn-icon ng-show="ticket.problem" class="bright" <vn-icon ng-show="ticket.problem" class="bright"

View File

@ -34,7 +34,7 @@
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="travel in travels" class="clickable"> <vn-tr ng-repeat="travel in travels" class="clickable searchResult">
<vn-td number>{{::travel.id}}</vn-td> <vn-td number>{{::travel.id}}</vn-td>
<vn-td>{{::travel.ref}}</vn-td> <vn-td>{{::travel.ref}}</vn-td>
<vn-td>{{::travel.agency.name}}</vn-td> <vn-td>{{::travel.agency.name}}</vn-td>