#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 config from './config.js';
import Nightmare from 'nightmare'; import Nightmare from 'nightmare';
import {URL} from 'url'; import {URL} from 'url';
@ -15,10 +17,10 @@ Nightmare.action('login', function(userName, done) {
Nightmare.action('changeLanguageToEnglish', function(done) { Nightmare.action('changeLanguageToEnglish', function(done) {
this.wait('#lang') this.wait('#lang')
.evaluate(selector => { .evaluate((selector) => {
return document.querySelector(selector).title; return document.querySelector(selector).title;
}, '#lang') }, '#lang')
.then(title => { .then((title) => {
if (title === 'Change language') { if (title === 'Change language') {
this.then(done); this.then(done);
} else { } else {
@ -39,7 +41,7 @@ Nightmare.action('waitForLogin', function(userName, done) {
Nightmare.action('parsedUrl', function(done) { Nightmare.action('parsedUrl', function(done) {
this.url() this.url()
.then(url => { .then((url) => {
done(null, new URL(url)); done(null, new URL(url));
}); });
}); });
@ -50,13 +52,22 @@ Nightmare.action('getProperty', function(selector, property, done) {
}, done, selector, property); }, 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) { Nightmare.action('waitProperty', function(selector, property, done) {
this.wait((selector, property) => { this.wait((selector, property) => {
let element = document.querySelector(selector); const element = document.querySelector(selector);
return element && element[property] != null && element[property] !== ''; return element && element[property] != null && element[property] !== '';
}, selector, property) }, selector, property)
.getProperty(selector, property) .getProperty(selector, property)
.then(result => done(null, result), done); .then((result) => done(null, result), done);
}); });
Nightmare.action('getInnerText', function(selector, done) { Nightmare.action('getInnerText', function(selector, done) {
@ -74,7 +85,7 @@ Nightmare.action('getInputValue', function(selector, done) {
}); });
Nightmare.action('clearInput', function(selector, done) { Nightmare.action('clearInput', function(selector, done) {
let backSpaces = []; const backSpaces = [];
for (let i = 0; i < 50; i += 1) { for (let i = 0; i < 50; i += 1) {
backSpaces.push('\u0008'); backSpaces.push('\u0008');
} }
@ -97,7 +108,7 @@ Nightmare.action('waitToClick', function(selector, done) {
Nightmare.action('isVisible', function(selector, done) { Nightmare.action('isVisible', function(selector, done) {
this.wait(selector) this.wait(selector)
.evaluate_now(elementSelector => { .evaluate_now((elementSelector) => {
const selectorMatches = document.querySelectorAll(elementSelector); const selectorMatches = document.querySelectorAll(elementSelector);
const element = selectorMatches[0]; const element = selectorMatches[0];
if (selectorMatches.length > 1) { if (selectorMatches.length > 1) {
@ -105,7 +116,7 @@ Nightmare.action('isVisible', function(selector, done) {
} }
let isVisible = false; let isVisible = false;
if (element) { if (element) {
const eventHandler = event => { const eventHandler = (event) => {
event.preventDefault(); event.preventDefault();
isVisible = true; isVisible = true;
}; };
@ -119,7 +130,7 @@ Nightmare.action('isVisible', function(selector, done) {
const e = new MouseEvent('mouseover', { const e = new MouseEvent('mouseover', {
view: window, view: window,
bubbles: true, bubbles: true,
cancelable: true cancelable: true,
}); });
if (elementInCenter) { if (elementInCenter) {
elementInCenter.dispatchEvent(e); elementInCenter.dispatchEvent(e);
@ -138,7 +149,7 @@ Nightmare.action('isVisible', function(selector, done) {
Nightmare.action('selectText', function(selector, done) { Nightmare.action('selectText', function(selector, done) {
this.wait(selector) this.wait(selector)
.evaluate(elementToSelect => { .evaluate((elementToSelect) => {
const range = document.createRange(); const range = document.createRange();
range.selectNodeContents(document.querySelector(elementToSelect)); range.selectNodeContents(document.querySelector(elementToSelect));
const sel = window.getSelection(); const sel = window.getSelection();
@ -150,7 +161,7 @@ Nightmare.action('selectText', function(selector, done) {
}); });
Nightmare.action('countElement', function(selector, done) { Nightmare.action('countElement', function(selector, done) {
this.evaluate_now(selector => { this.evaluate_now((selector) => {
return document.querySelectorAll(selector).length; return document.querySelectorAll(selector).length;
}, done, selector); }, done, selector);
}); });
@ -200,24 +211,24 @@ Nightmare.action('waitForTextInInput', function(selector, name, done) {
Nightmare.action('waitForInnerText', function(selector, done) { Nightmare.action('waitForInnerText', function(selector, done) {
this.wait(selector) this.wait(selector)
.wait(selector => { .wait((selector) => {
let innerText = document.querySelector(selector).innerText; const innerText = document.querySelector(selector).innerText;
return innerText != null && innerText != ''; return innerText != null && innerText != '';
}, selector) }, selector)
.evaluate_now(selector => { .evaluate_now((selector) => {
return document.querySelector(selector).innerText; return document.querySelector(selector).innerText;
}, done, selector); }, done, selector);
}); });
Nightmare.action('waitForEmptyInnerText', function(selector, done) { Nightmare.action('waitForEmptyInnerText', function(selector, done) {
this.wait(selector => { this.wait((selector) => {
return document.querySelector(selector).innerText == ''; return document.querySelector(selector).innerText == '';
}, selector) }, selector)
.then(done); .then(done);
}); });
Nightmare.action('waitForURL', function(hashURL, done) { Nightmare.action('waitForURL', function(hashURL, done) {
this.wait(hash => { this.wait((hash) => {
return document.location.hash.includes(hash); return document.location.hash.includes(hash);
}, hashURL) }, hashURL)
.then(done); .then(done);
@ -225,11 +236,11 @@ Nightmare.action('waitForURL', function(hashURL, done) {
Nightmare.action('waitForShapes', function(selector, done) { Nightmare.action('waitForShapes', function(selector, done) {
this.wait(selector) this.wait(selector)
.evaluate_now(selector => { .evaluate_now((selector) => {
let shapes = document.querySelectorAll(selector); const shapes = document.querySelectorAll(selector);
let shapesList = []; const shapesList = [];
for (let shape of shapes) { for (const shape of shapes) {
shapesList.push(shape.innerText); shapesList.push(shape.innerText);
} }
@ -239,15 +250,15 @@ Nightmare.action('waitForShapes', function(selector, done) {
Nightmare.action('waitForSnackbar', function(done) { Nightmare.action('waitForSnackbar', function(done) {
this.wait(500).waitForShapes('vn-snackbar .shape .text') this.wait(500).waitForShapes('vn-snackbar .shape .text')
.then(shapes => { .then((shapes) => {
done(null, shapes); done(null, shapes);
}); });
}); });
Nightmare.action('waitForLastShape', function(selector, done) { Nightmare.action('waitForLastShape', function(selector, done) {
this.wait(selector) this.wait(selector)
.evaluate_now(selector => { .evaluate_now((selector) => {
let shape = document.querySelector(selector); const shape = document.querySelector(selector);
return shape.innerText; return shape.innerText;
}, done, selector); }, done, selector);
@ -255,7 +266,7 @@ Nightmare.action('waitForLastShape', function(selector, done) {
Nightmare.action('waitForLastSnackbar', function(done) { Nightmare.action('waitForLastSnackbar', function(done) {
this.wait(500).waitForLastShape('vn-snackbar .shape .text') this.wait(500).waitForLastShape('vn-snackbar .shape .text')
.then(shapes => { .then((shapes) => {
done(null, 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'; import components from './components_selectors.js';
export default { export default {
@ -9,18 +7,18 @@ export default {
applicationsMenuVisible: `vn-main-menu [vn-id="apps-menu"] ul`, applicationsMenuVisible: `vn-main-menu [vn-id="apps-menu"] ul`,
clientsButton: `vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="client.index"]`, 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"]`, 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: { moduleAccessView: {
clientsSectionButton: `vn-home a[ui-sref="client.index"]`, clientsSectionButton: `vn-home a[ui-sref="client.index"]`,
itemsSectionButton: `vn-home a[ui-sref="item.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: { clientsIndex: {
searchClientInput: `${components.vnTextfield}`, searchClientInput: `${components.vnTextfield}`,
searchButton: `vn-searchbar vn-icon[icon="search"]`, searchButton: `vn-searchbar vn-icon[icon="search"]`,
searchResult: `vn-item-client a`, searchResult: `vn-item-client a`,
createClientButton: `${components.vnFloatButton}` createClientButton: `${components.vnFloatButton}`,
}, },
createClientView: { createClientView: {
name: `${components.vnTextfield}[name="name"]`, name: `${components.vnTextfield}[name="name"]`,
@ -31,7 +29,7 @@ export default {
salesPersonInput: `vn-autocomplete[field="$ctrl.client.salesPersonFk"] input`, salesPersonInput: `vn-autocomplete[field="$ctrl.client.salesPersonFk"] input`,
salesBruceBannerOption: `vn-autocomplete[field="$ctrl.client.salesPersonFk"] vn-drop-down ul > li:nth-child(1)`, salesBruceBannerOption: `vn-autocomplete[field="$ctrl.client.salesPersonFk"] vn-drop-down ul > li:nth-child(1)`,
createButton: `${components.vnSubmit}`, createButton: `${components.vnSubmit}`,
cancelButton: `vn-button[href="#!/client/index"]` cancelButton: `vn-button[href="#!/client/index"]`,
}, },
clientBasicData: { clientBasicData: {
basicDataButton: `vn-menu-item a[ui-sref="client.card.basicData"]`, basicDataButton: `vn-menu-item a[ui-sref="client.card.basicData"]`,
@ -46,7 +44,7 @@ export default {
channelInput: `vn-autocomplete[field="$ctrl.client.contactChannelFk"] input`, channelInput: `vn-autocomplete[field="$ctrl.client.contactChannelFk"] input`,
channelMetropolisOption: `vn-autocomplete[field="$ctrl.client.contactChannelFk"] vn-drop-down ul > li:nth-child(3)`, 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)`, channelRumorsOption: `vn-autocomplete[field="$ctrl.client.contactChannelFk"] vn-drop-down ul > li:nth-child(4)`,
saveButton: `${components.vnSubmit}` saveButton: `${components.vnSubmit}`,
}, },
clientFiscalData: { clientFiscalData: {
fiscalDataButton: `vn-menu-item a[ui-sref="client.card.fiscalData"]`, fiscalDataButton: `vn-menu-item a[ui-sref="client.card.fiscalData"]`,
@ -73,7 +71,7 @@ export default {
invoiceByMailCheckboxLabel: `vn-check[label='Invoice by mail'] > label`, invoiceByMailCheckboxLabel: `vn-check[label='Invoice by mail'] > label`,
invoiceByMailCheckboxInput: `vn-check[label='Invoice by mail'] input`, invoiceByMailCheckboxInput: `vn-check[label='Invoice by mail'] input`,
viesCheckboxInput: `vn-check[label='Vies'] > label > input`, viesCheckboxInput: `vn-check[label='Vies'] > label > input`,
saveButton: `${components.vnSubmit}` saveButton: `${components.vnSubmit}`,
}, },
clientPayMethod: { clientPayMethod: {
payMethodButton: `vn-menu-item a[ui-sref="client.card.billingData"]`, 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', 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', newBankEntityBIC: 'vn-client-billing-data > vn-dialog vn-textfield[label="Swift / BIC"] input',
acceptBankEntityButton: 'vn-client-billing-data > vn-dialog button[response="ACCEPT"]', acceptBankEntityButton: 'vn-client-billing-data > vn-dialog button[response="ACCEPT"]',
saveButton: `${components.vnSubmit}` saveButton: `${components.vnSubmit}`,
}, },
clientAddresses: { clientAddresses: {
addressesButton: `vn-menu-item a[ui-sref="client.card.address.index"]`, 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`, 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"]`, addObservationButton: `vn-client-address-edit vn-icon-button[icon="add_circle"]`,
saveButton: `${components.vnSubmit}`, saveButton: `${components.vnSubmit}`,
cancelButton: `button[ui-sref="client.card.address.index"]` cancelButton: `button[ui-sref="client.card.address.index"]`,
}, },
clientWebAccess: { clientWebAccess: {
webAccessButton: `vn-menu-item a[ui-sref="client.card.webAccess"]`, webAccessButton: `vn-menu-item a[ui-sref="client.card.webAccess"]`,
enableWebAccessCheckbox: `vn-check[label='Enable web access'] > label > input`, enableWebAccessCheckbox: `vn-check[label='Enable web access'] > label > input`,
userNameInput: `${components.vnTextfield}[name="name"]`, userNameInput: `${components.vnTextfield}[name="name"]`,
saveButton: `${components.vnSubmit}` saveButton: `${components.vnSubmit}`,
}, },
clientNotes: { clientNotes: {
notesButton: `vn-menu-item a[ui-sref="client.card.note.index"]`, notesButton: `vn-menu-item a[ui-sref="client.card.note.index"]`,
addNoteFloatButton: `${components.vnFloatButton}`, addNoteFloatButton: `${components.vnFloatButton}`,
noteInput: `vn-textarea[label="Note"]`, noteInput: `vn-textarea[label="Note"]`,
saveButton: `${components.vnSubmit}`, saveButton: `${components.vnSubmit}`,
firstNoteText: 'vn-client-note .text' firstNoteText: 'vn-client-note .text',
}, },
clientCredit: { clientCredit: {
creditButton: `vn-menu-item a[ui-sref="client.card.credit.index"]`, creditButton: `vn-menu-item a[ui-sref="client.card.credit.index"]`,
addCreditFloatButton: `${components.vnFloatButton}`, addCreditFloatButton: `${components.vnFloatButton}`,
creditInput: `${components.vnTextfield}[name="credit"]`, creditInput: `${components.vnTextfield}[name="credit"]`,
saveButton: `${components.vnSubmit}`, 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: { clientGreuge: {
greugeButton: `vn-menu-item a[ui-sref="client.card.greuge.index"]`, 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`, typeInput: `vn-autocomplete[field="$ctrl.greuge.greugeTypeFk"] input`,
typeSecondOption: `vn-autocomplete[field="$ctrl.greuge.greugeTypeFk"] vn-drop-down ul > li`, typeSecondOption: `vn-autocomplete[field="$ctrl.greuge.greugeTypeFk"] vn-drop-down ul > li`,
saveButton: `${components.vnSubmit}`, 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: { clientMandate: {
mandateButton: `vn-menu-item a[ui-sref="client.card.mandate"]`, 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: { clientInvoices: {
invoicesButton: `vn-menu-item a[ui-sref="client.card.invoice"]`, 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: { itemsIndex: {
goBackToModuleIndexButton: `vn-ticket-descriptor a[href="#!/ticket/index"]`, goBackToModuleIndexButton: `vn-ticket-descriptor a[href="#!/ticket/index"]`,
@ -172,7 +170,7 @@ export default {
acceptClonationAlertButton: `vn-item-index [vn-id="clone"] [response="ACCEPT"]`, acceptClonationAlertButton: `vn-item-index [vn-id="clone"] [response="ACCEPT"]`,
searchItemInput: `${components.vnTextfield}`, searchItemInput: `${components.vnTextfield}`,
searchButton: `vn-searchbar vn-icon[icon="search"]`, 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: { itemCreateView: {
name: `${components.vnTextfield}[name="name"]`, name: `${components.vnTextfield}[name="name"]`,
@ -183,7 +181,7 @@ export default {
originSelect: `vn-autocomplete[field="$ctrl.item.originFk"] input`, originSelect: `vn-autocomplete[field="$ctrl.item.originFk"] input`,
originSelectOptionOne: `vn-autocomplete[field="$ctrl.item.originFk"] vn-drop-down ul > li:nth-child(2)`, originSelectOptionOne: `vn-autocomplete[field="$ctrl.item.originFk"] vn-drop-down ul > li:nth-child(2)`,
createButton: `${components.vnSubmit}`, createButton: `${components.vnSubmit}`,
cancelButton: `button[ui-sref="item.index"]` cancelButton: `button[ui-sref="item.index"]`,
}, },
itemBasicData: { itemBasicData: {
@ -201,7 +199,7 @@ export default {
expenceSelectOptionThree: `vn-autocomplete[field="$ctrl.item.expenceFk"] vn-drop-down ul > li:nth-child(3)`, expenceSelectOptionThree: `vn-autocomplete[field="$ctrl.item.expenceFk"] vn-drop-down ul > li:nth-child(3)`,
longNameInput: `vn-textfield[label="Full name"] input`, longNameInput: `vn-textfield[label="Full name"] input`,
isActiveCheckbox: `vn-check[label='Active'] > label > input`, isActiveCheckbox: `vn-check[label='Active'] > label > input`,
submitBasicDataButton: `${components.vnSubmit}` submitBasicDataButton: `${components.vnSubmit}`,
}, },
itemTags: { itemTags: {
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]', 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`, 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`, seventhRelevancyInput: `vn-horizontal:nth-child(8) > vn-textfield[label="Relevancy"] input`,
addItemTagButton: `vn-icon-button[icon="add_circle"]`, addItemTagButton: `vn-icon-button[icon="add_circle"]`,
submitItemTagsButton: `${components.vnSubmit}` submitItemTagsButton: `${components.vnSubmit}`,
}, },
itemTax: { itemTax: {
taxButton: `vn-menu-item a[ui-sref="item.card.tax"]`, 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)`, 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`, 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)`, thirdClassSelectOptionTwo: `vn-horizontal:nth-child(4) > vn-autocomplete vn-drop-down ul > li:nth-child(2)`,
submitTaxButton: `${components.vnSubmit}` submitTaxButton: `${components.vnSubmit}`,
}, },
itemBarcodes: { itemBarcodes: {
barcodeButton: `vn-menu-item a[ui-sref="item.card.itemBarcode"]`, barcodeButton: `vn-menu-item a[ui-sref="item.card.itemBarcode"]`,
addBarcodeButton: `vn-icon[icon="add_circle"]`, addBarcodeButton: `vn-icon[icon="add_circle"]`,
thirdCodeInput: `vn-item-barcode vn-horizontal:nth-child(4) > ${components.vnTextfield}`, thirdCodeInput: `vn-item-barcode vn-horizontal:nth-child(4) > ${components.vnTextfield}`,
submitBarcodesButton: `${components.vnSubmit}`, 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: { itemNiches: {
nicheButton: `vn-menu-item a[ui-sref="item.card.niche"]`, 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`, 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)`, 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`, thirdCodeInput: `vn-horizontal:nth-child(4) > vn-textfield[label="Code"] input`,
submitNichesButton: `${components.vnSubmit}` submitNichesButton: `${components.vnSubmit}`,
}, },
itemBotanical: { itemBotanical: {
botanicalButton: `vn-menu-item a[ui-sref="item.card.botanical"]`, botanicalButton: `vn-menu-item a[ui-sref="item.card.botanical"]`,
@ -273,7 +271,7 @@ export default {
speciesSelect: `vn-autocomplete[field="$ctrl.botanical.specieFk"] input`, speciesSelect: `vn-autocomplete[field="$ctrl.botanical.specieFk"] input`,
speciesSelectOptionOne: `vn-autocomplete[field="$ctrl.botanical.specieFk"] vn-drop-down ul > li:nth-child(1)`, 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)`, speciesSelectOptionTwo: `vn-autocomplete[field="$ctrl.botanical.specieFk"] vn-drop-down ul > li:nth-child(2)`,
submitBotanicalButton: `${components.vnSubmit}` submitBotanicalButton: `${components.vnSubmit}`,
}, },
itemSummary: { itemSummary: {
basicData: `vn-item-summary vn-vertical[name="basicData"]`, basicData: `vn-item-summary vn-vertical[name="basicData"]`,
@ -281,14 +279,14 @@ export default {
tags: `vn-item-summary vn-vertical[name="tags"]`, tags: `vn-item-summary vn-vertical[name="tags"]`,
niche: `vn-item-summary vn-vertical[name="niche"]`, niche: `vn-item-summary vn-vertical[name="niche"]`,
botanical: `vn-item-summary vn-vertical[name="botanical"]`, 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: { ticketsIndex: {
searchResult: `vn-ticket-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr`, 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)`, 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)`, searchResultAddress: `vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(6)`,
searchTicketInput: `vn-ticket-index ${components.vnTextfield}`, 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: { ticketNotes: {
notesButton: `vn-menu-item a[ui-sref="ticket.card.observation"]`, notesButton: `vn-menu-item a[ui-sref="ticket.card.observation"]`,
@ -297,12 +295,12 @@ export default {
firstNoteSelect: `vn-autocomplete[field="observation.observationTypeFk"] input`, firstNoteSelect: `vn-autocomplete[field="observation.observationTypeFk"] input`,
firstNoteSelectSecondOption: `vn-autocomplete[field="observation.observationTypeFk"] vn-drop-down ul > li:nth-child(2)`, firstNoteSelectSecondOption: `vn-autocomplete[field="observation.observationTypeFk"] vn-drop-down ul > li:nth-child(2)`,
firstDescriptionInput: `vn-textfield[label="Description"] input`, firstDescriptionInput: `vn-textfield[label="Description"] input`,
submitNotesButton: `${components.vnSubmit}` submitNotesButton: `${components.vnSubmit}`,
}, },
ticketExpedition: { ticketExpedition: {
expeditionButton: `vn-menu-item a[ui-sref="ticket.card.expedition"]`, 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"]`, 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: { ticketPackages: {
packagesButton: `vn-menu-item a[ui-sref="ticket.card.package.index"]`, packagesButton: `vn-menu-item a[ui-sref="ticket.card.package.index"]`,
@ -312,7 +310,7 @@ export default {
firstRemovePackageButton: `vn-icon[vn-tooltip="Remove package"]`, firstRemovePackageButton: `vn-icon[vn-tooltip="Remove package"]`,
addPackageButton: `vn-icon-button[vn-tooltip="Add package"]`, addPackageButton: `vn-icon-button[vn-tooltip="Add package"]`,
clearPackageSelectButton: `vn-autocomplete[label="Package"] > div > div > div > vn-icon > i`, clearPackageSelectButton: `vn-autocomplete[label="Package"] > div > div > div > vn-icon > i`,
savePackagesButton: `${components.vnSubmit}` savePackagesButton: `${components.vnSubmit}`,
}, },
ticketSales: { ticketSales: {
saleLine: `vn-table div > vn-tbody > vn-tr`, 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)', 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)', 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', 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: { ticketTracking: {
trackingButton: `vn-left-menu a[ui-sref="ticket.card.tracking.index"]`, 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', 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', 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)', stateSelectFirstResult: 'vn-ticket-tracking-edit vn-autocomplete > vn-drop-down > vn-popover ul > li:nth-child(1)',
saveButton: `${components.vnSubmit}` saveButton: `${components.vnSubmit}`,
}, },
ticketBasicData: { ticketBasicData: {
basicDataButton: `vn-menu-item a[ui-sref="ticket.card.data.stepOne"]`, 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)`, 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`, chargesReason: `vn-autocomplete[field="$ctrl.ticket.option"] input`,
chargesReasonFourthOption: `vn-autocomplete[field="$ctrl.ticket.option"] vn-drop-down ul > li:nth-child(4)`, 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: { createStateView: {
stateInput: `vn-autocomplete[field="$ctrl.ticket.stateFk"] > div > div > input`, 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)`, 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`, clearStateInputButton: `vn-autocomplete[field="$ctrl.ticket.stateFk"] > div > div > div > vn-icon > i`,
saveStateButton: `${components.vnSubmit}` saveStateButton: `${components.vnSubmit}`,
}, },
claimsIndex: { claimsIndex: {
searchClaimInput: `vn-claim-index ${components.vnTextfield}`, searchClaimInput: `vn-claim-index ${components.vnTextfield}`,
searchResult: `vn-claim-index vn-card > div > vn-table > div > vn-tbody > vn-tr`, 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: { claimBasicData: {
basicDataButton: `vn-menu-item a[ui-sref="claim.card.basicData"]`, 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`, isPaidWithManaCheckbox: `vn-check[field="$ctrl.claim.isChargedToMana"] > label > input`,
responsabilityInputRange: `vn-input-range`, responsabilityInputRange: `vn-input-range`,
observationInput: `vn-textarea[label="Observation"] textarea`, observationInput: `vn-textarea[label="Observation"] textarea`,
saveButton: `${components.vnSubmit}` saveButton: `${components.vnSubmit}`,
}, },
claimDetails: { claimDetails: {
detailsButton: `vn-menu-item a[ui-sref="claim.card.detail"]`, 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,7 +3,7 @@ import createNightmare from '../../helpers/nightmare';
describe('Client', () => { describe('Client', () => {
describe('create path', () => { describe('create path', () => {
let nightmare = createNightmare(); const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
@ -11,7 +11,7 @@ describe('Client', () => {
}); });
it('should access to the clients index by clicking the clients button', async () => { it('should access to the clients index by clicking the clients button', async () => {
let url = await nightmare const url = await nightmare
.click(selectors.moduleAccessView.clientsSectionButton) .click(selectors.moduleAccessView.clientsSectionButton)
.wait(selectors.clientsIndex.createClientButton) .wait(selectors.clientsIndex.createClientButton)
.parsedUrl(); .parsedUrl();
@ -20,7 +20,7 @@ describe('Client', () => {
}); });
it(`should search for the user Carol Danvers to confirm it isn't created yet`, async () => { it(`should search for the user Carol Danvers to confirm it isn't created yet`, async () => {
let result = await nightmare const result = await nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Carol Danvers') .type(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
.click(selectors.clientsIndex.searchButton) .click(selectors.clientsIndex.searchButton)
@ -31,7 +31,7 @@ describe('Client', () => {
}); });
it('should access to the create client view by clicking the create-client floating button', async () => { it('should access to the create client view by clicking the create-client floating button', async () => {
let url = await nightmare const url = await nightmare
.click(selectors.clientsIndex.createClientButton) .click(selectors.clientsIndex.createClientButton)
.wait(selectors.createClientView.createButton) .wait(selectors.createClientView.createButton)
.parsedUrl(); .parsedUrl();
@ -40,7 +40,7 @@ describe('Client', () => {
}); });
it('should return to the client index by clicking the cancel button', async () => { it('should return to the client index by clicking the cancel button', async () => {
let url = await nightmare const url = await nightmare
.click(selectors.createClientView.cancelButton) .click(selectors.createClientView.cancelButton)
.wait(selectors.clientsIndex.createClientButton) .wait(selectors.clientsIndex.createClientButton)
.parsedUrl(); .parsedUrl();
@ -49,7 +49,7 @@ describe('Client', () => {
}); });
it('should now access to the create client view by clicking the create-client floating button', async () => { it('should now access to the create client view by clicking the create-client floating button', async () => {
let url = await nightmare const url = await nightmare
.click(selectors.clientsIndex.createClientButton) .click(selectors.clientsIndex.createClientButton)
.wait(selectors.createClientView.createButton) .wait(selectors.createClientView.createButton)
.parsedUrl(); .parsedUrl();
@ -58,7 +58,7 @@ describe('Client', () => {
}); });
it('should receive an error when clicking the create button having all the form fields empty', async () => { it('should receive an error when clicking the create button having all the form fields empty', async () => {
let result = await nightmare const result = await nightmare
.click(selectors.createClientView.createButton) .click(selectors.createClientView.createButton)
.waitForLastSnackbar(); .waitForLastSnackbar();
@ -66,7 +66,7 @@ describe('Client', () => {
}); });
it('should receive an error when clicking the create button having name and Business name fields empty', async () => { it('should receive an error when clicking the create button having name and Business name fields empty', async () => {
let result = await nightmare const result = await nightmare
.type(selectors.createClientView.taxNumber, '74451390E') .type(selectors.createClientView.taxNumber, '74451390E')
.type(selectors.createClientView.userName, 'CaptainMarvel') .type(selectors.createClientView.userName, 'CaptainMarvel')
.type(selectors.createClientView.email, 'CarolDanvers@verdnatura.es') .type(selectors.createClientView.email, 'CarolDanvers@verdnatura.es')
@ -79,7 +79,7 @@ describe('Client', () => {
}); });
it(`should attempt to create a new user with all it's data but wrong email`, async () => { it(`should attempt to create a new user with all it's data but wrong email`, async () => {
let result = await nightmare const result = await nightmare
.type(selectors.createClientView.name, 'Carol Danvers') .type(selectors.createClientView.name, 'Carol Danvers')
.type(selectors.createClientView.socialName, 'AVG tax') .type(selectors.createClientView.socialName, 'AVG tax')
.clearInput(selectors.createClientView.email) .clearInput(selectors.createClientView.email)
@ -91,7 +91,7 @@ describe('Client', () => {
}); });
it(`should create a new user with all correct data`, async () => { it(`should create a new user with all correct data`, async () => {
let result = await nightmare const result = await nightmare
.clearInput(selectors.createClientView.email) .clearInput(selectors.createClientView.email)
.type(selectors.createClientView.email, 'caroldanvers@verdnatura.es') .type(selectors.createClientView.email, 'caroldanvers@verdnatura.es')
.click(selectors.createClientView.createButton) .click(selectors.createClientView.createButton)
@ -101,7 +101,7 @@ describe('Client', () => {
}); });
it('should click on the Clients button of the top bar menu', async () => { it('should click on the Clients button of the top bar menu', async () => {
let url = await nightmare const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton) .waitToClick(selectors.globalItems.clientsButton)
@ -112,7 +112,7 @@ describe('Client', () => {
}); });
it(`should search for the user Carol Danvers to confirm it exists`, async () => { it(`should search for the user Carol Danvers to confirm it exists`, async () => {
let result = await nightmare const result = await nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Carol Danvers') .type(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
.click(selectors.clientsIndex.searchButton) .click(selectors.clientsIndex.searchButton)

View File

@ -10,44 +10,44 @@ describe('Ticket', () => {
.waitForLogin('employee'); .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 return nightmare
.click(selectors.moduleAccessView.ticketsSectionButton) .click(selectors.moduleAccessView.ticketsSectionButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.parsedUrl() .parsedUrl()
.then(url => { .then((url) => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
done(); done();
}).catch(done.fail); }).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 return nightmare
.wait(selectors.ticketsIndex.searchTicketInput) .wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1') .type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton) .click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then((result) => {
expect(result).toEqual(1); expect(result).toEqual(1);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1') .waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketNotes.notesButton) .waitToClick(selectors.ticketNotes.notesButton)
.waitForURL('observation') .waitForURL('observation')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('observation'); expect(url).toContain('observation');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketNotes.firstNoteRemoveButton) .waitToClick(selectors.ticketNotes.firstNoteRemoveButton)
.waitToClick(selectors.ticketNotes.addNoteButton) .waitToClick(selectors.ticketNotes.addNoteButton)
@ -56,24 +56,24 @@ describe('Ticket', () => {
.type(selectors.ticketNotes.firstDescriptionInput, 'description') .type(selectors.ticketNotes.firstDescriptionInput, 'description')
.click(selectors.ticketNotes.submitNotesButton) .click(selectors.ticketNotes.submitNotesButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then((result) => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
done(); done();
}).catch(done.fail); }).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 return nightmare
.click(selectors.ticketPackages.packagesButton) .click(selectors.ticketPackages.packagesButton)
.wait(selectors.ticketPackages.firstPackageSelect) .wait(selectors.ticketPackages.firstPackageSelect)
.click(selectors.ticketNotes.notesButton) .click(selectors.ticketNotes.notesButton)
.waitProperty(selectors.ticketNotes.firstNoteSelect, 'value') .waitProperty(selectors.ticketNotes.firstNoteSelect, 'value')
.then(result => { .then((result) => {
expect(result).toEqual('observation one'); expect(result).toEqual('observation one');
return nightmare return nightmare
.getProperty(selectors.ticketNotes.firstDescriptionInput, 'value'); .getProperty(selectors.ticketNotes.firstDescriptionInput, 'value');
}) })
.then(result => { .then((result) => {
expect(result).toEqual('description'); expect(result).toEqual('description');
done(); done();
}).catch(done.fail); }).catch(done.fail);

View File

@ -10,44 +10,44 @@ describe('Ticket', () => {
.waitForLogin('production'); .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 return nightmare
.click(selectors.moduleAccessView.ticketsSectionButton) .click(selectors.moduleAccessView.ticketsSectionButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.parsedUrl() .parsedUrl()
.then(url => { .then((url) => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
done(); done();
}).catch(done.fail); }).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 return nightmare
.wait(selectors.ticketsIndex.searchTicketInput) .wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1') .type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton) .click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then((result) => {
expect(result).toEqual(1); expect(result).toEqual(1);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1') .waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketExpedition.expeditionButton) .waitToClick(selectors.ticketExpedition.expeditionButton)
.waitForURL('expedition') .waitForURL('expedition')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('expedition'); expect(url).toContain('expedition');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton) .waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton)
.click(selectors.ticketPackages.packagesButton) .click(selectors.ticketPackages.packagesButton)
@ -55,7 +55,7 @@ describe('Ticket', () => {
.click(selectors.ticketExpedition.expeditionButton) .click(selectors.ticketExpedition.expeditionButton)
.wait(selectors.ticketExpedition.secondExpeditionText) .wait(selectors.ticketExpedition.secondExpeditionText)
.getInnerText(selectors.ticketExpedition.secondExpeditionText) .getInnerText(selectors.ticketExpedition.secondExpeditionText)
.then(value => { .then((value) => {
expect(value).toContain('Iron Patriot'); expect(value).toContain('Iron Patriot');
expect(value).toContain('root'); expect(value).toContain('root');
done(); done();

View File

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

View File

@ -9,46 +9,46 @@ describe('Ticket Create packages path', () => {
.waitForLogin('employee'); .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 return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton) .waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.parsedUrl() .parsedUrl()
.then(url => { .then((url) => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should search for the ticket 1', done => { it('should search for the ticket 1', (done) => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1') .type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton) .click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then((result) => {
expect(result).toEqual(1); expect(result).toEqual(1);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResultAddress, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResultAddress, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketPackages.packagesButton) .waitToClick(selectors.ticketPackages.packagesButton)
.waitForURL('package/index') .waitForURL('package/index')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('package/index'); expect(url).toContain('package/index');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketPackages.firstRemovePackageButton) .waitToClick(selectors.ticketPackages.firstRemovePackageButton)
.waitToClick(selectors.ticketPackages.addPackageButton) .waitToClick(selectors.ticketPackages.addPackageButton)
@ -56,79 +56,79 @@ describe('Ticket Create packages path', () => {
.waitToClick(selectors.ticketPackages.firstPackageSelectOptionTwo) .waitToClick(selectors.ticketPackages.firstPackageSelectOptionTwo)
.click(selectors.ticketPackages.savePackagesButton) .click(selectors.ticketPackages.savePackagesButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then((result) => {
expect(result).toEqual('Some fields are invalid'); expect(result).toEqual('Some fields are invalid');
done(); done();
}).catch(done.fail); }).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 return nightmare
.type(selectors.ticketPackages.firstQuantityInput, 'ninety 9') .type(selectors.ticketPackages.firstQuantityInput, 'ninety 9')
.click(selectors.ticketPackages.savePackagesButton) .click(selectors.ticketPackages.savePackagesButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then((result) => {
expect(result).toEqual('Some fields are invalid'); expect(result).toEqual('Some fields are invalid');
done(); done();
}).catch(done.fail); }).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 return nightmare
.clearInput(selectors.ticketPackages.firstQuantityInput) .clearInput(selectors.ticketPackages.firstQuantityInput)
.type(selectors.ticketPackages.firstQuantityInput, 0) .type(selectors.ticketPackages.firstQuantityInput, 0)
.click(selectors.ticketPackages.savePackagesButton) .click(selectors.ticketPackages.savePackagesButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then((result) => {
expect(result).toEqual('Some fields are invalid'); expect(result).toEqual('Some fields are invalid');
done(); done();
}).catch(done.fail); }).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 return nightmare
.clearInput(selectors.ticketPackages.firstQuantityInput) .clearInput(selectors.ticketPackages.firstQuantityInput)
.type(selectors.ticketPackages.firstQuantityInput, 99) .type(selectors.ticketPackages.firstQuantityInput, 99)
.click(selectors.ticketPackages.clearPackageSelectButton) .click(selectors.ticketPackages.clearPackageSelectButton)
.click(selectors.ticketPackages.savePackagesButton) .click(selectors.ticketPackages.savePackagesButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then((result) => {
expect(result).toEqual('Package cannot be blank'); expect(result).toEqual('Package cannot be blank');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketPackages.firstPackageSelect) .waitToClick(selectors.ticketPackages.firstPackageSelect)
.waitToClick(selectors.ticketPackages.firstPackageSelectOptionTwo) .waitToClick(selectors.ticketPackages.firstPackageSelectOptionTwo)
.waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Legendary Box') .waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Legendary Box')
.click(selectors.ticketPackages.savePackagesButton) .click(selectors.ticketPackages.savePackagesButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then((result) => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
done(); done();
}).catch(done.fail); }).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 return nightmare
.click(selectors.ticketSales.saleButton) .click(selectors.ticketSales.saleButton)
.wait(selectors.ticketSales.firstPackageSelect) .wait(selectors.ticketSales.firstPackageSelect)
.click(selectors.ticketPackages.packagesButton) .click(selectors.ticketPackages.packagesButton)
.waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Legendary Box') .waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Legendary Box')
.getInputValue(selectors.ticketPackages.firstPackageSelect) .getInputValue(selectors.ticketPackages.firstPackageSelect)
.then(result => { .then((result) => {
expect(result).toEqual('Legendary Box'); expect(result).toEqual('Legendary Box');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99') .waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99')
.getInputValue(selectors.ticketPackages.firstQuantityInput) .getInputValue(selectors.ticketPackages.firstQuantityInput)
.then(result => { .then((result) => {
expect(result).toEqual('99'); expect(result).toEqual('99');
done(); done();
}).catch(done.fail); }).catch(done.fail);

View File

@ -10,97 +10,97 @@ describe('Ticket', () => {
.waitForLogin('production'); .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 return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton) .waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.parsedUrl() .parsedUrl()
.then(url => { .then((url) => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should search for the ticket 1', done => { it('should search for the ticket 1', (done) => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1') .type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton) .click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then((result) => {
expect(result).toEqual(1); expect(result).toEqual(1);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketTracking.trackingButton) .waitToClick(selectors.ticketTracking.trackingButton)
.waitForURL('tracking/index') .waitForURL('tracking/index')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('tracking/index'); expect(url).toContain('tracking/index');
done(); done();
}).catch(done.fail); }).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 return nightmare
.click(selectors.ticketTracking.createStateButton) .click(selectors.ticketTracking.createStateButton)
.wait(selectors.createStateView.stateInput) .wait(selectors.createStateView.stateInput)
.parsedUrl() .parsedUrl()
.then(url => { .then((url) => {
expect(url.hash).toContain('tracking/edit'); expect(url.hash).toContain('tracking/edit');
done(); done();
}).catch(done.fail); }).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 return nightmare
.click(selectors.createStateView.saveStateButton) .click(selectors.createStateView.saveStateButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then((result) => {
expect(result).toEqual('No changes to save'); expect(result).toEqual('No changes to save');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.createStateView.stateInput) .waitToClick(selectors.createStateView.stateInput)
.waitToClick(selectors.createStateView.stateInputOptionOne) .waitToClick(selectors.createStateView.stateInputOptionOne)
.waitToClick(selectors.createStateView.clearStateInputButton) .waitToClick(selectors.createStateView.clearStateInputButton)
.click(selectors.createStateView.saveStateButton) .click(selectors.createStateView.saveStateButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then((result) => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
done(); done();
}).catch(done.fail); }).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 return nightmare
.click(selectors.ticketTracking.createStateButton) .click(selectors.ticketTracking.createStateButton)
.wait(selectors.createStateView.stateInput) .wait(selectors.createStateView.stateInput)
.parsedUrl() .parsedUrl()
.then(url => { .then((url) => {
expect(url.hash).toContain('tracking/edit'); expect(url.hash).toContain('tracking/edit');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it(`should create a new state`, done => { it(`should create a new state`, (done) => {
return nightmare return nightmare
.waitToClick(selectors.createStateView.stateInput) .waitToClick(selectors.createStateView.stateInput)
.waitToClick(selectors.createStateView.stateInputOptionOne) .waitToClick(selectors.createStateView.stateInputOptionOne)
.click(selectors.createStateView.saveStateButton) .click(selectors.createStateView.saveStateButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then((result) => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
done(); done();
}).catch(done.fail); }).catch(done.fail);

View File

@ -10,46 +10,46 @@ describe('Ticket', () => {
.waitForLogin('employee'); .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 return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton) .waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.parsedUrl() .parsedUrl()
.then(url => { .then((url) => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should search for the ticket 11', done => { it('should search for the ticket 11', (done) => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:11') .type(selectors.ticketsIndex.searchTicketInput, 'id:11')
.click(selectors.ticketsIndex.searchButton) .click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then((result) => {
expect(result).toEqual(1); expect(result).toEqual(1);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') // should be Bruce Wayne .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') // should be Bruce Wayne
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketBasicData.basicDataButton) .waitToClick(selectors.ticketBasicData.basicDataButton)
.waitForURL('data/step-one') .waitForURL('data/step-one')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('data/step-one'); expect(url).toContain('data/step-one');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketBasicData.clientSelect) .waitToClick(selectors.ticketBasicData.clientSelect)
.waitToClick(selectors.ticketBasicData.clientSelectThirdOption) .waitToClick(selectors.ticketBasicData.clientSelectThirdOption)
@ -60,33 +60,33 @@ describe('Ticket', () => {
.click(selectors.ticketBasicData.nextStepButton) .click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-two') .waitForURL('data/step-two')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('data/step-two'); expect(url).toContain('data/step-two');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it(`should have no price diference`, done => { it(`should have no price diference`, (done) => {
return nightmare return nightmare
.getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif) .getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif)
.then(result => { .then((result) => {
expect(result).toContain('0'); expect(result).toContain('0');
done(); done();
}).catch(done.fail); }).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 return nightmare
.click(selectors.ticketBasicData.nextStepButton) .click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-three') .waitForURL('data/step-three')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('data/step-three'); expect(url).toContain('data/step-three');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketBasicData.chargesReason) .waitToClick(selectors.ticketBasicData.chargesReason)
.waitToClick(selectors.ticketBasicData.chargesReasonFourthOption) .waitToClick(selectors.ticketBasicData.chargesReasonFourthOption)
@ -94,24 +94,24 @@ describe('Ticket', () => {
.click(selectors.ticketBasicData.finalizeButton) .click(selectors.ticketBasicData.finalizeButton)
.waitForURL('summary') .waitForURL('summary')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('summary'); expect(url).toContain('summary');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it(`should go back to ticket.basicData section`, done => { it(`should go back to ticket.basicData section`, (done) => {
return nightmare return nightmare
.waitToClick(selectors.ticketBasicData.basicDataButton) .waitToClick(selectors.ticketBasicData.basicDataButton)
.waitForURL('data/step-one') .waitForURL('data/step-one')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('data/step-one'); expect(url).toContain('data/step-one');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketBasicData.agencySelect) .waitToClick(selectors.ticketBasicData.agencySelect)
.waitToClick(selectors.ticketBasicData.agencySelectOptionSix) .waitToClick(selectors.ticketBasicData.agencySelectOptionSix)
@ -119,33 +119,33 @@ describe('Ticket', () => {
.click(selectors.ticketBasicData.nextStepButton) .click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-two') .waitForURL('data/step-two')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('data/step-two'); expect(url).toContain('data/step-two');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it(`should have a price diference`, done => { it(`should have a price diference`, (done) => {
return nightmare return nightmare
.getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif) .getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif)
.then(result => { .then((result) => {
expect(result).toContain('-20.65'); expect(result).toContain('-20.65');
done(); done();
}).catch(done.fail); }).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 return nightmare
.click(selectors.ticketBasicData.nextStepButton) .click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-three') .waitForURL('data/step-three')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('data/step-three'); expect(url).toContain('data/step-three');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketBasicData.chargesReason) .waitToClick(selectors.ticketBasicData.chargesReason)
.waitToClick(selectors.ticketBasicData.chargesReasonFirstOption) .waitToClick(selectors.ticketBasicData.chargesReasonFirstOption)
@ -153,7 +153,7 @@ describe('Ticket', () => {
.click(selectors.ticketBasicData.finalizeButton) .click(selectors.ticketBasicData.finalizeButton)
.waitForURL('summary') .waitForURL('summary')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('summary'); expect(url).toContain('summary');
done(); done();
}).catch(done.fail); }).catch(done.fail);

View File

@ -9,126 +9,126 @@ describe('Ticket Edit sale path', () => {
.waitForLogin('salesPerson'); .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 return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton) .waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.parsedUrl() .parsedUrl()
.then(url => { .then((url) => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should search for a specific ticket', done => { it('should search for a specific ticket', (done) => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:16') .type(selectors.ticketsIndex.searchTicketInput, 'id:16')
.click(selectors.ticketsIndex.searchButton) .click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then((result) => {
expect(result).toEqual(1); expect(result).toEqual(1);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it(`should check the zoomed image isnt present`, done => { it(`should check the zoomed image isnt present`, (done) => {
return nightmare return nightmare
.countElement(selectors.ticketSales.firstSaleZoomedImage) .countElement(selectors.ticketSales.firstSaleZoomedImage)
.then(result => { .then((result) => {
expect(result).toEqual(0); expect(result).toEqual(0);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.firstSaleThumbnailImage) .waitToClick(selectors.ticketSales.firstSaleThumbnailImage)
.countElement(selectors.ticketSales.firstSaleZoomedImage) .countElement(selectors.ticketSales.firstSaleZoomedImage)
.then(result => { .then((result) => {
expect(result).toEqual(1); expect(result).toEqual(1);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.firstSaleZoomedImage) .waitToClick(selectors.ticketSales.firstSaleZoomedImage)
.countElement(selectors.ticketSales.firstSaleZoomedImage) .countElement(selectors.ticketSales.firstSaleZoomedImage)
.then(result => { .then((result) => {
expect(result).toEqual(0); expect(result).toEqual(0);
done(); done();
}).catch(done.fail); }).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 return nightmare
.isVisible(selectors.ticketSales.saleDescriptorPopover) .isVisible(selectors.ticketSales.saleDescriptorPopover)
.then(visible => { .then((visible) => {
expect(visible).toBeFalsy(); expect(visible).toBeFalsy();
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.firstSaleID) .waitToClick(selectors.ticketSales.firstSaleID)
.wait(1000) .wait(1000)
.isVisible(selectors.ticketSales.saleDescriptorPopover) .isVisible(selectors.ticketSales.saleDescriptorPopover)
.then(visible => { .then((visible) => {
expect(visible).toBeTruthy(); expect(visible).toBeTruthy();
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick('vn-item-descriptor img') .waitToClick('vn-item-descriptor img')
.countElement(selectors.ticketSales.firstSaleZoomedImage) .countElement(selectors.ticketSales.firstSaleZoomedImage)
.then(result => { .then((result) => {
expect(result).toEqual(1); expect(result).toEqual(1);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.firstSaleZoomedImage) .waitToClick(selectors.ticketSales.firstSaleZoomedImage)
.countElement(selectors.ticketSales.firstSaleZoomedImage) .countElement(selectors.ticketSales.firstSaleZoomedImage)
.then(result => { .then((result) => {
expect(result).toEqual(0); expect(result).toEqual(0);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.saleDescriptorPopoverSummaryButton) .waitToClick(selectors.ticketSales.saleDescriptorPopoverSummaryButton)
.waitForURL('/summary') .waitForURL('/summary')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('/summary'); expect(url).toContain('/summary');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should return to ticket sales section', done => { it('should return to ticket sales section', (done) => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
@ -142,99 +142,99 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.firstSaleQuantityClearInput) .waitToClick(selectors.ticketSales.firstSaleQuantityClearInput)
.type(selectors.ticketSales.firstSaleQuantity, '9\u000d') .type(selectors.ticketSales.firstSaleQuantity, '9\u000d')
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then((result) => {
expect(result).toEqual('The new quantity should be smaller than the old one'); expect(result).toEqual('The new quantity should be smaller than the old one');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should remove 1 from quantity', done => { it('should remove 1 from quantity', (done) => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleQuantityClearInput) .waitToClick(selectors.ticketSales.firstSaleQuantityClearInput)
.type(selectors.ticketSales.firstSaleQuantity, '4\u000d') .type(selectors.ticketSales.firstSaleQuantity, '4\u000d')
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then((result) => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should update the price', done => { it('should update the price', (done) => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSalePrice) .waitToClick(selectors.ticketSales.firstSalePrice)
.wait(selectors.ticketSales.firstSalePriceInput) .wait(selectors.ticketSales.firstSalePriceInput)
.type(selectors.ticketSales.firstSalePriceInput, 5) .type(selectors.ticketSales.firstSalePriceInput, 5)
.type('body', '\u000d') // simulates enter .type('body', '\u000d') // simulates enter
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then((result) => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should confirm the price have been updated', done => { it('should confirm the price have been updated', (done) => {
return nightmare return nightmare
.getInnerText(selectors.ticketSales.firstSalePrice) .getInnerText(selectors.ticketSales.firstSalePrice)
.then(result => { .then((result) => {
expect(result).toContain('5.00'); expect(result).toContain('5.00');
done(); done();
}).catch(done.fail); }).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 return nightmare
.getInnerText(selectors.ticketSales.firstSaleImport) .getInnerText(selectors.ticketSales.firstSaleImport)
.then(result => { .then((result) => {
expect(result).toContain('20.00'); expect(result).toContain('20.00');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should update the discount', done => { it('should update the discount', (done) => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleDiscount) .waitToClick(selectors.ticketSales.firstSaleDiscount)
.wait('vn-textfield[label="Discount"] > div[class="container selected"]') // a function selects the text after it's loaded .wait('vn-textfield[label="Discount"] > div[class="container selected"]') // a function selects the text after it's loaded
.type(selectors.ticketSales.firstSaleDiscountInput, 50) .type(selectors.ticketSales.firstSaleDiscountInput, 50)
.type('body', '\u000d') // simulates enter .type('body', '\u000d') // simulates enter
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then((result) => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should confirm the discount have been updated', done => { it('should confirm the discount have been updated', (done) => {
return nightmare return nightmare
.waitForTextInElement(selectors.ticketSales.firstSaleDiscount, '50 %') .waitForTextInElement(selectors.ticketSales.firstSaleDiscount, '50 %')
.getInnerText(selectors.ticketSales.firstSaleDiscount) .getInnerText(selectors.ticketSales.firstSaleDiscount)
.then(result => { .then((result) => {
expect(result).toContain('50 %'); expect(result).toContain('50 %');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitForTextInElement(selectors.ticketSales.firstSaleImport, '10.00') .waitForTextInElement(selectors.ticketSales.firstSaleImport, '10.00')
.getInnerText(selectors.ticketSales.firstSaleImport) .getInnerText(selectors.ticketSales.firstSaleImport)
.then(result => { .then((result) => {
expect(result).toContain('10.00'); expect(result).toContain('10.00');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.thirdSaleCheckbox) .waitToClick(selectors.ticketSales.thirdSaleCheckbox)
.waitToClick(selectors.ticketSales.moreMenuButton) .waitToClick(selectors.ticketSales.moreMenuButton)
@ -245,99 +245,99 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.globalItems.claimsButton) .waitToClick(selectors.globalItems.claimsButton)
.wait(selectors.claimsIndex.searchResult) .wait(selectors.claimsIndex.searchResult)
.parsedUrl() .parsedUrl()
.then(url => { .then((url) => {
expect(url.hash).toEqual('#!/claim/index'); expect(url.hash).toEqual('#!/claim/index');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.claimsButton) .waitToClick(selectors.globalItems.claimsButton)
.wait(selectors.claimsIndex.searchClaimInput) .wait(selectors.claimsIndex.searchClaimInput)
.parsedUrl() .parsedUrl()
.then(url => { .then((url) => {
expect(url.hash).toEqual('#!/claim/index'); expect(url.hash).toEqual('#!/claim/index');
done(); done();
}).catch(done.fail); }).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 return nightmare
.wait(selectors.claimsIndex.searchResult) .wait(selectors.claimsIndex.searchResult)
.type(selectors.claimsIndex.searchClaimInput, 4) .type(selectors.claimsIndex.searchClaimInput, 4)
.click(selectors.claimsIndex.searchButton) .click(selectors.claimsIndex.searchButton)
.waitForNumberOfElements(selectors.claimsIndex.searchResult, 1) .waitForNumberOfElements(selectors.claimsIndex.searchResult, 1)
.countElement(selectors.claimsIndex.searchResult) .countElement(selectors.claimsIndex.searchResult)
.then(result => { .then((result) => {
expect(result).toEqual(1); expect(result).toEqual(1);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton) .waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.parsedUrl() .parsedUrl()
.then(url => { .then((url) => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should search the ticket', done => { it('should search the ticket', (done) => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:16') .type(selectors.ticketsIndex.searchTicketInput, 'id:16')
.click(selectors.ticketsIndex.searchButton) .click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then((result) => {
expect(result).toEqual(1); expect(result).toEqual(1);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.thirdSaleCheckbox) .waitToClick(selectors.ticketSales.thirdSaleCheckbox)
.waitToClick(selectors.ticketSales.deleteSaleButton) .waitToClick(selectors.ticketSales.deleteSaleButton)
.waitToClick(selectors.ticketSales.acceptDeleteLineButton) .waitToClick(selectors.ticketSales.acceptDeleteLineButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then((result) => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it(`should confirm the third sale was deleted`, done => { it(`should confirm the third sale was deleted`, (done) => {
return nightmare return nightmare
.countElement(selectors.ticketSales.saleLine) .countElement(selectors.ticketSales.saleLine)
.then(result => { .then((result) => {
expect(result).toEqual(3); expect(result).toEqual(3);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.thirdSaleCheckbox) .waitToClick(selectors.ticketSales.thirdSaleCheckbox)
.waitToClick(selectors.ticketSales.transferSaleButton) .waitToClick(selectors.ticketSales.transferSaleButton)
@ -345,36 +345,36 @@ describe('Ticket Edit sale path', () => {
.type(selectors.ticketSales.moveToTicketInput, 2) .type(selectors.ticketSales.moveToTicketInput, 2)
.waitToClick(selectors.ticketSales.moveToTicketButton) .waitToClick(selectors.ticketSales.moveToTicketButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then((result) => {
expect(result).toEqual(`The sales of this ticket can't be modified`); expect(result).toEqual(`The sales of this ticket can't be modified`);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.moveToTicketInputClearButton) .waitToClick(selectors.ticketSales.moveToTicketInputClearButton)
.type(selectors.ticketSales.moveToTicketInput, 12) .type(selectors.ticketSales.moveToTicketInput, 12)
.waitToClick(selectors.ticketSales.moveToTicketButton) .waitToClick(selectors.ticketSales.moveToTicketButton)
.waitForURL('ticket/12/sale') .waitForURL('ticket/12/sale')
.url() .url()
.then(result => { .then((result) => {
expect(result).toContain(`ticket/12/sale`); expect(result).toContain(`ticket/12/sale`);
done(); done();
}).catch(done.fail); }).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 return nightmare
.wait(selectors.ticketSales.firstSaleText) .wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSaleText) .getInnerText(selectors.ticketSales.firstSaleText)
.then(result => { .then((result) => {
expect(result).toContain(`Mark I`); expect(result).toContain(`Mark I`);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton) .waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
@ -386,23 +386,23 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
done(); done();
}).catch(done.fail); }).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 return nightmare
.wait(selectors.ticketSales.saleLine) .wait(selectors.ticketSales.saleLine)
.countElement(selectors.ticketSales.saleLine) .countElement(selectors.ticketSales.saleLine)
.then(result => { .then((result) => {
expect(result).toEqual(2); expect(result).toEqual(2);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton) .waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
@ -414,13 +414,13 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox) .waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.transferSaleButton) .waitToClick(selectors.ticketSales.transferSaleButton)
@ -429,23 +429,23 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketSales.moveToTicketButton) .waitToClick(selectors.ticketSales.moveToTicketButton)
.waitForURL('ticket/16/sale') .waitForURL('ticket/16/sale')
.url() .url()
.then(result => { .then((result) => {
expect(result).toContain(`ticket/16/sale`); expect(result).toContain(`ticket/16/sale`);
done(); done();
}).catch(done.fail); }).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 return nightmare
.wait(selectors.ticketSales.saleLine) .wait(selectors.ticketSales.saleLine)
.countElement(selectors.ticketSales.saleLine) .countElement(selectors.ticketSales.saleLine)
.then(result => { .then((result) => {
expect(result).toEqual(3); expect(result).toEqual(3);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.secondSaleCheckbox) .waitToClick(selectors.ticketSales.secondSaleCheckbox)
.waitToClick(selectors.ticketSales.thirdSaleCheckbox) .waitToClick(selectors.ticketSales.thirdSaleCheckbox)
@ -457,77 +457,77 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.globalItems.ticketsButton) .waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.parsedUrl() .parsedUrl()
.then(url => { .then((url) => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should search for a specific created ticket', done => { it('should search for a specific created ticket', (done) => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:22') .type(selectors.ticketsIndex.searchTicketInput, 'id:22')
.click(selectors.ticketsIndex.searchButton) .click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then((result) => {
expect(result).toEqual(1); expect(result).toEqual(1);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
done(); done();
}).catch(done.fail); }).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 return nightmare
.countElement(selectors.ticketSales.saleLine) .countElement(selectors.ticketSales.saleLine)
.then(result => { .then((result) => {
expect(result).toEqual(2); expect(result).toEqual(2);
done(); done();
}).catch(done.fail); }).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 return nightmare
.isVisible(selectors.ticketSales.firstSaleReservedIcon) .isVisible(selectors.ticketSales.firstSaleReservedIcon)
.then(result => { .then((result) => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should mark the first sale as reserved', done => { it('should mark the first sale as reserved', (done) => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox) .waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.moreMenuButton) .waitToClick(selectors.ticketSales.moreMenuButton)
.waitToClick(selectors.ticketSales.moreMenuReseveOption) .waitToClick(selectors.ticketSales.moreMenuReseveOption)
.waitForClassNotPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide') .waitForClassNotPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide')
.isVisible(selectors.ticketSales.firstSaleReservedIcon) .isVisible(selectors.ticketSales.firstSaleReservedIcon)
.then(result => { .then((result) => {
expect(result).toBeTruthy(); expect(result).toBeTruthy();
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should unmark the first sale as reserved', done => { it('should unmark the first sale as reserved', (done) => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox) .waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.moreMenuButton) .waitToClick(selectors.ticketSales.moreMenuButton)
.waitToClick(selectors.ticketSales.moreMenuUnmarkResevedOption) .waitToClick(selectors.ticketSales.moreMenuUnmarkResevedOption)
.waitForClassPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide') .waitForClassPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide')
.isVisible(selectors.ticketSales.firstSaleReservedIcon) .isVisible(selectors.ticketSales.firstSaleReservedIcon)
.then(result => { .then((result) => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
done(); done();
}).catch(done.fail); }).catch(done.fail);
@ -550,7 +550,7 @@ describe('Ticket Edit sale path', () => {
// }).catch(done.fail); // }).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 return nightmare
.waitToClick(selectors.globalItems.logOutButton) .waitToClick(selectors.globalItems.logOutButton)
.waitForLogin('production') .waitForLogin('production')
@ -559,50 +559,50 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.globalItems.ticketsButton) .waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.parsedUrl() .parsedUrl()
.then(url => { .then((url) => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should now search for a specific ticket', done => { it('should now search for a specific ticket', (done) => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:16') .type(selectors.ticketsIndex.searchTicketInput, 'id:16')
.click(selectors.ticketsIndex.searchButton) .click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then((result) => {
expect(result).toEqual(1); expect(result).toEqual(1);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketTracking.trackingButton) .waitToClick(selectors.ticketTracking.trackingButton)
.waitForURL('/tracking/index') .waitForURL('/tracking/index')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('/tracking/index'); expect(url).toContain('/tracking/index');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketTracking.createStateButton) .waitToClick(selectors.ticketTracking.createStateButton)
.waitForURL('/tracking/edit') .waitForURL('/tracking/edit')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('/tracking/edit'); expect(url).toContain('/tracking/edit');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketTracking.stateSelect) .waitToClick(selectors.ticketTracking.stateSelect)
.wait(selectors.ticketTracking.stateSelectInput) .wait(selectors.ticketTracking.stateSelectInput)
@ -612,55 +612,55 @@ describe('Ticket Edit sale path', () => {
.click(selectors.ticketTracking.saveButton) .click(selectors.ticketTracking.saveButton)
.waitForURL('/tracking/index') .waitForURL('/tracking/index')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('/tracking/index'); expect(url).toContain('/tracking/index');
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
describe('when state is preparation and loged as Production', () => { 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 return nightmare
.waitToClick(selectors.ticketSales.firstSalePrice) .waitToClick(selectors.ticketSales.firstSalePrice)
.exists(selectors.ticketSales.firstSalePriceInput) .exists(selectors.ticketSales.firstSalePriceInput)
.then(result => { .then((result) => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.firstSaleDiscount) .waitToClick(selectors.ticketSales.firstSaleDiscount)
.exists(selectors.ticketSales.firstSaleDiscountInput) .exists(selectors.ticketSales.firstSaleDiscountInput)
.then(result => { .then((result) => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.stateMenuButton) .waitToClick(selectors.ticketSales.stateMenuButton)
.exists(selectors.ticketSales.stateMenuOptions) .exists(selectors.ticketSales.stateMenuOptions)
.then(result => { .then((result) => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.globalItems.logOutButton) .waitToClick(selectors.globalItems.logOutButton)
.waitForLogin('salesPerson') .waitForLogin('salesPerson')
@ -669,33 +669,33 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.globalItems.ticketsButton) .waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.parsedUrl() .parsedUrl()
.then(url => { .then((url) => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should again search for a specific ticket', done => { it('should again search for a specific ticket', (done) => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:16') .type(selectors.ticketsIndex.searchTicketInput, 'id:16')
.click(selectors.ticketsIndex.searchButton) .click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then((result) => {
expect(result).toEqual(1); expect(result).toEqual(1);
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
done(); done();
}).catch(done.fail); }).catch(done.fail);
@ -703,37 +703,37 @@ describe('Ticket Edit sale path', () => {
}); });
describe('when state is preparation and loged as salesPerson', () => { 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 return nightmare
.waitToClick(selectors.ticketSales.firstSalePrice) .waitToClick(selectors.ticketSales.firstSalePrice)
.exists(selectors.ticketSales.firstSalePriceInput) .exists(selectors.ticketSales.firstSalePriceInput)
.then(result => { .then((result) => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.firstSaleDiscount) .waitToClick(selectors.ticketSales.firstSaleDiscount)
.exists(selectors.ticketSales.firstSaleDiscountInput) .exists(selectors.ticketSales.firstSaleDiscountInput)
.then(result => { .then((result) => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
done(); done();
}).catch(done.fail); }).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 return nightmare
.waitToClick(selectors.ticketSales.stateMenuButton) .waitToClick(selectors.ticketSales.stateMenuButton)
.exists(selectors.ticketSales.stateMenuOptions) .exists(selectors.ticketSales.stateMenuOptions)
.then(result => { .then((result) => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it('should go to another ticket sales section', done => { it('should go to another ticket sales section', (done) => {
return nightmare return nightmare
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton) .waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
@ -745,43 +745,43 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('/sale'); expect(url).toContain('/sale');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it(`should be able to delete the ticket`, done => { it(`should be able to delete the ticket`, (done) => {
return nightmare return nightmare
.waitToClick(selectors.ticketSales.moreMenuButton) .waitToClick(selectors.ticketSales.moreMenuButton)
.waitToClick(selectors.ticketSales.moreMenuDeleteOption) .waitToClick(selectors.ticketSales.moreMenuDeleteOption)
.waitToClick(selectors.ticketSales.acceptDeleteTicketButton) .waitToClick(selectors.ticketSales.acceptDeleteTicketButton)
.waitForURL('/ticket/index') .waitForURL('/ticket/index')
.url() .url()
.then(url => { .then((url) => {
expect(url).toContain('/ticket/index'); expect(url).toContain('/ticket/index');
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it(`should search for the deleted ticket`, done => { it(`should search for the deleted ticket`, (done) => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResult) .wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:17') .type(selectors.ticketsIndex.searchTicketInput, 'id:17')
.click(selectors.ticketsIndex.searchButton) .click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult)
.then(result => { .then((result) => {
expect(result).toEqual(1); expect(result).toEqual(1);
done(); done();
}).catch(done.fail); }).catch(done.fail);
}); });
it(`should search for the deleted ticket`, done => { it(`should search for the deleted ticket`, (done) => {
return nightmare return nightmare
.wait(selectors.ticketsIndex.searchResultDate) .wait(selectors.ticketsIndex.searchResultDate)
.getInnerText(selectors.ticketsIndex.searchResultDate) .getInnerText(selectors.ticketsIndex.searchResultDate)
.then(result => { .then((result) => {
expect(result).toContain(2000); expect(result).toContain(2000);
done(); done();
}).catch(done.fail); }).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);
});
});