#1446 e2e ticket.summary
gitea/salix/dev This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2019-06-27 15:33:15 +02:00
parent b3ade3c7f5
commit bd76840cb3
6 changed files with 105 additions and 4 deletions

View File

@ -488,7 +488,14 @@ let actions = {
}) })
.then(done) .then(done)
.catch(done); .catch(done);
} },
waitForSpinnerLoad: function(done) {
let spinnerSelector = 'vn-spinner > div';
this.waitForClassNotPresent(spinnerSelector, 'is-active')
.then(done)
.catch(done);
},
}; };
Object.keys(actions).forEach(function(name) { Object.keys(actions).forEach(function(name) {

View File

@ -300,12 +300,17 @@ export default {
fifthLineCreatedProperty: 'vn-item-log > vn-log vn-tbody > vn-tr:nth-child(5) > vn-td > vn-one:nth-child(3) > div span:nth-child(3)', fifthLineCreatedProperty: 'vn-item-log > vn-log vn-tbody > vn-tr:nth-child(5) > vn-td > vn-one:nth-child(3) > div span:nth-child(3)',
}, },
ticketSummary: { ticketSummary: {
header: 'vn-ticket-summary > vn-card > div > h5',
state: 'vn-ticket-summary vn-label-value[label="State"] > section > span',
route: 'vn-ticket-summary vn-label-value[label="Route"] > section > span',
total: 'vn-ticket-summary vn-one.taxes > p:nth-child(3) > strong',
sale: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr', sale: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr',
firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span', firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span',
popoverDiaryButton: 'vn-ticket-summary vn-item-descriptor-popover vn-item-descriptor vn-icon[icon="icon-transaction"]', popoverDiaryButton: 'vn-ticket-summary vn-item-descriptor-popover vn-item-descriptor vn-icon[icon="icon-transaction"]',
firstSaleQuantity: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3)', firstSaleQuantity: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3)',
firstSaleDiscount: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6)', firstSaleDiscount: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6)',
invoiceOutRef: 'vn-ticket-summary > vn-card > div > vn-horizontal > vn-one:nth-child(1) > vn-label-value:nth-child(6) > section > span' invoiceOutRef: 'vn-ticket-summary > vn-card > div > vn-horizontal > vn-one:nth-child(1) > vn-label-value:nth-child(6) > section > span',
setOk: 'vn-ticket-summary vn-button[label="SET OK"] > button'
}, },
ticketsIndex: { ticketsIndex: {
openAdvancedSearchButton: 'vn-ticket-index vn-searchbar t-right-icons > vn-icon[icon="keyboard_arrow_down"]', openAdvancedSearchButton: 'vn-ticket-index vn-searchbar t-right-icons > vn-icon[icon="keyboard_arrow_down"]',

View File

@ -23,7 +23,6 @@ describe('Ticket Edit basic data path', () => {
it(`should have a price diference`, async() => { it(`should have a price diference`, async() => {
const result = await nightmare const result = await nightmare
.wait(1900)
.waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText'); .waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
expect(result).toContain('-€184.25'); expect(result).toContain('-€184.25');

View File

@ -0,0 +1,89 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Ticket Summary path', () => {
const nightmare = createNightmare();
const ticketId = 20;
it('should navigate to the target ticket summary section', async() => {
let url = await nightmare
.loginAndModule('employee', 'ticket')
.accessToSearchResult(ticketId)
.waitForURL('/summary')
.parsedUrl();
expect(url.hash).toContain('/summary');
});
it(`should display details from the ticket and it's client on the top of the header`, async() => {
let result = await nightmare
.waitForSpinnerLoad()
.waitToGetProperty(selectors.ticketSummary.header, 'innerText');
expect(result).toContain(`Ticket #${ticketId}`);
expect(result).toContain('Bruce Banner (109)');
expect(result).toContain('Somewhere in Thailand');
});
it('should display ticket details', async() => {
let result = await nightmare
.waitToGetProperty(selectors.ticketSummary.state, 'innerText');
expect(result).toContain('Arreglar');
});
it('should display delivery details', async() => {
let result = await nightmare
.waitToGetProperty(selectors.ticketSummary.route, 'innerText');
expect(result).toContain('3');
});
it('should display the ticket total', async() => {
let result = await nightmare
.waitToGetProperty(selectors.ticketSummary.total, 'innerText');
expect(result).toContain('€155.54');
});
it('should display the ticket line(s)', async() => {
let result = await nightmare
.waitToGetProperty(selectors.ticketSummary.firstSaleItemId, 'innerText');
expect(result).toContain('000002');
});
it('should click on the SET OK button and throw a privileges error', async() => {
let result = await nightmare
.waitToClick(selectors.ticketSummary.setOk)
.waitForLastSnackbar();
expect(result).toEqual(`You don't have enough privileges`);
});
it('should log in as production then navigate to the summary of the same ticket', async() => {
let url = await nightmare
.loginAndModule('production', 'ticket')
.accessToSearchResult(ticketId)
.waitForURL('/summary')
.parsedUrl();
expect(url.hash).toContain('/summary');
});
it('should click on the SET OK button', async() => {
let result = await nightmare
.waitToClick(selectors.ticketSummary.setOk)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the ticket state was updated', async() => {
let result = await nightmare
.waitForSpinnerLoad()
.waitToGetProperty(selectors.ticketSummary.state, 'innerText');
expect(result).toContain('OK');
});
});

View File

@ -44,6 +44,7 @@ Price gap: Diferencia de precio
Quantity: Cantidad Quantity: Cantidad
Remove lines: Borrar lineas Remove lines: Borrar lineas
Route: Ruta Route: Ruta
SET OK: PONER OK
Shipment: Salida Shipment: Salida
Shipped: F. envío Shipped: F. envío
Some fields are invalid: Algunos campos no son válidos Some fields are invalid: Algunos campos no son válidos

View File

@ -2,7 +2,7 @@
<h5 >Ticket #{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} ({{$ctrl.summary.client.id}}) - {{$ctrl.summary.nickname}} <h5 >Ticket #{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} ({{$ctrl.summary.client.id}}) - {{$ctrl.summary.nickname}}
<vn-button <vn-button
disabled="!$ctrl.isEditable" disabled="!$ctrl.isEditable"
label="poner OK" label="SET OK"
ng-click="$ctrl.setOkState()" ng-click="$ctrl.setOkState()"
vn-tooltip="Change ticket state to 'Ok'"> vn-tooltip="Change ticket state to 'Ok'">
</vn-button> </vn-button>