#759 e2e ticket component

This commit is contained in:
Carlos Jimenez 2018-10-25 16:44:03 +02:00
parent cacfa3988e
commit 11787ec2e1
11 changed files with 1395 additions and 1321 deletions

View File

@ -1,3 +1,5 @@
/* eslint no-invalid-this: "off" */
import config from './config.js';
import Nightmare from 'nightmare';
import {URL} from 'url';
@ -15,10 +17,10 @@ Nightmare.action('login', function(userName, done) {
Nightmare.action('changeLanguageToEnglish', function(done) {
this.wait('#lang')
.evaluate(selector => {
.evaluate((selector) => {
return document.querySelector(selector).title;
}, '#lang')
.then(title => {
.then((title) => {
if (title === 'Change language') {
this.then(done);
} else {
@ -39,7 +41,7 @@ Nightmare.action('waitForLogin', function(userName, done) {
Nightmare.action('parsedUrl', function(done) {
this.url()
.then(url => {
.then((url) => {
done(null, new URL(url));
});
});
@ -50,13 +52,22 @@ Nightmare.action('getProperty', function(selector, property, done) {
}, done, selector, property);
});
Nightmare.action('waitPropertyLength', function(selector, property, minLength, done) {
this.wait((selector, property, minLength) => {
const element = document.querySelector(selector);
return element && element[property] != null && element[property] !== '' && element[property].length >= minLength;
}, selector, property, minLength)
.getProperty(selector, property)
.then((result) => done(null, result), done);
});
Nightmare.action('waitProperty', function(selector, property, done) {
this.wait((selector, property) => {
let element = document.querySelector(selector);
const element = document.querySelector(selector);
return element && element[property] != null && element[property] !== '';
}, selector, property)
.getProperty(selector, property)
.then(result => done(null, result), done);
.then((result) => done(null, result), done);
});
Nightmare.action('getInnerText', function(selector, done) {
@ -74,7 +85,7 @@ Nightmare.action('getInputValue', function(selector, done) {
});
Nightmare.action('clearInput', function(selector, done) {
let backSpaces = [];
const backSpaces = [];
for (let i = 0; i < 50; i += 1) {
backSpaces.push('\u0008');
}
@ -97,7 +108,7 @@ Nightmare.action('waitToClick', function(selector, done) {
Nightmare.action('isVisible', function(selector, done) {
this.wait(selector)
.evaluate_now(elementSelector => {
.evaluate_now((elementSelector) => {
const selectorMatches = document.querySelectorAll(elementSelector);
const element = selectorMatches[0];
if (selectorMatches.length > 1) {
@ -105,7 +116,7 @@ Nightmare.action('isVisible', function(selector, done) {
}
let isVisible = false;
if (element) {
const eventHandler = event => {
const eventHandler = (event) => {
event.preventDefault();
isVisible = true;
};
@ -119,7 +130,7 @@ Nightmare.action('isVisible', function(selector, done) {
const e = new MouseEvent('mouseover', {
view: window,
bubbles: true,
cancelable: true
cancelable: true,
});
if (elementInCenter) {
elementInCenter.dispatchEvent(e);
@ -138,7 +149,7 @@ Nightmare.action('isVisible', function(selector, done) {
Nightmare.action('selectText', function(selector, done) {
this.wait(selector)
.evaluate(elementToSelect => {
.evaluate((elementToSelect) => {
const range = document.createRange();
range.selectNodeContents(document.querySelector(elementToSelect));
const sel = window.getSelection();
@ -150,7 +161,7 @@ Nightmare.action('selectText', function(selector, done) {
});
Nightmare.action('countElement', function(selector, done) {
this.evaluate_now(selector => {
this.evaluate_now((selector) => {
return document.querySelectorAll(selector).length;
}, done, selector);
});
@ -200,24 +211,24 @@ Nightmare.action('waitForTextInInput', function(selector, name, done) {
Nightmare.action('waitForInnerText', function(selector, done) {
this.wait(selector)
.wait(selector => {
let innerText = document.querySelector(selector).innerText;
.wait((selector) => {
const innerText = document.querySelector(selector).innerText;
return innerText != null && innerText != '';
}, selector)
.evaluate_now(selector => {
.evaluate_now((selector) => {
return document.querySelector(selector).innerText;
}, done, selector);
});
Nightmare.action('waitForEmptyInnerText', function(selector, done) {
this.wait(selector => {
this.wait((selector) => {
return document.querySelector(selector).innerText == '';
}, selector)
.then(done);
});
Nightmare.action('waitForURL', function(hashURL, done) {
this.wait(hash => {
this.wait((hash) => {
return document.location.hash.includes(hash);
}, hashURL)
.then(done);
@ -225,11 +236,11 @@ Nightmare.action('waitForURL', function(hashURL, done) {
Nightmare.action('waitForShapes', function(selector, done) {
this.wait(selector)
.evaluate_now(selector => {
let shapes = document.querySelectorAll(selector);
let shapesList = [];
.evaluate_now((selector) => {
const shapes = document.querySelectorAll(selector);
const shapesList = [];
for (let shape of shapes) {
for (const shape of shapes) {
shapesList.push(shape.innerText);
}
@ -239,15 +250,15 @@ Nightmare.action('waitForShapes', function(selector, done) {
Nightmare.action('waitForSnackbar', function(done) {
this.wait(500).waitForShapes('vn-snackbar .shape .text')
.then(shapes => {
.then((shapes) => {
done(null, shapes);
});
});
Nightmare.action('waitForLastShape', function(selector, done) {
this.wait(selector)
.evaluate_now(selector => {
let shape = document.querySelector(selector);
.evaluate_now((selector) => {
const shape = document.querySelector(selector);
return shape.innerText;
}, done, selector);
@ -255,7 +266,7 @@ Nightmare.action('waitForLastShape', function(selector, done) {
Nightmare.action('waitForLastSnackbar', function(done) {
this.wait(500).waitForLastShape('vn-snackbar .shape .text')
.then(shapes => {
.then((shapes) => {
done(null, shapes);
});
});

View File

@ -1,5 +1,3 @@
// eslint max-len: ["error", 500]
// eslint key-spacing: ["error", 500]
import components from './components_selectors.js';
export default {
@ -9,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"]`,
@ -31,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"]`,
@ -46,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"]`,
@ -73,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"]`,
@ -90,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"]`,
@ -123,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"]`,
@ -153,15 +151,15 @@ 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',
},
itemsIndex: {
goBackToModuleIndexButton: `vn-ticket-descriptor a[href="#!/ticket/index"]`,
@ -172,7 +170,7 @@ export default {
acceptClonationAlertButton: `vn-item-index [vn-id="clone"] [response="ACCEPT"]`,
searchItemInput: `${components.vnTextfield}`,
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"]`,
@ -183,7 +181,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: {
@ -201,7 +199,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"]',
@ -231,7 +229,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"]`,
@ -241,14 +239,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"]`,
@ -262,7 +260,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"]`,
@ -273,7 +271,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"]`,
@ -281,14 +279,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"]`,
@ -297,12 +295,12 @@ 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"]`,
secondExpeditionText: `vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(2)`
secondExpeditionText: `vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(2)`,
},
ticketPackages: {
packagesButton: `vn-menu-item a[ui-sref="ticket.card.package.index"]`,
@ -312,7 +310,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`,
@ -360,7 +358,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"]`,
@ -368,7 +366,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"]`,
@ -383,18 +381,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',
},
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"]`,
@ -404,10 +408,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

@ -3,15 +3,15 @@ import createNightmare from '../../helpers/nightmare';
describe('Client', () => {
describe('create path', () => {
let nightmare = createNightmare();
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('employee');
});
it('should access to the clients index by clicking the clients button', async() => {
let url = await nightmare
it('should access to the clients index by clicking the clients button', async () => {
const url = await nightmare
.click(selectors.moduleAccessView.clientsSectionButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl();
@ -19,8 +19,8 @@ describe('Client', () => {
expect(url.hash).toEqual('#!/client/index');
});
it(`should search for the user Carol Danvers to confirm it isn't created yet`, async() => {
let result = await nightmare
it(`should search for the user Carol Danvers to confirm it isn't created yet`, async () => {
const result = await nightmare
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
.click(selectors.clientsIndex.searchButton)
@ -30,8 +30,8 @@ describe('Client', () => {
expect(result).toEqual(0);
});
it('should access to the create client view by clicking the create-client floating button', async() => {
let url = await nightmare
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();
@ -39,8 +39,8 @@ describe('Client', () => {
expect(url.hash).toEqual('#!/client/create');
});
it('should return to the client index by clicking the cancel button', async() => {
let url = await nightmare
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();
@ -48,8 +48,8 @@ describe('Client', () => {
expect(url.hash).toEqual('#!/client/index');
});
it('should now access to the create client view by clicking the create-client floating button', async() => {
let url = await nightmare
it('should now 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();
@ -57,16 +57,16 @@ describe('Client', () => {
expect(url.hash).toEqual('#!/client/create');
});
it('should receive an error when clicking the create button having all the form fields empty', async() => {
let result = await nightmare
it('should receive an error when clicking the create button having all the form fields empty', async () => {
const result = await nightmare
.click(selectors.createClientView.createButton)
.waitForLastSnackbar();
expect(result).toEqual('Some fields are invalid');
});
it('should receive an error when clicking the create button having name and Business name fields empty', async() => {
let result = await nightmare
it('should receive an error when clicking the create button having name and Business name fields empty', async () => {
const result = await nightmare
.type(selectors.createClientView.taxNumber, '74451390E')
.type(selectors.createClientView.userName, 'CaptainMarvel')
.type(selectors.createClientView.email, 'CarolDanvers@verdnatura.es')
@ -78,8 +78,8 @@ describe('Client', () => {
expect(result).toEqual('Some fields are invalid');
});
it(`should attempt to create a new user with all it's data but wrong email`, async() => {
let result = await nightmare
it(`should attempt to create a new user with all it's data but wrong email`, async () => {
const result = await nightmare
.type(selectors.createClientView.name, 'Carol Danvers')
.type(selectors.createClientView.socialName, 'AVG tax')
.clearInput(selectors.createClientView.email)
@ -90,8 +90,8 @@ describe('Client', () => {
expect(result).toEqual('Some fields are invalid');
});
it(`should create a new user with all correct data`, async() => {
let result = await nightmare
it(`should create a new user with all correct data`, async () => {
const result = await nightmare
.clearInput(selectors.createClientView.email)
.type(selectors.createClientView.email, 'caroldanvers@verdnatura.es')
.click(selectors.createClientView.createButton)
@ -100,8 +100,8 @@ describe('Client', () => {
expect(result).toEqual('Data saved!');
});
it('should click on the Clients button of the top bar menu', async() => {
let url = await nightmare
it('should 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)
@ -111,8 +111,8 @@ describe('Client', () => {
expect(url.hash).toEqual('#!/client/index');
});
it(`should search for the user Carol Danvers to confirm it exists`, async() => {
let result = await nightmare
it(`should search for the user Carol Danvers to confirm it exists`, async () => {
const result = await nightmare
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
.click(selectors.clientsIndex.searchButton)

View File

@ -10,44 +10,44 @@ describe('Ticket', () => {
.waitForLogin('employee');
});
it('should access to the tickets index by clicking the tickets button', done => {
it('should access to the tickets index by clicking the tickets button', (done) => {
return nightmare
.click(selectors.moduleAccessView.ticketsSectionButton)
.wait(selectors.ticketsIndex.searchResult)
.parsedUrl()
.then(url => {
.then((url) => {
expect(url.hash).toEqual('#!/ticket/index');
done();
}).catch(done.fail);
});
it('should search for the ticket with id 1', done => {
it('should search for the ticket with id 1', (done) => {
return nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult)
.then(result => {
.then((result) => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it(`should click on the search result to access to the ticket notes`, done => {
it(`should click on the search result to access to the ticket notes`, (done) => {
return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketNotes.notesButton)
.waitForURL('observation')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('observation');
done();
}).catch(done.fail);
});
it(`should click create a new note and delete a former one`, done => {
it(`should click create a new note and delete a former one`, (done) => {
return nightmare
.waitToClick(selectors.ticketNotes.firstNoteRemoveButton)
.waitToClick(selectors.ticketNotes.addNoteButton)
@ -56,24 +56,24 @@ describe('Ticket', () => {
.type(selectors.ticketNotes.firstDescriptionInput, 'description')
.click(selectors.ticketNotes.submitNotesButton)
.waitForLastSnackbar()
.then(result => {
.then((result) => {
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it(`should confirm the note is the expected one`, done => {
it(`should confirm the note is the expected one`, (done) => {
return nightmare
.click(selectors.ticketPackages.packagesButton)
.wait(selectors.ticketPackages.firstPackageSelect)
.click(selectors.ticketNotes.notesButton)
.waitProperty(selectors.ticketNotes.firstNoteSelect, 'value')
.then(result => {
.then((result) => {
expect(result).toEqual('observation one');
return nightmare
.getProperty(selectors.ticketNotes.firstDescriptionInput, 'value');
})
.then(result => {
.then((result) => {
expect(result).toEqual('description');
done();
}).catch(done.fail);

View File

@ -10,44 +10,44 @@ describe('Ticket', () => {
.waitForLogin('production');
});
it('should access to the tickets index by clicking the tickets button', done => {
it('should access to the tickets index by clicking the tickets button', (done) => {
return nightmare
.click(selectors.moduleAccessView.ticketsSectionButton)
.wait(selectors.ticketsIndex.searchResult)
.parsedUrl()
.then(url => {
.then((url) => {
expect(url.hash).toEqual('#!/ticket/index');
done();
}).catch(done.fail);
});
it('should search for the ticket with id 1', done => {
it('should search for the ticket with id 1', (done) => {
return nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult)
.then(result => {
.then((result) => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it(`should click on the search result to access to the ticket expeditions`, done => {
it(`should click on the search result to access to the ticket expeditions`, (done) => {
return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketExpedition.expeditionButton)
.waitForURL('expedition')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('expedition');
done();
}).catch(done.fail);
});
it(`should delete a former expedition and confirm the remaining expedition is the expected one`, done => {
it(`should delete a former expedition and confirm the remaining expedition is the expected one`, (done) => {
return nightmare
.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton)
.click(selectors.ticketPackages.packagesButton)
@ -55,7 +55,7 @@ describe('Ticket', () => {
.click(selectors.ticketExpedition.expeditionButton)
.wait(selectors.ticketExpedition.secondExpeditionText)
.getInnerText(selectors.ticketExpedition.secondExpeditionText)
.then(value => {
.then((value) => {
expect(value).toContain('Iron Patriot');
expect(value).toContain('root');
done();

View File

@ -9,132 +9,108 @@ describe('Ticket List sale path', () => {
.waitForLogin('employee');
});
it('should click on the Tickets button of the top bar menu', done => {
return nightmare
it('should click on the Tickets button of the top bar menu', async () => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult)
.parsedUrl()
.then(url => {
.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
done();
}).catch(done.fail);
});
it('should search for the ticket 1', done => {
return nightmare
it('should search for the ticket 1', async () => {
const result = await nightmare
.wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult)
.then(result => {
.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it(`should click on the search result to access to the ticket's sale`, done => {
return nightmare
it(`should click on the search result to access to the ticket's sale`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton)
.waitForURL('sale')
.url()
.then(url => {
.url();
expect(url).toContain('sale');
done();
}).catch(done.fail);
});
it('should confirm the first ticket sale contains the colour', done => {
return nightmare
it('should confirm the first ticket sale contains the colour', async () => {
const value = await nightmare
.wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSaleColour)
.then(value => {
.getInnerText(selectors.ticketSales.firstSaleColour);
expect(value).toContain('Yellow');
done();
}).catch(done.fail);
});
it('should confirm the first ticket sale contains the lenght', done => {
return nightmare
it('should confirm the first ticket sale contains the lenght', async () => {
const value = await nightmare
.wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSaleText)
.then(value => {
.getInnerText(selectors.ticketSales.firstSaleText);
expect(value).toContain('5');
done();
}).catch(done.fail);
});
it('should confirm the first ticket sale contains the price', done => {
return nightmare
it('should confirm the first ticket sale contains the price', async () => {
const value = await nightmare
.wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSalePrice)
.then(value => {
.getInnerText(selectors.ticketSales.firstSalePrice);
expect(value).toContain('9.10');
done();
}).catch(done.fail);
});
it('should confirm the first ticket sale contains the discount', done => {
return nightmare
it('should confirm the first ticket sale contains the discount', async () => {
const value = await nightmare
.wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSaleDiscount)
.then(value => {
.getInnerText(selectors.ticketSales.firstSaleDiscount);
expect(value).toContain('0 %');
done();
}).catch(done.fail);
});
it('should confirm the first ticket sale contains the total import', done => {
return nightmare
it('should confirm the first ticket sale contains the total import', async () => {
const value = await nightmare
.wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSaleImport)
.then(value => {
.getInnerText(selectors.ticketSales.firstSaleImport);
expect(value).toContain('45.50');
done();
}).catch(done.fail);
});
it('should confirm the second ticket sale contains the colour', done => {
return nightmare
it('should confirm the second ticket sale contains the colour', async () => {
const value = await nightmare
.wait(selectors.ticketSales.secondSaleText)
.getInnerText(selectors.ticketSales.secondSaleColour)
.then(value => {
.getInnerText(selectors.ticketSales.secondSaleColour);
expect(value).toContain('Red');
done();
}).catch(done.fail);
});
it('should confirm the second ticket sale contains the price', done => {
return nightmare
it('should confirm the second ticket sale contains the price', async () => {
const value = await nightmare
.wait(selectors.ticketSales.secondSaleText)
.getInnerText(selectors.ticketSales.secondSalePrice)
.then(value => {
.getInnerText(selectors.ticketSales.secondSalePrice);
expect(value).toContain('1.07');
done();
}).catch(done.fail);
});
it('should confirm the second ticket sale contains the discount', done => {
return nightmare
it('should confirm the second ticket sale contains the discount', async () => {
const value = await nightmare
.wait(selectors.ticketSales.secondSaleText)
.getInnerText(selectors.ticketSales.secondSaleDiscount)
.then(value => {
.getInnerText(selectors.ticketSales.secondSaleDiscount);
expect(value).toContain('0 %');
done();
}).catch(done.fail);
});
it('should confirm the second ticket sale contains the total import', done => {
return nightmare
it('should confirm the second ticket sale contains the total import', async () => {
const value = await nightmare
.wait(selectors.ticketSales.secondSaleText)
.getInnerText(selectors.ticketSales.secondSaleImport)
.then(value => {
.getInnerText(selectors.ticketSales.secondSaleImport);
expect(value).toContain('10.70');
done();
}).catch(done.fail);
});
});

View File

@ -9,46 +9,46 @@ describe('Ticket Create packages path', () => {
.waitForLogin('employee');
});
it('should click on the Tickets button of the top bar menu', done => {
it('should click on the Tickets button of the top bar menu', (done) => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult)
.parsedUrl()
.then(url => {
.then((url) => {
expect(url.hash).toEqual('#!/ticket/index');
done();
}).catch(done.fail);
});
it('should search for the ticket 1', done => {
it('should search for the ticket 1', (done) => {
return nightmare
.wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult)
.then(result => {
.then((result) => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it(`should click on the search result to access to the ticket packages`, done => {
it(`should click on the search result to access to the ticket packages`, (done) => {
return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResultAddress, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketPackages.packagesButton)
.waitForURL('package/index')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('package/index');
done();
}).catch(done.fail);
});
it(`should delete the first package and receive and error to save a new one with blank quantity`, done => {
it(`should delete the first package and receive and error to save a new one with blank quantity`, (done) => {
return nightmare
.waitToClick(selectors.ticketPackages.firstRemovePackageButton)
.waitToClick(selectors.ticketPackages.addPackageButton)
@ -56,79 +56,79 @@ describe('Ticket Create packages path', () => {
.waitToClick(selectors.ticketPackages.firstPackageSelectOptionTwo)
.click(selectors.ticketPackages.savePackagesButton)
.waitForLastSnackbar()
.then(result => {
.then((result) => {
expect(result).toEqual('Some fields are invalid');
done();
}).catch(done.fail);
});
it(`should attempt create a new package but receive an error if quantity is a string`, done => {
it(`should attempt create a new package but receive an error if quantity is a string`, (done) => {
return nightmare
.type(selectors.ticketPackages.firstQuantityInput, 'ninety 9')
.click(selectors.ticketPackages.savePackagesButton)
.waitForLastSnackbar()
.then(result => {
.then((result) => {
expect(result).toEqual('Some fields are invalid');
done();
}).catch(done.fail);
});
it(`should attempt create a new package but receive an error if quantity is 0`, done => {
it(`should attempt create a new package but receive an error if quantity is 0`, (done) => {
return nightmare
.clearInput(selectors.ticketPackages.firstQuantityInput)
.type(selectors.ticketPackages.firstQuantityInput, 0)
.click(selectors.ticketPackages.savePackagesButton)
.waitForLastSnackbar()
.then(result => {
.then((result) => {
expect(result).toEqual('Some fields are invalid');
done();
}).catch(done.fail);
});
it(`should attempt create a new package but receive an error if package is blank`, done => {
it(`should attempt create a new package but receive an error if package is blank`, (done) => {
return nightmare
.clearInput(selectors.ticketPackages.firstQuantityInput)
.type(selectors.ticketPackages.firstQuantityInput, 99)
.click(selectors.ticketPackages.clearPackageSelectButton)
.click(selectors.ticketPackages.savePackagesButton)
.waitForLastSnackbar()
.then(result => {
.then((result) => {
expect(result).toEqual('Package cannot be blank');
done();
}).catch(done.fail);
});
it(`should create a new package with correct data`, done => {
it(`should create a new package with correct data`, (done) => {
return nightmare
.waitToClick(selectors.ticketPackages.firstPackageSelect)
.waitToClick(selectors.ticketPackages.firstPackageSelectOptionTwo)
.waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Legendary Box')
.click(selectors.ticketPackages.savePackagesButton)
.waitForLastSnackbar()
.then(result => {
.then((result) => {
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it(`should confirm the first select is the expected one`, done => {
it(`should confirm the first select is the expected one`, (done) => {
return nightmare
.click(selectors.ticketSales.saleButton)
.wait(selectors.ticketSales.firstPackageSelect)
.click(selectors.ticketPackages.packagesButton)
.waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Legendary Box')
.getInputValue(selectors.ticketPackages.firstPackageSelect)
.then(result => {
.then((result) => {
expect(result).toEqual('Legendary Box');
done();
}).catch(done.fail);
});
it(`should confirm the first quantity is the expected one`, done => {
it(`should confirm the first quantity is the expected one`, (done) => {
return nightmare
.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99')
.getInputValue(selectors.ticketPackages.firstQuantityInput)
.then(result => {
.then((result) => {
expect(result).toEqual('99');
done();
}).catch(done.fail);

View File

@ -10,97 +10,97 @@ describe('Ticket', () => {
.waitForLogin('production');
});
it('should click on the Tickets button of the top bar menu', done => {
it('should click on the Tickets button of the top bar menu', (done) => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult)
.parsedUrl()
.then(url => {
.then((url) => {
expect(url.hash).toEqual('#!/ticket/index');
done();
}).catch(done.fail);
});
it('should search for the ticket 1', done => {
it('should search for the ticket 1', (done) => {
return nightmare
.wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult)
.then(result => {
.then((result) => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it(`should click on the search result to access to the ticket Tracking`, done => {
it(`should click on the search result to access to the ticket Tracking`, (done) => {
return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketTracking.trackingButton)
.waitForURL('tracking/index')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('tracking/index');
done();
}).catch(done.fail);
});
it('should access to the create state view by clicking the create floating button', done => {
it('should access to the create state view by clicking the create floating button', (done) => {
return nightmare
.click(selectors.ticketTracking.createStateButton)
.wait(selectors.createStateView.stateInput)
.parsedUrl()
.then(url => {
.then((url) => {
expect(url.hash).toContain('tracking/edit');
done();
}).catch(done.fail);
});
it(`should attempt create a new state but receive an error if state is empty`, done => {
it(`should attempt create a new state but receive an error if state is empty`, (done) => {
return nightmare
.click(selectors.createStateView.saveStateButton)
.waitForLastSnackbar()
.then(result => {
.then((result) => {
expect(result).toEqual('No changes to save');
done();
}).catch(done.fail);
});
it(`should attempt create a new state then clear and save it`, done => {
it(`should attempt create a new state then clear and save it`, (done) => {
return nightmare
.waitToClick(selectors.createStateView.stateInput)
.waitToClick(selectors.createStateView.stateInputOptionOne)
.waitToClick(selectors.createStateView.clearStateInputButton)
.click(selectors.createStateView.saveStateButton)
.waitForLastSnackbar()
.then(result => {
.then((result) => {
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it('should again access to the create state view by clicking the create floating button', done => {
it('should again access to the create state view by clicking the create floating button', (done) => {
return nightmare
.click(selectors.ticketTracking.createStateButton)
.wait(selectors.createStateView.stateInput)
.parsedUrl()
.then(url => {
.then((url) => {
expect(url.hash).toContain('tracking/edit');
done();
}).catch(done.fail);
});
it(`should create a new state`, done => {
it(`should create a new state`, (done) => {
return nightmare
.waitToClick(selectors.createStateView.stateInput)
.waitToClick(selectors.createStateView.stateInputOptionOne)
.click(selectors.createStateView.saveStateButton)
.waitForLastSnackbar()
.then(result => {
.then((result) => {
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);

View File

@ -10,46 +10,46 @@ describe('Ticket', () => {
.waitForLogin('employee');
});
it('should click on the Tickets button of the top bar menu', done => {
it('should click on the Tickets button of the top bar menu', (done) => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult)
.parsedUrl()
.then(url => {
.then((url) => {
expect(url.hash).toEqual('#!/ticket/index');
done();
}).catch(done.fail);
});
it('should search for the ticket 11', done => {
it('should search for the ticket 11', (done) => {
return nightmare
.wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:11')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult)
.then(result => {
.then((result) => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it(`should click on the search result to access to the ticket Basic Data`, done => {
it(`should click on the search result to access to the ticket Basic Data`, (done) => {
return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') // should be Bruce Wayne
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketBasicData.basicDataButton)
.waitForURL('data/step-one')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('data/step-one');
done();
}).catch(done.fail);
});
it(`should edit the client and address of the ticket then click next`, done => {
it(`should edit the client and address of the ticket then click next`, (done) => {
return nightmare
.waitToClick(selectors.ticketBasicData.clientSelect)
.waitToClick(selectors.ticketBasicData.clientSelectThirdOption)
@ -60,33 +60,33 @@ describe('Ticket', () => {
.click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-two')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('data/step-two');
done();
}).catch(done.fail);
});
it(`should have no price diference`, done => {
it(`should have no price diference`, (done) => {
return nightmare
.getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif)
.then(result => {
.then((result) => {
expect(result).toContain('0');
done();
}).catch(done.fail);
});
it(`should click next to move on to step three`, done => {
it(`should click next to move on to step three`, (done) => {
return nightmare
.click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-three')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('data/step-three');
done();
}).catch(done.fail);
});
it(`should select a reason for the changes made then click on finalize`, done => {
it(`should select a reason for the changes made then click on finalize`, (done) => {
return nightmare
.waitToClick(selectors.ticketBasicData.chargesReason)
.waitToClick(selectors.ticketBasicData.chargesReasonFourthOption)
@ -94,24 +94,24 @@ describe('Ticket', () => {
.click(selectors.ticketBasicData.finalizeButton)
.waitForURL('summary')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('summary');
done();
}).catch(done.fail);
});
it(`should go back to ticket.basicData section`, done => {
it(`should go back to ticket.basicData section`, (done) => {
return nightmare
.waitToClick(selectors.ticketBasicData.basicDataButton)
.waitForURL('data/step-one')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('data/step-one');
done();
}).catch(done.fail);
});
it(`should edit the ticket agency then click next`, done => {
it(`should edit the ticket agency then click next`, (done) => {
return nightmare
.waitToClick(selectors.ticketBasicData.agencySelect)
.waitToClick(selectors.ticketBasicData.agencySelectOptionSix)
@ -119,33 +119,33 @@ describe('Ticket', () => {
.click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-two')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('data/step-two');
done();
}).catch(done.fail);
});
it(`should have a price diference`, done => {
it(`should have a price diference`, (done) => {
return nightmare
.getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif)
.then(result => {
.then((result) => {
expect(result).toContain('-20.65');
done();
}).catch(done.fail);
});
it(`should then click next to move on to step three`, done => {
it(`should then click next to move on to step three`, (done) => {
return nightmare
.click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-three')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('data/step-three');
done();
}).catch(done.fail);
});
it(`should select a new reason for the changes made then click on finalize`, done => {
it(`should select a new reason for the changes made then click on finalize`, (done) => {
return nightmare
.waitToClick(selectors.ticketBasicData.chargesReason)
.waitToClick(selectors.ticketBasicData.chargesReasonFirstOption)
@ -153,7 +153,7 @@ describe('Ticket', () => {
.click(selectors.ticketBasicData.finalizeButton)
.waitForURL('summary')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('summary');
done();
}).catch(done.fail);

View File

@ -9,126 +9,126 @@ describe('Ticket Edit sale path', () => {
.waitForLogin('salesPerson');
});
it('should click on the Tickets button of the top bar menu', done => {
it('should click on the Tickets button of the top bar menu', (done) => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult)
.parsedUrl()
.then(url => {
.then((url) => {
expect(url.hash).toEqual('#!/ticket/index');
done();
}).catch(done.fail);
});
it('should search for a specific ticket', done => {
it('should search for a specific ticket', (done) => {
return nightmare
.wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:16')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult)
.then(result => {
.then((result) => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it(`should click on the search result to access to the ticket Sale`, done => {
it(`should click on the search result to access to the ticket Sale`, (done) => {
return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('/sale');
done();
}).catch(done.fail);
});
it(`should check the zoomed image isnt present`, done => {
it(`should check the zoomed image isnt present`, (done) => {
return nightmare
.countElement(selectors.ticketSales.firstSaleZoomedImage)
.then(result => {
.then((result) => {
expect(result).toEqual(0);
done();
}).catch(done.fail);
});
it(`should click on the thumbnail image of the 1st sale and see the zoomed image`, done => {
it(`should click on the thumbnail image of the 1st sale and see the zoomed image`, (done) => {
return nightmare
.waitToClick(selectors.ticketSales.firstSaleThumbnailImage)
.countElement(selectors.ticketSales.firstSaleZoomedImage)
.then(result => {
.then((result) => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it(`should click on the zoomed image to close it`, done => {
it(`should click on the zoomed image to close it`, (done) => {
return nightmare
.waitToClick(selectors.ticketSales.firstSaleZoomedImage)
.countElement(selectors.ticketSales.firstSaleZoomedImage)
.then(result => {
.then((result) => {
expect(result).toEqual(0);
done();
}).catch(done.fail);
});
it(`should confirm the item descriptor insnt visible yet`, done => {
it(`should confirm the item descriptor insnt visible yet`, (done) => {
return nightmare
.isVisible(selectors.ticketSales.saleDescriptorPopover)
.then(visible => {
.then((visible) => {
expect(visible).toBeFalsy();
done();
}).catch(done.fail);
});
it(`should click on the first sale ID making the item descriptor visible`, done => {
it(`should click on the first sale ID making the item descriptor visible`, (done) => {
return nightmare
.waitToClick(selectors.ticketSales.firstSaleID)
.wait(1000)
.isVisible(selectors.ticketSales.saleDescriptorPopover)
.then(visible => {
.then((visible) => {
expect(visible).toBeTruthy();
done();
}).catch(done.fail);
});
it(`should click on the descriptor image of the 1st sale and see the zoomed image`, done => {
it(`should click on the descriptor image of the 1st sale and see the zoomed image`, (done) => {
return nightmare
.waitToClick('vn-item-descriptor img')
.countElement(selectors.ticketSales.firstSaleZoomedImage)
.then(result => {
.then((result) => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it(`should click on the zoomed image to close it`, done => {
it(`should click on the zoomed image to close it`, (done) => {
return nightmare
.waitToClick(selectors.ticketSales.firstSaleZoomedImage)
.countElement(selectors.ticketSales.firstSaleZoomedImage)
.then(result => {
.then((result) => {
expect(result).toEqual(0);
done();
}).catch(done.fail);
});
it(`should click on the summary icon of the item-descriptor to access to the item summary`, done => {
it(`should click on the summary icon of the item-descriptor to access to the item summary`, (done) => {
return nightmare
.waitToClick(selectors.ticketSales.saleDescriptorPopoverSummaryButton)
.waitForURL('/summary')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('/summary');
done();
}).catch(done.fail);
});
it('should return to ticket sales section', done => {
it('should return to ticket sales section', (done) => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
@ -142,99 +142,99 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('/sale');
done();
}).catch(done.fail);
});
it('should try to add a higher quantity value and then receive an error', done => {
it('should try to add a higher quantity value and then receive an error', (done) => {
return nightmare
.waitToClick(selectors.ticketSales.firstSaleQuantityClearInput)
.type(selectors.ticketSales.firstSaleQuantity, '9\u000d')
.waitForLastSnackbar()
.then(result => {
.then((result) => {
expect(result).toEqual('The new quantity should be smaller than the old one');
done();
}).catch(done.fail);
});
it('should remove 1 from quantity', done => {
it('should remove 1 from quantity', (done) => {
return nightmare
.waitToClick(selectors.ticketSales.firstSaleQuantityClearInput)
.type(selectors.ticketSales.firstSaleQuantity, '4\u000d')
.waitForLastSnackbar()
.then(result => {
.then((result) => {
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it('should update the price', done => {
it('should update the price', (done) => {
return nightmare
.waitToClick(selectors.ticketSales.firstSalePrice)
.wait(selectors.ticketSales.firstSalePriceInput)
.type(selectors.ticketSales.firstSalePriceInput, 5)
.type('body', '\u000d') // simulates enter
.waitForLastSnackbar()
.then(result => {
.then((result) => {
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it('should confirm the price have been updated', done => {
it('should confirm the price have been updated', (done) => {
return nightmare
.getInnerText(selectors.ticketSales.firstSalePrice)
.then(result => {
.then((result) => {
expect(result).toContain('5.00');
done();
}).catch(done.fail);
});
it('should confirm the total price for that item have been updated', done => {
it('should confirm the total price for that item have been updated', (done) => {
return nightmare
.getInnerText(selectors.ticketSales.firstSaleImport)
.then(result => {
.then((result) => {
expect(result).toContain('20.00');
done();
}).catch(done.fail);
});
it('should update the discount', done => {
it('should update the discount', (done) => {
return nightmare
.waitToClick(selectors.ticketSales.firstSaleDiscount)
.wait('vn-textfield[label="Discount"] > div[class="container selected"]') // a function selects the text after it's loaded
.type(selectors.ticketSales.firstSaleDiscountInput, 50)
.type('body', '\u000d') // simulates enter
.waitForLastSnackbar()
.then(result => {
.then((result) => {
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it('should confirm the discount have been updated', done => {
it('should confirm the discount have been updated', (done) => {
return nightmare
.waitForTextInElement(selectors.ticketSales.firstSaleDiscount, '50 %')
.getInnerText(selectors.ticketSales.firstSaleDiscount)
.then(result => {
.then((result) => {
expect(result).toContain('50 %');
done();
}).catch(done.fail);
});
it('should confirm the total import for that item have been updated', done => {
it('should confirm the total import for that item have been updated', (done) => {
return nightmare
.waitForTextInElement(selectors.ticketSales.firstSaleImport, '10.00')
.getInnerText(selectors.ticketSales.firstSaleImport)
.then(result => {
.then((result) => {
expect(result).toContain('10.00');
done();
}).catch(done.fail);
});
it('should select the third sale and create a claim of it', done => {
it('should select the third sale and create a claim of it', (done) => {
return nightmare
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
.waitToClick(selectors.ticketSales.moreMenuButton)
@ -245,99 +245,99 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.globalItems.claimsButton)
.wait(selectors.claimsIndex.searchResult)
.parsedUrl()
.then(url => {
.then((url) => {
expect(url.hash).toEqual('#!/claim/index');
done();
}).catch(done.fail);
});
it('should click on the Claims button of the top bar menu', done => {
it('should click on the Claims button of the top bar menu', (done) => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.claimsButton)
.wait(selectors.claimsIndex.searchClaimInput)
.parsedUrl()
.then(url => {
.then((url) => {
expect(url.hash).toEqual('#!/claim/index');
done();
}).catch(done.fail);
});
it('should search for the claim with id 4', done => {
it('should search for the claim with id 4', (done) => {
return nightmare
.wait(selectors.claimsIndex.searchResult)
.type(selectors.claimsIndex.searchClaimInput, 4)
.click(selectors.claimsIndex.searchButton)
.waitForNumberOfElements(selectors.claimsIndex.searchResult, 1)
.countElement(selectors.claimsIndex.searchResult)
.then(result => {
.then((result) => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it('should click the Tickets button of the top bar menu', done => {
it('should click the Tickets button of the top bar menu', (done) => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult)
.parsedUrl()
.then(url => {
.then((url) => {
expect(url.hash).toEqual('#!/ticket/index');
done();
}).catch(done.fail);
});
it('should search the ticket', done => {
it('should search the ticket', (done) => {
return nightmare
.wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:16')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult)
.then(result => {
.then((result) => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it(`should click on the result to access to the ticket Sale`, done => {
it(`should click on the result to access to the ticket Sale`, (done) => {
return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('/sale');
done();
}).catch(done.fail);
});
it('should select the third sale and delete it', done => {
it('should select the third sale and delete it', (done) => {
return nightmare
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
.waitToClick(selectors.ticketSales.deleteSaleButton)
.waitToClick(selectors.ticketSales.acceptDeleteLineButton)
.waitForLastSnackbar()
.then(result => {
.then((result) => {
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it(`should confirm the third sale was deleted`, done => {
it(`should confirm the third sale was deleted`, (done) => {
return nightmare
.countElement(selectors.ticketSales.saleLine)
.then(result => {
.then((result) => {
expect(result).toEqual(3);
done();
}).catch(done.fail);
});
it('should select the third sale and attempt to send it to a frozen client ticket', done => {
it('should select the third sale and attempt to send it to a frozen client ticket', (done) => {
return nightmare
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
.waitToClick(selectors.ticketSales.transferSaleButton)
@ -345,36 +345,36 @@ describe('Ticket Edit sale path', () => {
.type(selectors.ticketSales.moveToTicketInput, 2)
.waitToClick(selectors.ticketSales.moveToTicketButton)
.waitForLastSnackbar()
.then(result => {
.then((result) => {
expect(result).toEqual(`The sales of this ticket can't be modified`);
done();
}).catch(done.fail);
});
it('should transfer the sale to a valid ticket', done => {
it('should transfer the sale to a valid ticket', (done) => {
return nightmare
.waitToClick(selectors.ticketSales.moveToTicketInputClearButton)
.type(selectors.ticketSales.moveToTicketInput, 12)
.waitToClick(selectors.ticketSales.moveToTicketButton)
.waitForURL('ticket/12/sale')
.url()
.then(result => {
.then((result) => {
expect(result).toContain(`ticket/12/sale`);
done();
}).catch(done.fail);
});
it('should confirm the transfered line is the correct one', done => {
it('should confirm the transfered line is the correct one', (done) => {
return nightmare
.wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSaleText)
.then(result => {
.then((result) => {
expect(result).toContain(`Mark I`);
done();
}).catch(done.fail);
});
it('should go back to the original ticket sales section', done => {
it('should go back to the original ticket sales section', (done) => {
return nightmare
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
.wait(selectors.ticketsIndex.searchResult)
@ -386,23 +386,23 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('/sale');
done();
}).catch(done.fail);
});
it(`should confirm the original ticket has only two lines now`, done => {
it(`should confirm the original ticket has only two lines now`, (done) => {
return nightmare
.wait(selectors.ticketSales.saleLine)
.countElement(selectors.ticketSales.saleLine)
.then(result => {
.then((result) => {
expect(result).toEqual(2);
done();
}).catch(done.fail);
});
it('should go back to the receiver ticket sales section', done => {
it('should go back to the receiver ticket sales section', (done) => {
return nightmare
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
.wait(selectors.ticketsIndex.searchResult)
@ -414,13 +414,13 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('/sale');
done();
}).catch(done.fail);
});
it('should transfer the sale back to the original ticket', done => {
it('should transfer the sale back to the original ticket', (done) => {
return nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.transferSaleButton)
@ -429,23 +429,23 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketSales.moveToTicketButton)
.waitForURL('ticket/16/sale')
.url()
.then(result => {
.then((result) => {
expect(result).toContain(`ticket/16/sale`);
done();
}).catch(done.fail);
});
it('should confirm the original ticket received the line', done => {
it('should confirm the original ticket received the line', (done) => {
return nightmare
.wait(selectors.ticketSales.saleLine)
.countElement(selectors.ticketSales.saleLine)
.then(result => {
.then((result) => {
expect(result).toEqual(3);
done();
}).catch(done.fail);
});
it('should select the second and third sale and tranfer them to a new ticket then get to the ticket index', done => {
it('should select the second and third sale and tranfer them to a new ticket then get to the ticket index', (done) => {
return nightmare
.waitToClick(selectors.ticketSales.secondSaleCheckbox)
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
@ -457,77 +457,77 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult)
.parsedUrl()
.then(url => {
.then((url) => {
expect(url.hash).toEqual('#!/ticket/index');
done();
}).catch(done.fail);
});
it('should search for a specific created ticket', done => {
it('should search for a specific created ticket', (done) => {
return nightmare
.wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:22')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult)
.then(result => {
.then((result) => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it(`should click on the search result to access to the ticket Sale`, done => {
it(`should click on the search result to access to the ticket Sale`, (done) => {
return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('/sale');
done();
}).catch(done.fail);
});
it('should confirm the new ticket received both lines', done => {
it('should confirm the new ticket received both lines', (done) => {
return nightmare
.countElement(selectors.ticketSales.saleLine)
.then(result => {
.then((result) => {
expect(result).toEqual(2);
done();
}).catch(done.fail);
});
it('should check the first sale reserved icon isnt visible', done => {
it('should check the first sale reserved icon isnt visible', (done) => {
return nightmare
.isVisible(selectors.ticketSales.firstSaleReservedIcon)
.then(result => {
.then((result) => {
expect(result).toBeFalsy();
done();
}).catch(done.fail);
});
it('should mark the first sale as reserved', done => {
it('should mark the first sale as reserved', (done) => {
return nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.moreMenuButton)
.waitToClick(selectors.ticketSales.moreMenuReseveOption)
.waitForClassNotPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide')
.isVisible(selectors.ticketSales.firstSaleReservedIcon)
.then(result => {
.then((result) => {
expect(result).toBeTruthy();
done();
}).catch(done.fail);
});
it('should unmark the first sale as reserved', done => {
it('should unmark the first sale as reserved', (done) => {
return nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.moreMenuButton)
.waitToClick(selectors.ticketSales.moreMenuUnmarkResevedOption)
.waitForClassPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide')
.isVisible(selectors.ticketSales.firstSaleReservedIcon)
.then(result => {
.then((result) => {
expect(result).toBeFalsy();
done();
}).catch(done.fail);
@ -550,7 +550,7 @@ describe('Ticket Edit sale path', () => {
// }).catch(done.fail);
// });
it('should log in as Production role and go to the ticket index', done => {
it('should log in as Production role and go to the ticket index', (done) => {
return nightmare
.waitToClick(selectors.globalItems.logOutButton)
.waitForLogin('production')
@ -559,50 +559,50 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult)
.parsedUrl()
.then(url => {
.then((url) => {
expect(url.hash).toEqual('#!/ticket/index');
done();
}).catch(done.fail);
});
it('should now search for a specific ticket', done => {
it('should now search for a specific ticket', (done) => {
return nightmare
.wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:16')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult)
.then(result => {
.then((result) => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it(`should now click on the search result to access to the ticket Tracking`, done => {
it(`should now click on the search result to access to the ticket Tracking`, (done) => {
return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketTracking.trackingButton)
.waitForURL('/tracking/index')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('/tracking/index');
done();
}).catch(done.fail);
});
it(`should click on the edit ticket tracking state button`, done => {
it(`should click on the edit ticket tracking state button`, (done) => {
return nightmare
.waitToClick(selectors.ticketTracking.createStateButton)
.waitForURL('/tracking/edit')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('/tracking/edit');
done();
}).catch(done.fail);
});
it(`should set the state of the ticket to preparation`, done => {
it(`should set the state of the ticket to preparation`, (done) => {
return nightmare
.waitToClick(selectors.ticketTracking.stateSelect)
.wait(selectors.ticketTracking.stateSelectInput)
@ -612,55 +612,55 @@ describe('Ticket Edit sale path', () => {
.click(selectors.ticketTracking.saveButton)
.waitForURL('/tracking/index')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('/tracking/index');
done();
}).catch(done.fail);
});
it(`should click on the ticket Sale menu button`, done => {
it(`should click on the ticket Sale menu button`, (done) => {
return nightmare
.waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('/sale');
done();
}).catch(done.fail);
});
describe('when state is preparation and loged as Production', () => {
it(`should not be able to edit the sale price`, done => {
it(`should not be able to edit the sale price`, (done) => {
return nightmare
.waitToClick(selectors.ticketSales.firstSalePrice)
.exists(selectors.ticketSales.firstSalePriceInput)
.then(result => {
.then((result) => {
expect(result).toBeFalsy();
done();
}).catch(done.fail);
});
it(`should not be able to edit the sale discount`, done => {
it(`should not be able to edit the sale discount`, (done) => {
return nightmare
.waitToClick(selectors.ticketSales.firstSaleDiscount)
.exists(selectors.ticketSales.firstSaleDiscountInput)
.then(result => {
.then((result) => {
expect(result).toBeFalsy();
done();
}).catch(done.fail);
});
it(`should not be able to edit the sale state`, done => {
it(`should not be able to edit the sale state`, (done) => {
return nightmare
.waitToClick(selectors.ticketSales.stateMenuButton)
.exists(selectors.ticketSales.stateMenuOptions)
.then(result => {
.then((result) => {
expect(result).toBeFalsy();
done();
}).catch(done.fail);
});
it('should log in as salesPerson role and go to the ticket index', done => {
it('should log in as salesPerson role and go to the ticket index', (done) => {
return nightmare
.waitToClick(selectors.globalItems.logOutButton)
.waitForLogin('salesPerson')
@ -669,33 +669,33 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult)
.parsedUrl()
.then(url => {
.then((url) => {
expect(url.hash).toEqual('#!/ticket/index');
done();
}).catch(done.fail);
});
it('should again search for a specific ticket', done => {
it('should again search for a specific ticket', (done) => {
return nightmare
.wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:16')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult)
.then(result => {
.then((result) => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it(`should again click on the search result to access to the ticket Sales`, done => {
it(`should again click on the search result to access to the ticket Sales`, (done) => {
return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('/sale');
done();
}).catch(done.fail);
@ -703,37 +703,37 @@ describe('Ticket Edit sale path', () => {
});
describe('when state is preparation and loged as salesPerson', () => {
it(`shouldnt be able to edit the sale price`, done => {
it(`shouldnt be able to edit the sale price`, (done) => {
return nightmare
.waitToClick(selectors.ticketSales.firstSalePrice)
.exists(selectors.ticketSales.firstSalePriceInput)
.then(result => {
.then((result) => {
expect(result).toBeFalsy();
done();
}).catch(done.fail);
});
it(`shouldnt be able to edit the sale discount`, done => {
it(`shouldnt be able to edit the sale discount`, (done) => {
return nightmare
.waitToClick(selectors.ticketSales.firstSaleDiscount)
.exists(selectors.ticketSales.firstSaleDiscountInput)
.then(result => {
.then((result) => {
expect(result).toBeFalsy();
done();
}).catch(done.fail);
});
it(`shouldnt be able to edit the sale state`, done => {
it(`shouldnt be able to edit the sale state`, (done) => {
return nightmare
.waitToClick(selectors.ticketSales.stateMenuButton)
.exists(selectors.ticketSales.stateMenuOptions)
.then(result => {
.then((result) => {
expect(result).toBeFalsy();
done();
}).catch(done.fail);
});
it('should go to another ticket sales section', done => {
it('should go to another ticket sales section', (done) => {
return nightmare
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
.wait(selectors.ticketsIndex.searchResult)
@ -745,43 +745,43 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('/sale');
done();
}).catch(done.fail);
});
it(`should be able to delete the ticket`, done => {
it(`should be able to delete the ticket`, (done) => {
return nightmare
.waitToClick(selectors.ticketSales.moreMenuButton)
.waitToClick(selectors.ticketSales.moreMenuDeleteOption)
.waitToClick(selectors.ticketSales.acceptDeleteTicketButton)
.waitForURL('/ticket/index')
.url()
.then(url => {
.then((url) => {
expect(url).toContain('/ticket/index');
done();
}).catch(done.fail);
});
it(`should search for the deleted ticket`, done => {
it(`should search for the deleted ticket`, (done) => {
return nightmare
.wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:17')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult)
.then(result => {
.then((result) => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it(`should search for the deleted ticket`, done => {
it(`should search for the deleted ticket`, (done) => {
return nightmare
.wait(selectors.ticketsIndex.searchResultDate)
.getInnerText(selectors.ticketsIndex.searchResultDate)
.then(result => {
.then((result) => {
expect(result).toContain(2000);
done();
}).catch(done.fail);

View File

@ -0,0 +1,83 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Ticket List components path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('employee');
});
it('should click on the Tickets button of the top bar menu', async () => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult)
.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
});
it('should search for the ticket 1', async () => {
const result = await nightmare
.wait(selectors.ticketsIndex.searchResult)
.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')
.url();
expect(url).toContain('components');
});
it('should confirm the total base is correct', async () => {
const name = 'Base €';
const minLength = name.length;
const base = await nightmare
.waitPropertyLength(selectors.ticketComponents.base, 'innerText', minLength)
.getProperty(selectors.ticketComponents.base, 'innerText');
expect(base).toContain('Base');
expect(base.length).toBeGreaterThan(minLength);
});
it('should confirm the total margin is correct', async () => {
const name = 'Margin €';
const minLength = name.length;
const margin = await nightmare
.waitPropertyLength(selectors.ticketComponents.margin, 'innerText', minLength)
.getProperty(selectors.ticketComponents.margin, 'innerText');
expect(margin).toContain('Margin');
expect(margin.length).toBeGreaterThan(minLength);
});
it('should confirm the total total is correct', async () => {
const name = 'Total €';
const minLength = name.length;
const total = await nightmare
.waitPropertyLength(selectors.ticketComponents.total, 'innerText', minLength)
.getProperty(selectors.ticketComponents.total, 'innerText');
expect(total).toContain('Total');
expect(total.length).toBeGreaterThan(minLength);
});
});