#759 e2e ticket component
This commit is contained in:
parent
cacfa3988e
commit
11787ec2e1
|
@ -1,47 +1,49 @@
|
|||
/* eslint no-invalid-this: "off" */
|
||||
|
||||
import config from './config.js';
|
||||
import Nightmare from 'nightmare';
|
||||
import {URL} from 'url';
|
||||
|
||||
Nightmare.action('login', function(userName, done) {
|
||||
this.goto(`${config.url}auth/?apiKey=salix`)
|
||||
.wait(`vn-login input[name=user]`)
|
||||
.write(`vn-login input[name=user]`, userName)
|
||||
.write(`vn-login input[name=password]`, 'nightmare')
|
||||
.click(`vn-login input[type=submit]`)
|
||||
.wait(`vn-login input[name=user]`)
|
||||
.write(`vn-login input[name=user]`, userName)
|
||||
.write(`vn-login input[name=password]`, 'nightmare')
|
||||
.click(`vn-login input[type=submit]`)
|
||||
// FIXME: Wait for dom to be ready: https://github.com/segmentio/nightmare/issues/481
|
||||
.wait(1000)
|
||||
.then(done);
|
||||
.wait(1000)
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('changeLanguageToEnglish', function(done) {
|
||||
this.wait('#lang')
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).title;
|
||||
}, '#lang')
|
||||
.then(title => {
|
||||
if (title === 'Change language') {
|
||||
this.then(done);
|
||||
} else {
|
||||
this.click('#lang')
|
||||
.click('vn-main-menu [vn-id="langs-menu"] ul > li[name="en"]')
|
||||
.then(done);
|
||||
}
|
||||
});
|
||||
.evaluate((selector) => {
|
||||
return document.querySelector(selector).title;
|
||||
}, '#lang')
|
||||
.then((title) => {
|
||||
if (title === 'Change language') {
|
||||
this.then(done);
|
||||
} else {
|
||||
this.click('#lang')
|
||||
.click('vn-main-menu [vn-id="langs-menu"] ul > li[name="en"]')
|
||||
.then(done);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Nightmare.action('waitForLogin', function(userName, done) {
|
||||
this.login(userName)
|
||||
.waitForURL('#!/')
|
||||
.url()
|
||||
.changeLanguageToEnglish()
|
||||
.then(done);
|
||||
.waitForURL('#!/')
|
||||
.url()
|
||||
.changeLanguageToEnglish()
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('parsedUrl', function(done) {
|
||||
this.url()
|
||||
.then(url => {
|
||||
done(null, new URL(url));
|
||||
});
|
||||
.then((url) => {
|
||||
done(null, new URL(url));
|
||||
});
|
||||
});
|
||||
|
||||
Nightmare.action('getProperty', function(selector, property, done) {
|
||||
|
@ -50,107 +52,116 @@ Nightmare.action('getProperty', function(selector, property, done) {
|
|||
}, done, selector, property);
|
||||
});
|
||||
|
||||
Nightmare.action('waitPropertyLength', function(selector, property, minLength, done) {
|
||||
this.wait((selector, property, minLength) => {
|
||||
const element = document.querySelector(selector);
|
||||
return element && element[property] != null && element[property] !== '' && element[property].length >= minLength;
|
||||
}, selector, property, minLength)
|
||||
.getProperty(selector, property)
|
||||
.then((result) => done(null, result), done);
|
||||
});
|
||||
|
||||
Nightmare.action('waitProperty', function(selector, property, done) {
|
||||
this.wait((selector, property) => {
|
||||
let element = document.querySelector(selector);
|
||||
const element = document.querySelector(selector);
|
||||
return element && element[property] != null && element[property] !== '';
|
||||
}, selector, property)
|
||||
.getProperty(selector, property)
|
||||
.then(result => done(null, result), done);
|
||||
.getProperty(selector, property)
|
||||
.then((result) => done(null, result), done);
|
||||
});
|
||||
|
||||
Nightmare.action('getInnerText', function(selector, done) {
|
||||
this.wait(selector)
|
||||
.evaluate_now(function(elementToSelect) {
|
||||
return document.querySelector(elementToSelect).innerText;
|
||||
}, done, selector);
|
||||
.evaluate_now(function(elementToSelect) {
|
||||
return document.querySelector(elementToSelect).innerText;
|
||||
}, done, selector);
|
||||
});
|
||||
|
||||
Nightmare.action('getInputValue', function(selector, done) {
|
||||
this.wait(selector)
|
||||
.evaluate_now(function(elementToSelect) {
|
||||
return document.querySelector(elementToSelect).value;
|
||||
}, done, selector);
|
||||
.evaluate_now(function(elementToSelect) {
|
||||
return document.querySelector(elementToSelect).value;
|
||||
}, done, selector);
|
||||
});
|
||||
|
||||
Nightmare.action('clearInput', function(selector, done) {
|
||||
let backSpaces = [];
|
||||
const backSpaces = [];
|
||||
for (let i = 0; i < 50; i += 1) {
|
||||
backSpaces.push('\u0008');
|
||||
}
|
||||
this.wait(selector)
|
||||
.type(selector, backSpaces.join(''))
|
||||
.then(done);
|
||||
.type(selector, backSpaces.join(''))
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('write', function(selector, text, done) {
|
||||
this.wait(selector)
|
||||
.type(selector, text)
|
||||
.then(done);
|
||||
.type(selector, text)
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('waitToClick', function(selector, done) {
|
||||
this.wait(selector)
|
||||
.click(selector)
|
||||
.then(done);
|
||||
.click(selector)
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('isVisible', function(selector, done) {
|
||||
this.wait(selector)
|
||||
.evaluate_now(elementSelector => {
|
||||
const selectorMatches = document.querySelectorAll(elementSelector);
|
||||
const element = selectorMatches[0];
|
||||
if (selectorMatches.length > 1) {
|
||||
throw new Error(`multiple matches of ${elementSelector} found`);
|
||||
}
|
||||
let isVisible = false;
|
||||
if (element) {
|
||||
const eventHandler = event => {
|
||||
event.preventDefault();
|
||||
isVisible = true;
|
||||
};
|
||||
element.addEventListener('mouseover', eventHandler);
|
||||
const elementBoundaries = element.getBoundingClientRect();
|
||||
const x = elementBoundaries.left + element.offsetWidth / 2;
|
||||
const y = elementBoundaries.top + element.offsetHeight / 2;
|
||||
const elementInCenter = document.elementFromPoint(x, y);
|
||||
const elementInTopLeft = document.elementFromPoint(elementBoundaries.left, elementBoundaries.top);
|
||||
const elementInBottomRight = document.elementFromPoint(elementBoundaries.right, elementBoundaries.bottom);
|
||||
const e = new MouseEvent('mouseover', {
|
||||
view: window,
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
});
|
||||
if (elementInCenter) {
|
||||
elementInCenter.dispatchEvent(e);
|
||||
.evaluate_now((elementSelector) => {
|
||||
const selectorMatches = document.querySelectorAll(elementSelector);
|
||||
const element = selectorMatches[0];
|
||||
if (selectorMatches.length > 1) {
|
||||
throw new Error(`multiple matches of ${elementSelector} found`);
|
||||
}
|
||||
if (elementInTopLeft) {
|
||||
elementInTopLeft.dispatchEvent(e);
|
||||
let isVisible = false;
|
||||
if (element) {
|
||||
const eventHandler = (event) => {
|
||||
event.preventDefault();
|
||||
isVisible = true;
|
||||
};
|
||||
element.addEventListener('mouseover', eventHandler);
|
||||
const elementBoundaries = element.getBoundingClientRect();
|
||||
const x = elementBoundaries.left + element.offsetWidth / 2;
|
||||
const y = elementBoundaries.top + element.offsetHeight / 2;
|
||||
const elementInCenter = document.elementFromPoint(x, y);
|
||||
const elementInTopLeft = document.elementFromPoint(elementBoundaries.left, elementBoundaries.top);
|
||||
const elementInBottomRight = document.elementFromPoint(elementBoundaries.right, elementBoundaries.bottom);
|
||||
const e = new MouseEvent('mouseover', {
|
||||
view: window,
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
});
|
||||
if (elementInCenter) {
|
||||
elementInCenter.dispatchEvent(e);
|
||||
}
|
||||
if (elementInTopLeft) {
|
||||
elementInTopLeft.dispatchEvent(e);
|
||||
}
|
||||
if (elementInBottomRight) {
|
||||
elementInBottomRight.dispatchEvent(e);
|
||||
}
|
||||
element.removeEventListener('mouseover', eventHandler);
|
||||
}
|
||||
if (elementInBottomRight) {
|
||||
elementInBottomRight.dispatchEvent(e);
|
||||
}
|
||||
element.removeEventListener('mouseover', eventHandler);
|
||||
}
|
||||
return isVisible;
|
||||
}, done, selector);
|
||||
return isVisible;
|
||||
}, done, selector);
|
||||
});
|
||||
|
||||
Nightmare.action('selectText', function(selector, done) {
|
||||
this.wait(selector)
|
||||
.evaluate(elementToSelect => {
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(document.querySelector(elementToSelect));
|
||||
const sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
sel.addRange(range);
|
||||
}, selector)
|
||||
.mouseup(selector)
|
||||
.then(done);
|
||||
.evaluate((elementToSelect) => {
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(document.querySelector(elementToSelect));
|
||||
const sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
sel.addRange(range);
|
||||
}, selector)
|
||||
.mouseup(selector)
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('countElement', function(selector, done) {
|
||||
this.evaluate_now(selector => {
|
||||
this.evaluate_now((selector) => {
|
||||
return document.querySelectorAll(selector).length;
|
||||
}, done, selector);
|
||||
});
|
||||
|
@ -159,103 +170,103 @@ Nightmare.action('waitForNumberOfElements', function(selector, count, done) {
|
|||
this.wait((resultSelector, expectedCount) => {
|
||||
return document.querySelectorAll(resultSelector).length === expectedCount;
|
||||
}, selector, count)
|
||||
.then(done);
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForClassNotPresent', function(selector, className, done) {
|
||||
this.wait(selector)
|
||||
.wait((resultSelector, targetClass) => {
|
||||
if (!document.querySelector(resultSelector).classList.contains(targetClass)) {
|
||||
return true;
|
||||
}
|
||||
}, selector, className)
|
||||
.then(done);
|
||||
.wait((resultSelector, targetClass) => {
|
||||
if (!document.querySelector(resultSelector).classList.contains(targetClass)) {
|
||||
return true;
|
||||
}
|
||||
}, selector, className)
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForClassPresent', function(selector, className, done) {
|
||||
this.wait(selector)
|
||||
.wait((resultSelector, targetClass) => {
|
||||
if (document.querySelector(resultSelector).classList.contains(targetClass)) {
|
||||
return true;
|
||||
}
|
||||
}, selector, className)
|
||||
.then(done);
|
||||
.wait((resultSelector, targetClass) => {
|
||||
if (document.querySelector(resultSelector).classList.contains(targetClass)) {
|
||||
return true;
|
||||
}
|
||||
}, selector, className)
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForTextInElement', function(selector, name, done) {
|
||||
this.wait(selector)
|
||||
.wait((resultSelector, expectedText) => {
|
||||
return document.querySelector(resultSelector).innerText.toLowerCase().includes(expectedText.toLowerCase());
|
||||
}, selector, name)
|
||||
.then(done);
|
||||
.wait((resultSelector, expectedText) => {
|
||||
return document.querySelector(resultSelector).innerText.toLowerCase().includes(expectedText.toLowerCase());
|
||||
}, selector, name)
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForTextInInput', function(selector, name, done) {
|
||||
this.wait(selector)
|
||||
.wait((resultSelector, expectedText) => {
|
||||
return document.querySelector(resultSelector).value.toLowerCase().includes(expectedText.toLowerCase());
|
||||
}, selector, name)
|
||||
.then(done);
|
||||
.wait((resultSelector, expectedText) => {
|
||||
return document.querySelector(resultSelector).value.toLowerCase().includes(expectedText.toLowerCase());
|
||||
}, selector, name)
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForInnerText', function(selector, done) {
|
||||
this.wait(selector)
|
||||
.wait(selector => {
|
||||
let innerText = document.querySelector(selector).innerText;
|
||||
return innerText != null && innerText != '';
|
||||
}, selector)
|
||||
.evaluate_now(selector => {
|
||||
return document.querySelector(selector).innerText;
|
||||
}, done, selector);
|
||||
.wait((selector) => {
|
||||
const innerText = document.querySelector(selector).innerText;
|
||||
return innerText != null && innerText != '';
|
||||
}, selector)
|
||||
.evaluate_now((selector) => {
|
||||
return document.querySelector(selector).innerText;
|
||||
}, done, selector);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForEmptyInnerText', function(selector, done) {
|
||||
this.wait(selector => {
|
||||
this.wait((selector) => {
|
||||
return document.querySelector(selector).innerText == '';
|
||||
}, selector)
|
||||
.then(done);
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForURL', function(hashURL, done) {
|
||||
this.wait(hash => {
|
||||
this.wait((hash) => {
|
||||
return document.location.hash.includes(hash);
|
||||
}, hashURL)
|
||||
.then(done);
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForShapes', function(selector, done) {
|
||||
this.wait(selector)
|
||||
.evaluate_now(selector => {
|
||||
let shapes = document.querySelectorAll(selector);
|
||||
let shapesList = [];
|
||||
.evaluate_now((selector) => {
|
||||
const shapes = document.querySelectorAll(selector);
|
||||
const shapesList = [];
|
||||
|
||||
for (let shape of shapes) {
|
||||
shapesList.push(shape.innerText);
|
||||
}
|
||||
for (const shape of shapes) {
|
||||
shapesList.push(shape.innerText);
|
||||
}
|
||||
|
||||
return shapesList;
|
||||
}, done, selector);
|
||||
return shapesList;
|
||||
}, done, selector);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForSnackbar', function(done) {
|
||||
this.wait(500).waitForShapes('vn-snackbar .shape .text')
|
||||
.then(shapes => {
|
||||
done(null, shapes);
|
||||
});
|
||||
.then((shapes) => {
|
||||
done(null, shapes);
|
||||
});
|
||||
});
|
||||
|
||||
Nightmare.action('waitForLastShape', function(selector, done) {
|
||||
this.wait(selector)
|
||||
.evaluate_now(selector => {
|
||||
let shape = document.querySelector(selector);
|
||||
.evaluate_now((selector) => {
|
||||
const shape = document.querySelector(selector);
|
||||
|
||||
return shape.innerText;
|
||||
}, done, selector);
|
||||
return shape.innerText;
|
||||
}, done, selector);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForLastSnackbar', function(done) {
|
||||
this.wait(500).waitForLastShape('vn-snackbar .shape .text')
|
||||
.then(shapes => {
|
||||
done(null, shapes);
|
||||
});
|
||||
.then((shapes) => {
|
||||
done(null, shapes);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// eslint max-len: ["error", 500]
|
||||
// eslint key-spacing: ["error", 500]
|
||||
import components from './components_selectors.js';
|
||||
|
||||
export default {
|
||||
|
@ -9,18 +7,18 @@ export default {
|
|||
applicationsMenuVisible: `vn-main-menu [vn-id="apps-menu"] ul`,
|
||||
clientsButton: `vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="client.index"]`,
|
||||
ticketsButton: `vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="ticket.index"]`,
|
||||
claimsButton: `vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="claim.index"]`
|
||||
claimsButton: `vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="claim.index"]`,
|
||||
},
|
||||
moduleAccessView: {
|
||||
clientsSectionButton: `vn-home a[ui-sref="client.index"]`,
|
||||
itemsSectionButton: `vn-home a[ui-sref="item.index"]`,
|
||||
ticketsSectionButton: `vn-home a[ui-sref="ticket.index"]`
|
||||
ticketsSectionButton: `vn-home a[ui-sref="ticket.index"]`,
|
||||
},
|
||||
clientsIndex: {
|
||||
searchClientInput: `${components.vnTextfield}`,
|
||||
searchButton: `vn-searchbar vn-icon[icon="search"]`,
|
||||
searchResult: `vn-item-client a`,
|
||||
createClientButton: `${components.vnFloatButton}`
|
||||
createClientButton: `${components.vnFloatButton}`,
|
||||
},
|
||||
createClientView: {
|
||||
name: `${components.vnTextfield}[name="name"]`,
|
||||
|
@ -31,7 +29,7 @@ export default {
|
|||
salesPersonInput: `vn-autocomplete[field="$ctrl.client.salesPersonFk"] input`,
|
||||
salesBruceBannerOption: `vn-autocomplete[field="$ctrl.client.salesPersonFk"] vn-drop-down ul > li:nth-child(1)`,
|
||||
createButton: `${components.vnSubmit}`,
|
||||
cancelButton: `vn-button[href="#!/client/index"]`
|
||||
cancelButton: `vn-button[href="#!/client/index"]`,
|
||||
},
|
||||
clientBasicData: {
|
||||
basicDataButton: `vn-menu-item a[ui-sref="client.card.basicData"]`,
|
||||
|
@ -46,7 +44,7 @@ export default {
|
|||
channelInput: `vn-autocomplete[field="$ctrl.client.contactChannelFk"] input`,
|
||||
channelMetropolisOption: `vn-autocomplete[field="$ctrl.client.contactChannelFk"] vn-drop-down ul > li:nth-child(3)`,
|
||||
channelRumorsOption: `vn-autocomplete[field="$ctrl.client.contactChannelFk"] vn-drop-down ul > li:nth-child(4)`,
|
||||
saveButton: `${components.vnSubmit}`
|
||||
saveButton: `${components.vnSubmit}`,
|
||||
},
|
||||
clientFiscalData: {
|
||||
fiscalDataButton: `vn-menu-item a[ui-sref="client.card.fiscalData"]`,
|
||||
|
@ -73,7 +71,7 @@ export default {
|
|||
invoiceByMailCheckboxLabel: `vn-check[label='Invoice by mail'] > label`,
|
||||
invoiceByMailCheckboxInput: `vn-check[label='Invoice by mail'] input`,
|
||||
viesCheckboxInput: `vn-check[label='Vies'] > label > input`,
|
||||
saveButton: `${components.vnSubmit}`
|
||||
saveButton: `${components.vnSubmit}`,
|
||||
},
|
||||
clientPayMethod: {
|
||||
payMethodButton: `vn-menu-item a[ui-sref="client.card.billingData"]`,
|
||||
|
@ -90,7 +88,7 @@ export default {
|
|||
newBankEntityName: 'vn-client-billing-data > vn-dialog vn-textfield[label="Name"] input',
|
||||
newBankEntityBIC: 'vn-client-billing-data > vn-dialog vn-textfield[label="Swift / BIC"] input',
|
||||
acceptBankEntityButton: 'vn-client-billing-data > vn-dialog button[response="ACCEPT"]',
|
||||
saveButton: `${components.vnSubmit}`
|
||||
saveButton: `${components.vnSubmit}`,
|
||||
},
|
||||
clientAddresses: {
|
||||
addressesButton: `vn-menu-item a[ui-sref="client.card.address.index"]`,
|
||||
|
@ -123,27 +121,27 @@ export default {
|
|||
thirdObservationDescriptionInput: `vn-client-address-edit [name=observations] :nth-child(3) [model="observation.description"] input`,
|
||||
addObservationButton: `vn-client-address-edit vn-icon-button[icon="add_circle"]`,
|
||||
saveButton: `${components.vnSubmit}`,
|
||||
cancelButton: `button[ui-sref="client.card.address.index"]`
|
||||
cancelButton: `button[ui-sref="client.card.address.index"]`,
|
||||
},
|
||||
clientWebAccess: {
|
||||
webAccessButton: `vn-menu-item a[ui-sref="client.card.webAccess"]`,
|
||||
enableWebAccessCheckbox: `vn-check[label='Enable web access'] > label > input`,
|
||||
userNameInput: `${components.vnTextfield}[name="name"]`,
|
||||
saveButton: `${components.vnSubmit}`
|
||||
saveButton: `${components.vnSubmit}`,
|
||||
},
|
||||
clientNotes: {
|
||||
notesButton: `vn-menu-item a[ui-sref="client.card.note.index"]`,
|
||||
addNoteFloatButton: `${components.vnFloatButton}`,
|
||||
noteInput: `vn-textarea[label="Note"]`,
|
||||
saveButton: `${components.vnSubmit}`,
|
||||
firstNoteText: 'vn-client-note .text'
|
||||
firstNoteText: 'vn-client-note .text',
|
||||
},
|
||||
clientCredit: {
|
||||
creditButton: `vn-menu-item a[ui-sref="client.card.credit.index"]`,
|
||||
addCreditFloatButton: `${components.vnFloatButton}`,
|
||||
creditInput: `${components.vnTextfield}[name="credit"]`,
|
||||
saveButton: `${components.vnSubmit}`,
|
||||
firstCreditText: 'vn-client-credit-index vn-card > div vn-table vn-tbody > vn-tr'
|
||||
firstCreditText: 'vn-client-credit-index vn-card > div vn-table vn-tbody > vn-tr',
|
||||
},
|
||||
clientGreuge: {
|
||||
greugeButton: `vn-menu-item a[ui-sref="client.card.greuge.index"]`,
|
||||
|
@ -153,15 +151,15 @@ export default {
|
|||
typeInput: `vn-autocomplete[field="$ctrl.greuge.greugeTypeFk"] input`,
|
||||
typeSecondOption: `vn-autocomplete[field="$ctrl.greuge.greugeTypeFk"] vn-drop-down ul > li`,
|
||||
saveButton: `${components.vnSubmit}`,
|
||||
firstGreugeText: 'vn-client-greuge-index vn-card > div vn-table vn-tbody > vn-tr'
|
||||
firstGreugeText: 'vn-client-greuge-index vn-card > div vn-table vn-tbody > vn-tr',
|
||||
},
|
||||
clientMandate: {
|
||||
mandateButton: `vn-menu-item a[ui-sref="client.card.mandate"]`,
|
||||
firstMandateText: 'vn-client-mandate vn-card > div vn-table vn-tbody > vn-tr'
|
||||
firstMandateText: 'vn-client-mandate vn-card > div vn-table vn-tbody > vn-tr',
|
||||
},
|
||||
clientInvoices: {
|
||||
invoicesButton: `vn-menu-item a[ui-sref="client.card.invoice"]`,
|
||||
firstInvoiceText: 'vn-client-invoice vn-card > div vn-table vn-tbody > vn-tr'
|
||||
firstInvoiceText: 'vn-client-invoice vn-card > div vn-table vn-tbody > vn-tr',
|
||||
},
|
||||
itemsIndex: {
|
||||
goBackToModuleIndexButton: `vn-ticket-descriptor a[href="#!/ticket/index"]`,
|
||||
|
@ -172,7 +170,7 @@ export default {
|
|||
acceptClonationAlertButton: `vn-item-index [vn-id="clone"] [response="ACCEPT"]`,
|
||||
searchItemInput: `${components.vnTextfield}`,
|
||||
searchButton: `vn-searchbar vn-icon[icon="search"]`,
|
||||
closeItemSummaryPreview: 'vn-item-index [vn-id="preview"] button.close'
|
||||
closeItemSummaryPreview: 'vn-item-index [vn-id="preview"] button.close',
|
||||
},
|
||||
itemCreateView: {
|
||||
name: `${components.vnTextfield}[name="name"]`,
|
||||
|
@ -183,7 +181,7 @@ export default {
|
|||
originSelect: `vn-autocomplete[field="$ctrl.item.originFk"] input`,
|
||||
originSelectOptionOne: `vn-autocomplete[field="$ctrl.item.originFk"] vn-drop-down ul > li:nth-child(2)`,
|
||||
createButton: `${components.vnSubmit}`,
|
||||
cancelButton: `button[ui-sref="item.index"]`
|
||||
cancelButton: `button[ui-sref="item.index"]`,
|
||||
|
||||
},
|
||||
itemBasicData: {
|
||||
|
@ -201,7 +199,7 @@ export default {
|
|||
expenceSelectOptionThree: `vn-autocomplete[field="$ctrl.item.expenceFk"] vn-drop-down ul > li:nth-child(3)`,
|
||||
longNameInput: `vn-textfield[label="Full name"] input`,
|
||||
isActiveCheckbox: `vn-check[label='Active'] > label > input`,
|
||||
submitBasicDataButton: `${components.vnSubmit}`
|
||||
submitBasicDataButton: `${components.vnSubmit}`,
|
||||
},
|
||||
itemTags: {
|
||||
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',
|
||||
|
@ -231,7 +229,7 @@ export default {
|
|||
seventhValueInput: `vn-item-tags vn-horizontal:nth-child(8) > vn-textfield[label="Value"] input`,
|
||||
seventhRelevancyInput: `vn-horizontal:nth-child(8) > vn-textfield[label="Relevancy"] input`,
|
||||
addItemTagButton: `vn-icon-button[icon="add_circle"]`,
|
||||
submitItemTagsButton: `${components.vnSubmit}`
|
||||
submitItemTagsButton: `${components.vnSubmit}`,
|
||||
},
|
||||
itemTax: {
|
||||
taxButton: `vn-menu-item a[ui-sref="item.card.tax"]`,
|
||||
|
@ -241,14 +239,14 @@ export default {
|
|||
secondClassSelectOptionOne: `vn-horizontal:nth-child(3) > vn-autocomplete vn-drop-down ul > li:nth-child(1)`,
|
||||
thirdClassSelect: `vn-horizontal:nth-child(4) > vn-autocomplete[field="tax.taxClassFk"] input`,
|
||||
thirdClassSelectOptionTwo: `vn-horizontal:nth-child(4) > vn-autocomplete vn-drop-down ul > li:nth-child(2)`,
|
||||
submitTaxButton: `${components.vnSubmit}`
|
||||
submitTaxButton: `${components.vnSubmit}`,
|
||||
},
|
||||
itemBarcodes: {
|
||||
barcodeButton: `vn-menu-item a[ui-sref="item.card.itemBarcode"]`,
|
||||
addBarcodeButton: `vn-icon[icon="add_circle"]`,
|
||||
thirdCodeInput: `vn-item-barcode vn-horizontal:nth-child(4) > ${components.vnTextfield}`,
|
||||
submitBarcodesButton: `${components.vnSubmit}`,
|
||||
firstCodeRemoveButton: `vn-item-barcode vn-horizontal vn-none vn-icon[icon="remove_circle_outline"]`
|
||||
firstCodeRemoveButton: `vn-item-barcode vn-horizontal vn-none vn-icon[icon="remove_circle_outline"]`,
|
||||
},
|
||||
itemNiches: {
|
||||
nicheButton: `vn-menu-item a[ui-sref="item.card.niche"]`,
|
||||
|
@ -262,7 +260,7 @@ export default {
|
|||
thirdWarehouseSelect: `vn-horizontal:nth-child(4) > vn-autocomplete[field="niche.warehouseFk"] input`,
|
||||
thirdWarehouseSelectFourthOption: `vn-horizontal:nth-child(4) > vn-autocomplete[field="niche.warehouseFk"] vn-drop-down ul > li:nth-child(4)`,
|
||||
thirdCodeInput: `vn-horizontal:nth-child(4) > vn-textfield[label="Code"] input`,
|
||||
submitNichesButton: `${components.vnSubmit}`
|
||||
submitNichesButton: `${components.vnSubmit}`,
|
||||
},
|
||||
itemBotanical: {
|
||||
botanicalButton: `vn-menu-item a[ui-sref="item.card.botanical"]`,
|
||||
|
@ -273,7 +271,7 @@ export default {
|
|||
speciesSelect: `vn-autocomplete[field="$ctrl.botanical.specieFk"] input`,
|
||||
speciesSelectOptionOne: `vn-autocomplete[field="$ctrl.botanical.specieFk"] vn-drop-down ul > li:nth-child(1)`,
|
||||
speciesSelectOptionTwo: `vn-autocomplete[field="$ctrl.botanical.specieFk"] vn-drop-down ul > li:nth-child(2)`,
|
||||
submitBotanicalButton: `${components.vnSubmit}`
|
||||
submitBotanicalButton: `${components.vnSubmit}`,
|
||||
},
|
||||
itemSummary: {
|
||||
basicData: `vn-item-summary vn-vertical[name="basicData"]`,
|
||||
|
@ -281,14 +279,14 @@ export default {
|
|||
tags: `vn-item-summary vn-vertical[name="tags"]`,
|
||||
niche: `vn-item-summary vn-vertical[name="niche"]`,
|
||||
botanical: `vn-item-summary vn-vertical[name="botanical"]`,
|
||||
barcode: `vn-item-summary vn-vertical[name="barcode"]`
|
||||
barcode: `vn-item-summary vn-vertical[name="barcode"]`,
|
||||
},
|
||||
ticketsIndex: {
|
||||
searchResult: `vn-ticket-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr`,
|
||||
searchResultDate: `vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)`,
|
||||
searchResultAddress: `vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(6)`,
|
||||
searchTicketInput: `vn-ticket-index ${components.vnTextfield}`,
|
||||
searchButton: `vn-ticket-index vn-searchbar vn-icon[icon="search"]`
|
||||
searchButton: `vn-ticket-index vn-searchbar vn-icon[icon="search"]`,
|
||||
},
|
||||
ticketNotes: {
|
||||
notesButton: `vn-menu-item a[ui-sref="ticket.card.observation"]`,
|
||||
|
@ -297,12 +295,12 @@ export default {
|
|||
firstNoteSelect: `vn-autocomplete[field="observation.observationTypeFk"] input`,
|
||||
firstNoteSelectSecondOption: `vn-autocomplete[field="observation.observationTypeFk"] vn-drop-down ul > li:nth-child(2)`,
|
||||
firstDescriptionInput: `vn-textfield[label="Description"] input`,
|
||||
submitNotesButton: `${components.vnSubmit}`
|
||||
submitNotesButton: `${components.vnSubmit}`,
|
||||
},
|
||||
ticketExpedition: {
|
||||
expeditionButton: `vn-menu-item a[ui-sref="ticket.card.expedition"]`,
|
||||
secondExpeditionRemoveButton: `vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button[icon="delete"]`,
|
||||
secondExpeditionText: `vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(2)`
|
||||
secondExpeditionText: `vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(2)`,
|
||||
},
|
||||
ticketPackages: {
|
||||
packagesButton: `vn-menu-item a[ui-sref="ticket.card.package.index"]`,
|
||||
|
@ -312,7 +310,7 @@ export default {
|
|||
firstRemovePackageButton: `vn-icon[vn-tooltip="Remove package"]`,
|
||||
addPackageButton: `vn-icon-button[vn-tooltip="Add package"]`,
|
||||
clearPackageSelectButton: `vn-autocomplete[label="Package"] > div > div > div > vn-icon > i`,
|
||||
savePackagesButton: `${components.vnSubmit}`
|
||||
savePackagesButton: `${components.vnSubmit}`,
|
||||
},
|
||||
ticketSales: {
|
||||
saleLine: `vn-table div > vn-tbody > vn-tr`,
|
||||
|
@ -360,7 +358,7 @@ export default {
|
|||
moreMenuUnmarkResevedOption: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(5)',
|
||||
moreMenuUpdateDiscount: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(6)',
|
||||
moreMenuUpdateDiscountInput: 'vn-ticket-sale vn-dialog.shown vn-ticket-sale-edit-discount input',
|
||||
moreMenuCreateClaim: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(1)'
|
||||
moreMenuCreateClaim: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(1)',
|
||||
},
|
||||
ticketTracking: {
|
||||
trackingButton: `vn-left-menu a[ui-sref="ticket.card.tracking.index"]`,
|
||||
|
@ -368,7 +366,7 @@ export default {
|
|||
stateSelect: 'vn-ticket-tracking-edit vn-autocomplete[field="$ctrl.ticket.stateFk"] input',
|
||||
stateSelectInput: 'vn-ticket-tracking-edit vn-autocomplete > vn-drop-down > vn-popover vn-textfield input',
|
||||
stateSelectFirstResult: 'vn-ticket-tracking-edit vn-autocomplete > vn-drop-down > vn-popover ul > li:nth-child(1)',
|
||||
saveButton: `${components.vnSubmit}`
|
||||
saveButton: `${components.vnSubmit}`,
|
||||
},
|
||||
ticketBasicData: {
|
||||
basicDataButton: `vn-menu-item a[ui-sref="ticket.card.data.stepOne"]`,
|
||||
|
@ -383,18 +381,24 @@ export default {
|
|||
stepTwoTotalPriceDif: `vn-ticket-data-step-two > form > vn-card > div > vn-horizontal > table > tfoot > tr > td:nth-child(4)`,
|
||||
chargesReason: `vn-autocomplete[field="$ctrl.ticket.option"] input`,
|
||||
chargesReasonFourthOption: `vn-autocomplete[field="$ctrl.ticket.option"] vn-drop-down ul > li:nth-child(4)`,
|
||||
chargesReasonFirstOption: `vn-autocomplete[field="$ctrl.ticket.option"] vn-drop-down ul > li:nth-child(1)`
|
||||
chargesReasonFirstOption: `vn-autocomplete[field="$ctrl.ticket.option"] vn-drop-down ul > li:nth-child(1)`,
|
||||
},
|
||||
ticketComponents: {
|
||||
componentsButton: `vn-menu-item a[ui-sref="ticket.card.components"]`,
|
||||
base: 'vn-ticket-components tfoot > tr:nth-child(1) > td',
|
||||
margin: 'vn-ticket-components tfoot > tr:nth-child(2) > td',
|
||||
total: 'vn-ticket-components tfoot > tr:nth-child(3) > td',
|
||||
},
|
||||
createStateView: {
|
||||
stateInput: `vn-autocomplete[field="$ctrl.ticket.stateFk"] > div > div > input`,
|
||||
stateInputOptionOne: `vn-autocomplete[field="$ctrl.ticket.stateFk"] vn-drop-down ul > li:nth-child(1)`,
|
||||
clearStateInputButton: `vn-autocomplete[field="$ctrl.ticket.stateFk"] > div > div > div > vn-icon > i`,
|
||||
saveStateButton: `${components.vnSubmit}`
|
||||
saveStateButton: `${components.vnSubmit}`,
|
||||
},
|
||||
claimsIndex: {
|
||||
searchClaimInput: `vn-claim-index ${components.vnTextfield}`,
|
||||
searchResult: `vn-claim-index vn-card > div > vn-table > div > vn-tbody > vn-tr`,
|
||||
searchButton: `vn-claim-index vn-searchbar vn-icon[icon="search"]`
|
||||
searchButton: `vn-claim-index vn-searchbar vn-icon[icon="search"]`,
|
||||
},
|
||||
claimBasicData: {
|
||||
basicDataButton: `vn-menu-item a[ui-sref="claim.card.basicData"]`,
|
||||
|
@ -404,10 +408,10 @@ export default {
|
|||
isPaidWithManaCheckbox: `vn-check[field="$ctrl.claim.isChargedToMana"] > label > input`,
|
||||
responsabilityInputRange: `vn-input-range`,
|
||||
observationInput: `vn-textarea[label="Observation"] textarea`,
|
||||
saveButton: `${components.vnSubmit}`
|
||||
saveButton: `${components.vnSubmit}`,
|
||||
},
|
||||
claimDetails: {
|
||||
detailsButton: `vn-menu-item a[ui-sref="claim.card.detail"]`,
|
||||
addItemButton: `vn-claim-detail a vn-float-button`
|
||||
}
|
||||
addItemButton: `vn-claim-detail a vn-float-button`,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -3,122 +3,122 @@ import createNightmare from '../../helpers/nightmare';
|
|||
|
||||
describe('Client', () => {
|
||||
describe('create path', () => {
|
||||
let nightmare = createNightmare();
|
||||
const nightmare = createNightmare();
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.waitForLogin('employee');
|
||||
.waitForLogin('employee');
|
||||
});
|
||||
|
||||
it('should access to the clients index by clicking the clients button', async() => {
|
||||
let url = await nightmare
|
||||
.click(selectors.moduleAccessView.clientsSectionButton)
|
||||
.wait(selectors.clientsIndex.createClientButton)
|
||||
.parsedUrl();
|
||||
|
||||
it('should access to the clients index by clicking the clients button', async () => {
|
||||
const url = await nightmare
|
||||
.click(selectors.moduleAccessView.clientsSectionButton)
|
||||
.wait(selectors.clientsIndex.createClientButton)
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/client/index');
|
||||
});
|
||||
|
||||
it(`should search for the user Carol Danvers to confirm it isn't created yet`, async() => {
|
||||
let result = await nightmare
|
||||
.wait(selectors.clientsIndex.searchResult)
|
||||
.type(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
|
||||
.click(selectors.clientsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0)
|
||||
.countElement(selectors.clientsIndex.searchResult);
|
||||
|
||||
it(`should search for the user Carol Danvers to confirm it isn't created yet`, async () => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientsIndex.searchResult)
|
||||
.type(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
|
||||
.click(selectors.clientsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0)
|
||||
.countElement(selectors.clientsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(0);
|
||||
});
|
||||
|
||||
it('should access to the create client view by clicking the create-client floating button', async() => {
|
||||
let url = await nightmare
|
||||
.click(selectors.clientsIndex.createClientButton)
|
||||
.wait(selectors.createClientView.createButton)
|
||||
.parsedUrl();
|
||||
|
||||
it('should access to the create client view by clicking the create-client floating button', async () => {
|
||||
const url = await nightmare
|
||||
.click(selectors.clientsIndex.createClientButton)
|
||||
.wait(selectors.createClientView.createButton)
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/client/create');
|
||||
});
|
||||
|
||||
it('should return to the client index by clicking the cancel button', async() => {
|
||||
let url = await nightmare
|
||||
.click(selectors.createClientView.cancelButton)
|
||||
.wait(selectors.clientsIndex.createClientButton)
|
||||
.parsedUrl();
|
||||
|
||||
it('should return to the client index by clicking the cancel button', async () => {
|
||||
const url = await nightmare
|
||||
.click(selectors.createClientView.cancelButton)
|
||||
.wait(selectors.clientsIndex.createClientButton)
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/client/index');
|
||||
});
|
||||
|
||||
it('should now access to the create client view by clicking the create-client floating button', async() => {
|
||||
let url = await nightmare
|
||||
.click(selectors.clientsIndex.createClientButton)
|
||||
.wait(selectors.createClientView.createButton)
|
||||
.parsedUrl();
|
||||
|
||||
it('should now access to the create client view by clicking the create-client floating button', async () => {
|
||||
const url = await nightmare
|
||||
.click(selectors.clientsIndex.createClientButton)
|
||||
.wait(selectors.createClientView.createButton)
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/client/create');
|
||||
});
|
||||
|
||||
it('should receive an error when clicking the create button having all the form fields empty', async() => {
|
||||
let result = await nightmare
|
||||
.click(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it('should receive an error when clicking the create button having name and Business name fields empty', async() => {
|
||||
let result = await nightmare
|
||||
.type(selectors.createClientView.taxNumber, '74451390E')
|
||||
.type(selectors.createClientView.userName, 'CaptainMarvel')
|
||||
.type(selectors.createClientView.email, 'CarolDanvers@verdnatura.es')
|
||||
.waitToClick(selectors.createClientView.salesPersonInput)
|
||||
.waitToClick(selectors.createClientView.salesBruceBannerOption)
|
||||
.click(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
it('should receive an error when clicking the create button having all the form fields empty', async () => {
|
||||
const result = await nightmare
|
||||
.click(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it(`should attempt to create a new user with all it's data but wrong email`, async() => {
|
||||
let result = await nightmare
|
||||
.type(selectors.createClientView.name, 'Carol Danvers')
|
||||
.type(selectors.createClientView.socialName, 'AVG tax')
|
||||
.clearInput(selectors.createClientView.email)
|
||||
.type(selectors.createClientView.email, 'incorrect email format')
|
||||
.click(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
it('should receive an error when clicking the create button having name and Business name fields empty', async () => {
|
||||
const result = await nightmare
|
||||
.type(selectors.createClientView.taxNumber, '74451390E')
|
||||
.type(selectors.createClientView.userName, 'CaptainMarvel')
|
||||
.type(selectors.createClientView.email, 'CarolDanvers@verdnatura.es')
|
||||
.waitToClick(selectors.createClientView.salesPersonInput)
|
||||
.waitToClick(selectors.createClientView.salesBruceBannerOption)
|
||||
.click(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it(`should create a new user with all correct data`, async() => {
|
||||
let result = await nightmare
|
||||
.clearInput(selectors.createClientView.email)
|
||||
.type(selectors.createClientView.email, 'caroldanvers@verdnatura.es')
|
||||
.click(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
it(`should attempt to create a new user with all it's data but wrong email`, async () => {
|
||||
const result = await nightmare
|
||||
.type(selectors.createClientView.name, 'Carol Danvers')
|
||||
.type(selectors.createClientView.socialName, 'AVG tax')
|
||||
.clearInput(selectors.createClientView.email)
|
||||
.type(selectors.createClientView.email, 'incorrect email format')
|
||||
.click(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it(`should create a new user with all correct data`, async () => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.createClientView.email)
|
||||
.type(selectors.createClientView.email, 'caroldanvers@verdnatura.es')
|
||||
.click(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should click on the Clients button of the top bar menu', async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.clientsButton)
|
||||
.wait(selectors.clientsIndex.createClientButton)
|
||||
.parsedUrl();
|
||||
|
||||
it('should click on the Clients button of the top bar menu', async () => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.clientsButton)
|
||||
.wait(selectors.clientsIndex.createClientButton)
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/client/index');
|
||||
});
|
||||
|
||||
it(`should search for the user Carol Danvers to confirm it exists`, async() => {
|
||||
let result = await nightmare
|
||||
.wait(selectors.clientsIndex.searchResult)
|
||||
.type(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
|
||||
.click(selectors.clientsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
||||
.countElement(selectors.clientsIndex.searchResult);
|
||||
|
||||
it(`should search for the user Carol Danvers to confirm it exists`, async () => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientsIndex.searchResult)
|
||||
.type(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
|
||||
.click(selectors.clientsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
||||
.countElement(selectors.clientsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,76 +7,76 @@ describe('Ticket', () => {
|
|||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.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
|
||||
.click(selectors.moduleAccessView.ticketsSectionButton)
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.parsedUrl()
|
||||
.then(url => {
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.click(selectors.moduleAccessView.ticketsSectionButton)
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.parsedUrl()
|
||||
.then((url) => {
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it('should search for the ticket with id 1', done => {
|
||||
it('should search for the ticket with id 1', (done) => {
|
||||
return nightmare
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
||||
.click(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult)
|
||||
.then(result => {
|
||||
expect(result).toEqual(1);
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
||||
.click(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult)
|
||||
.then((result) => {
|
||||
expect(result).toEqual(1);
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the ticket notes`, done => {
|
||||
it(`should click on the search result to access to the ticket notes`, (done) => {
|
||||
return nightmare
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitToClick(selectors.ticketNotes.notesButton)
|
||||
.waitForURL('observation')
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toContain('observation');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitToClick(selectors.ticketNotes.notesButton)
|
||||
.waitForURL('observation')
|
||||
.url()
|
||||
.then((url) => {
|
||||
expect(url).toContain('observation');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should click create a new note and delete a former one`, done => {
|
||||
it(`should click create a new note and delete a former one`, (done) => {
|
||||
return nightmare
|
||||
.waitToClick(selectors.ticketNotes.firstNoteRemoveButton)
|
||||
.waitToClick(selectors.ticketNotes.addNoteButton)
|
||||
.waitToClick(selectors.ticketNotes.firstNoteSelect)
|
||||
.waitToClick(selectors.ticketNotes.firstNoteSelectSecondOption)
|
||||
.type(selectors.ticketNotes.firstDescriptionInput, 'description')
|
||||
.click(selectors.ticketNotes.submitNotesButton)
|
||||
.waitForLastSnackbar()
|
||||
.then(result => {
|
||||
expect(result).toEqual('Data saved!');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitToClick(selectors.ticketNotes.firstNoteRemoveButton)
|
||||
.waitToClick(selectors.ticketNotes.addNoteButton)
|
||||
.waitToClick(selectors.ticketNotes.firstNoteSelect)
|
||||
.waitToClick(selectors.ticketNotes.firstNoteSelectSecondOption)
|
||||
.type(selectors.ticketNotes.firstDescriptionInput, 'description')
|
||||
.click(selectors.ticketNotes.submitNotesButton)
|
||||
.waitForLastSnackbar()
|
||||
.then((result) => {
|
||||
expect(result).toEqual('Data saved!');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should confirm the note is the expected one`, done => {
|
||||
it(`should confirm the note is the expected one`, (done) => {
|
||||
return nightmare
|
||||
.click(selectors.ticketPackages.packagesButton)
|
||||
.wait(selectors.ticketPackages.firstPackageSelect)
|
||||
.click(selectors.ticketNotes.notesButton)
|
||||
.waitProperty(selectors.ticketNotes.firstNoteSelect, 'value')
|
||||
.then(result => {
|
||||
expect(result).toEqual('observation one');
|
||||
return nightmare
|
||||
.getProperty(selectors.ticketNotes.firstDescriptionInput, 'value');
|
||||
})
|
||||
.then(result => {
|
||||
expect(result).toEqual('description');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.click(selectors.ticketPackages.packagesButton)
|
||||
.wait(selectors.ticketPackages.firstPackageSelect)
|
||||
.click(selectors.ticketNotes.notesButton)
|
||||
.waitProperty(selectors.ticketNotes.firstNoteSelect, 'value')
|
||||
.then((result) => {
|
||||
expect(result).toEqual('observation one');
|
||||
return nightmare
|
||||
.getProperty(selectors.ticketNotes.firstDescriptionInput, 'value');
|
||||
})
|
||||
.then((result) => {
|
||||
expect(result).toEqual('description');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,59 +7,59 @@ describe('Ticket', () => {
|
|||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.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
|
||||
.click(selectors.moduleAccessView.ticketsSectionButton)
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.parsedUrl()
|
||||
.then(url => {
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.click(selectors.moduleAccessView.ticketsSectionButton)
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.parsedUrl()
|
||||
.then((url) => {
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it('should search for the ticket with id 1', done => {
|
||||
it('should search for the ticket with id 1', (done) => {
|
||||
return nightmare
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
||||
.click(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult)
|
||||
.then(result => {
|
||||
expect(result).toEqual(1);
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
||||
.click(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult)
|
||||
.then((result) => {
|
||||
expect(result).toEqual(1);
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the ticket expeditions`, done => {
|
||||
it(`should click on the search result to access to the ticket expeditions`, (done) => {
|
||||
return nightmare
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitToClick(selectors.ticketExpedition.expeditionButton)
|
||||
.waitForURL('expedition')
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toContain('expedition');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitToClick(selectors.ticketExpedition.expeditionButton)
|
||||
.waitForURL('expedition')
|
||||
.url()
|
||||
.then((url) => {
|
||||
expect(url).toContain('expedition');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should delete a former expedition and confirm the remaining expedition is the expected one`, done => {
|
||||
it(`should delete a former expedition and confirm the remaining expedition is the expected one`, (done) => {
|
||||
return nightmare
|
||||
.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton)
|
||||
.click(selectors.ticketPackages.packagesButton)
|
||||
.wait(selectors.ticketPackages.firstPackageSelect)
|
||||
.click(selectors.ticketExpedition.expeditionButton)
|
||||
.wait(selectors.ticketExpedition.secondExpeditionText)
|
||||
.getInnerText(selectors.ticketExpedition.secondExpeditionText)
|
||||
.then(value => {
|
||||
expect(value).toContain('Iron Patriot');
|
||||
expect(value).toContain('root');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton)
|
||||
.click(selectors.ticketPackages.packagesButton)
|
||||
.wait(selectors.ticketPackages.firstPackageSelect)
|
||||
.click(selectors.ticketExpedition.expeditionButton)
|
||||
.wait(selectors.ticketExpedition.secondExpeditionText)
|
||||
.getInnerText(selectors.ticketExpedition.secondExpeditionText)
|
||||
.then((value) => {
|
||||
expect(value).toContain('Iron Patriot');
|
||||
expect(value).toContain('root');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,135 +6,111 @@ describe('Ticket List sale path', () => {
|
|||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.waitForLogin('employee');
|
||||
.waitForLogin('employee');
|
||||
});
|
||||
|
||||
it('should click on the Tickets button of the top bar menu', done => {
|
||||
return nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.parsedUrl()
|
||||
.then(url => {
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
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', done => {
|
||||
return nightmare
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
||||
.click(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult)
|
||||
.then(result => {
|
||||
expect(result).toEqual(1);
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
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's sale`, done => {
|
||||
return nightmare
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitToClick(selectors.ticketSales.saleButton)
|
||||
.waitForURL('sale')
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toContain('sale');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
it(`should click on the search result to access to the ticket's sale`, async () => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitToClick(selectors.ticketSales.saleButton)
|
||||
.waitForURL('sale')
|
||||
.url();
|
||||
|
||||
expect(url).toContain('sale');
|
||||
});
|
||||
|
||||
it('should confirm the first ticket sale contains the colour', done => {
|
||||
return nightmare
|
||||
.wait(selectors.ticketSales.firstSaleText)
|
||||
.getInnerText(selectors.ticketSales.firstSaleColour)
|
||||
.then(value => {
|
||||
expect(value).toContain('Yellow');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
it('should confirm the first ticket sale contains the colour', async () => {
|
||||
const value = await nightmare
|
||||
.wait(selectors.ticketSales.firstSaleText)
|
||||
.getInnerText(selectors.ticketSales.firstSaleColour);
|
||||
|
||||
expect(value).toContain('Yellow');
|
||||
});
|
||||
|
||||
it('should confirm the first ticket sale contains the lenght', done => {
|
||||
return nightmare
|
||||
.wait(selectors.ticketSales.firstSaleText)
|
||||
.getInnerText(selectors.ticketSales.firstSaleText)
|
||||
.then(value => {
|
||||
expect(value).toContain('5');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
it('should confirm the first ticket sale contains the lenght', async () => {
|
||||
const value = await nightmare
|
||||
.wait(selectors.ticketSales.firstSaleText)
|
||||
.getInnerText(selectors.ticketSales.firstSaleText);
|
||||
|
||||
expect(value).toContain('5');
|
||||
});
|
||||
|
||||
it('should confirm the first ticket sale contains the price', done => {
|
||||
return nightmare
|
||||
.wait(selectors.ticketSales.firstSaleText)
|
||||
.getInnerText(selectors.ticketSales.firstSalePrice)
|
||||
.then(value => {
|
||||
expect(value).toContain('9.10');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
it('should confirm the first ticket sale contains the price', async () => {
|
||||
const value = await nightmare
|
||||
.wait(selectors.ticketSales.firstSaleText)
|
||||
.getInnerText(selectors.ticketSales.firstSalePrice);
|
||||
|
||||
expect(value).toContain('9.10');
|
||||
});
|
||||
|
||||
it('should confirm the first ticket sale contains the discount', done => {
|
||||
return nightmare
|
||||
.wait(selectors.ticketSales.firstSaleText)
|
||||
.getInnerText(selectors.ticketSales.firstSaleDiscount)
|
||||
.then(value => {
|
||||
expect(value).toContain('0 %');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
it('should confirm the first ticket sale contains the discount', async () => {
|
||||
const value = await nightmare
|
||||
.wait(selectors.ticketSales.firstSaleText)
|
||||
.getInnerText(selectors.ticketSales.firstSaleDiscount);
|
||||
|
||||
expect(value).toContain('0 %');
|
||||
});
|
||||
|
||||
it('should confirm the first ticket sale contains the total import', done => {
|
||||
return nightmare
|
||||
.wait(selectors.ticketSales.firstSaleText)
|
||||
.getInnerText(selectors.ticketSales.firstSaleImport)
|
||||
.then(value => {
|
||||
expect(value).toContain('45.50');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
it('should confirm the first ticket sale contains the total import', async () => {
|
||||
const value = await nightmare
|
||||
.wait(selectors.ticketSales.firstSaleText)
|
||||
.getInnerText(selectors.ticketSales.firstSaleImport);
|
||||
|
||||
expect(value).toContain('45.50');
|
||||
});
|
||||
|
||||
it('should confirm the second ticket sale contains the colour', done => {
|
||||
return nightmare
|
||||
.wait(selectors.ticketSales.secondSaleText)
|
||||
.getInnerText(selectors.ticketSales.secondSaleColour)
|
||||
.then(value => {
|
||||
expect(value).toContain('Red');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
it('should confirm the second ticket sale contains the colour', async () => {
|
||||
const value = await nightmare
|
||||
.wait(selectors.ticketSales.secondSaleText)
|
||||
.getInnerText(selectors.ticketSales.secondSaleColour);
|
||||
|
||||
expect(value).toContain('Red');
|
||||
});
|
||||
|
||||
it('should confirm the second ticket sale contains the price', done => {
|
||||
return nightmare
|
||||
.wait(selectors.ticketSales.secondSaleText)
|
||||
.getInnerText(selectors.ticketSales.secondSalePrice)
|
||||
.then(value => {
|
||||
expect(value).toContain('1.07');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
it('should confirm the second ticket sale contains the price', async () => {
|
||||
const value = await nightmare
|
||||
.wait(selectors.ticketSales.secondSaleText)
|
||||
.getInnerText(selectors.ticketSales.secondSalePrice);
|
||||
|
||||
expect(value).toContain('1.07');
|
||||
});
|
||||
|
||||
it('should confirm the second ticket sale contains the discount', done => {
|
||||
return nightmare
|
||||
.wait(selectors.ticketSales.secondSaleText)
|
||||
.getInnerText(selectors.ticketSales.secondSaleDiscount)
|
||||
.then(value => {
|
||||
expect(value).toContain('0 %');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
it('should confirm the second ticket sale contains the discount', async () => {
|
||||
const value = await nightmare
|
||||
.wait(selectors.ticketSales.secondSaleText)
|
||||
.getInnerText(selectors.ticketSales.secondSaleDiscount);
|
||||
|
||||
expect(value).toContain('0 %');
|
||||
});
|
||||
|
||||
it('should confirm the second ticket sale contains the total import', done => {
|
||||
return nightmare
|
||||
.wait(selectors.ticketSales.secondSaleText)
|
||||
.getInnerText(selectors.ticketSales.secondSaleImport)
|
||||
.then(value => {
|
||||
expect(value).toContain('10.70');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
it('should confirm the second ticket sale contains the total import', async () => {
|
||||
const value = await nightmare
|
||||
.wait(selectors.ticketSales.secondSaleText)
|
||||
.getInnerText(selectors.ticketSales.secondSaleImport);
|
||||
|
||||
expect(value).toContain('10.70');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,131 +6,131 @@ describe('Ticket Create packages path', () => {
|
|||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.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
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.parsedUrl()
|
||||
.then(url => {
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.parsedUrl()
|
||||
.then((url) => {
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it('should search for the ticket 1', done => {
|
||||
it('should search for the ticket 1', (done) => {
|
||||
return nightmare
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
||||
.click(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult)
|
||||
.then(result => {
|
||||
expect(result).toEqual(1);
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
||||
.click(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult)
|
||||
.then((result) => {
|
||||
expect(result).toEqual(1);
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the ticket packages`, done => {
|
||||
it(`should click on the search result to access to the ticket packages`, (done) => {
|
||||
return nightmare
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResultAddress, 'address 21')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitToClick(selectors.ticketPackages.packagesButton)
|
||||
.waitForURL('package/index')
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toContain('package/index');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResultAddress, 'address 21')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitToClick(selectors.ticketPackages.packagesButton)
|
||||
.waitForURL('package/index')
|
||||
.url()
|
||||
.then((url) => {
|
||||
expect(url).toContain('package/index');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should delete the first package and receive and error to save a new one with blank quantity`, done => {
|
||||
it(`should delete the first package and receive and error to save a new one with blank quantity`, (done) => {
|
||||
return nightmare
|
||||
.waitToClick(selectors.ticketPackages.firstRemovePackageButton)
|
||||
.waitToClick(selectors.ticketPackages.addPackageButton)
|
||||
.waitToClick(selectors.ticketPackages.firstPackageSelect)
|
||||
.waitToClick(selectors.ticketPackages.firstPackageSelectOptionTwo)
|
||||
.click(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar()
|
||||
.then(result => {
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitToClick(selectors.ticketPackages.firstRemovePackageButton)
|
||||
.waitToClick(selectors.ticketPackages.addPackageButton)
|
||||
.waitToClick(selectors.ticketPackages.firstPackageSelect)
|
||||
.waitToClick(selectors.ticketPackages.firstPackageSelectOptionTwo)
|
||||
.click(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar()
|
||||
.then((result) => {
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should attempt create a new package but receive an error if quantity is a string`, done => {
|
||||
it(`should attempt create a new package but receive an error if quantity is a string`, (done) => {
|
||||
return nightmare
|
||||
.type(selectors.ticketPackages.firstQuantityInput, 'ninety 9')
|
||||
.click(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar()
|
||||
.then(result => {
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.type(selectors.ticketPackages.firstQuantityInput, 'ninety 9')
|
||||
.click(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar()
|
||||
.then((result) => {
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should attempt create a new package but receive an error if quantity is 0`, done => {
|
||||
it(`should attempt create a new package but receive an error if quantity is 0`, (done) => {
|
||||
return nightmare
|
||||
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
||||
.type(selectors.ticketPackages.firstQuantityInput, 0)
|
||||
.click(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar()
|
||||
.then(result => {
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
||||
.type(selectors.ticketPackages.firstQuantityInput, 0)
|
||||
.click(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar()
|
||||
.then((result) => {
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should attempt create a new package but receive an error if package is blank`, done => {
|
||||
it(`should attempt create a new package but receive an error if package is blank`, (done) => {
|
||||
return nightmare
|
||||
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
||||
.type(selectors.ticketPackages.firstQuantityInput, 99)
|
||||
.click(selectors.ticketPackages.clearPackageSelectButton)
|
||||
.click(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar()
|
||||
.then(result => {
|
||||
expect(result).toEqual('Package cannot be blank');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
||||
.type(selectors.ticketPackages.firstQuantityInput, 99)
|
||||
.click(selectors.ticketPackages.clearPackageSelectButton)
|
||||
.click(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar()
|
||||
.then((result) => {
|
||||
expect(result).toEqual('Package cannot be blank');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should create a new package with correct data`, done => {
|
||||
it(`should create a new package with correct data`, (done) => {
|
||||
return nightmare
|
||||
.waitToClick(selectors.ticketPackages.firstPackageSelect)
|
||||
.waitToClick(selectors.ticketPackages.firstPackageSelectOptionTwo)
|
||||
.waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Legendary Box')
|
||||
.click(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar()
|
||||
.then(result => {
|
||||
expect(result).toEqual('Data saved!');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitToClick(selectors.ticketPackages.firstPackageSelect)
|
||||
.waitToClick(selectors.ticketPackages.firstPackageSelectOptionTwo)
|
||||
.waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Legendary Box')
|
||||
.click(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar()
|
||||
.then((result) => {
|
||||
expect(result).toEqual('Data saved!');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should confirm the first select is the expected one`, done => {
|
||||
it(`should confirm the first select is the expected one`, (done) => {
|
||||
return nightmare
|
||||
.click(selectors.ticketSales.saleButton)
|
||||
.wait(selectors.ticketSales.firstPackageSelect)
|
||||
.click(selectors.ticketPackages.packagesButton)
|
||||
.waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Legendary Box')
|
||||
.getInputValue(selectors.ticketPackages.firstPackageSelect)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Legendary Box');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.click(selectors.ticketSales.saleButton)
|
||||
.wait(selectors.ticketSales.firstPackageSelect)
|
||||
.click(selectors.ticketPackages.packagesButton)
|
||||
.waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Legendary Box')
|
||||
.getInputValue(selectors.ticketPackages.firstPackageSelect)
|
||||
.then((result) => {
|
||||
expect(result).toEqual('Legendary Box');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should confirm the first quantity is the expected one`, done => {
|
||||
it(`should confirm the first quantity is the expected one`, (done) => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99')
|
||||
.getInputValue(selectors.ticketPackages.firstQuantityInput)
|
||||
.then(result => {
|
||||
expect(result).toEqual('99');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99')
|
||||
.getInputValue(selectors.ticketPackages.firstQuantityInput)
|
||||
.then((result) => {
|
||||
expect(result).toEqual('99');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,103 +7,103 @@ describe('Ticket', () => {
|
|||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.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
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.parsedUrl()
|
||||
.then(url => {
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.parsedUrl()
|
||||
.then((url) => {
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it('should search for the ticket 1', done => {
|
||||
it('should search for the ticket 1', (done) => {
|
||||
return nightmare
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
||||
.click(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult)
|
||||
.then(result => {
|
||||
expect(result).toEqual(1);
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
||||
.click(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult)
|
||||
.then((result) => {
|
||||
expect(result).toEqual(1);
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the ticket Tracking`, done => {
|
||||
it(`should click on the search result to access to the ticket Tracking`, (done) => {
|
||||
return nightmare
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitToClick(selectors.ticketTracking.trackingButton)
|
||||
.waitForURL('tracking/index')
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toContain('tracking/index');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitToClick(selectors.ticketTracking.trackingButton)
|
||||
.waitForURL('tracking/index')
|
||||
.url()
|
||||
.then((url) => {
|
||||
expect(url).toContain('tracking/index');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it('should access to the create state view by clicking the create floating button', done => {
|
||||
it('should access to the create state view by clicking the create floating button', (done) => {
|
||||
return nightmare
|
||||
.click(selectors.ticketTracking.createStateButton)
|
||||
.wait(selectors.createStateView.stateInput)
|
||||
.parsedUrl()
|
||||
.then(url => {
|
||||
expect(url.hash).toContain('tracking/edit');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.click(selectors.ticketTracking.createStateButton)
|
||||
.wait(selectors.createStateView.stateInput)
|
||||
.parsedUrl()
|
||||
.then((url) => {
|
||||
expect(url.hash).toContain('tracking/edit');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should attempt create a new state but receive an error if state is empty`, done => {
|
||||
it(`should attempt create a new state but receive an error if state is empty`, (done) => {
|
||||
return nightmare
|
||||
.click(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar()
|
||||
.then(result => {
|
||||
expect(result).toEqual('No changes to save');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.click(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar()
|
||||
.then((result) => {
|
||||
expect(result).toEqual('No changes to save');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should attempt create a new state then clear and save it`, done => {
|
||||
it(`should attempt create a new state then clear and save it`, (done) => {
|
||||
return nightmare
|
||||
.waitToClick(selectors.createStateView.stateInput)
|
||||
.waitToClick(selectors.createStateView.stateInputOptionOne)
|
||||
.waitToClick(selectors.createStateView.clearStateInputButton)
|
||||
.click(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar()
|
||||
.then(result => {
|
||||
expect(result).toEqual('Data saved!');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitToClick(selectors.createStateView.stateInput)
|
||||
.waitToClick(selectors.createStateView.stateInputOptionOne)
|
||||
.waitToClick(selectors.createStateView.clearStateInputButton)
|
||||
.click(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar()
|
||||
.then((result) => {
|
||||
expect(result).toEqual('Data saved!');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it('should again access to the create state view by clicking the create floating button', done => {
|
||||
it('should again access to the create state view by clicking the create floating button', (done) => {
|
||||
return nightmare
|
||||
.click(selectors.ticketTracking.createStateButton)
|
||||
.wait(selectors.createStateView.stateInput)
|
||||
.parsedUrl()
|
||||
.then(url => {
|
||||
expect(url.hash).toContain('tracking/edit');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.click(selectors.ticketTracking.createStateButton)
|
||||
.wait(selectors.createStateView.stateInput)
|
||||
.parsedUrl()
|
||||
.then((url) => {
|
||||
expect(url.hash).toContain('tracking/edit');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should create a new state`, done => {
|
||||
it(`should create a new state`, (done) => {
|
||||
return nightmare
|
||||
.waitToClick(selectors.createStateView.stateInput)
|
||||
.waitToClick(selectors.createStateView.stateInputOptionOne)
|
||||
.click(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar()
|
||||
.then(result => {
|
||||
expect(result).toEqual('Data saved!');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitToClick(selectors.createStateView.stateInput)
|
||||
.waitToClick(selectors.createStateView.stateInputOptionOne)
|
||||
.click(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar()
|
||||
.then((result) => {
|
||||
expect(result).toEqual('Data saved!');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,156 +7,156 @@ describe('Ticket', () => {
|
|||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.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
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.parsedUrl()
|
||||
.then(url => {
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.parsedUrl()
|
||||
.then((url) => {
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it('should search for the ticket 11', done => {
|
||||
it('should search for the ticket 11', (done) => {
|
||||
return nightmare
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.type(selectors.ticketsIndex.searchTicketInput, 'id:11')
|
||||
.click(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult)
|
||||
.then(result => {
|
||||
expect(result).toEqual(1);
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.wait(selectors.ticketsIndex.searchResult)
|
||||
.type(selectors.ticketsIndex.searchTicketInput, 'id:11')
|
||||
.click(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult)
|
||||
.then((result) => {
|
||||
expect(result).toEqual(1);
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the ticket Basic Data`, done => {
|
||||
it(`should click on the search result to access to the ticket Basic Data`, (done) => {
|
||||
return nightmare
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') // should be Bruce Wayne
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitToClick(selectors.ticketBasicData.basicDataButton)
|
||||
.waitForURL('data/step-one')
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toContain('data/step-one');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') // should be Bruce Wayne
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitToClick(selectors.ticketBasicData.basicDataButton)
|
||||
.waitForURL('data/step-one')
|
||||
.url()
|
||||
.then((url) => {
|
||||
expect(url).toContain('data/step-one');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should edit the client and address of the ticket then click next`, done => {
|
||||
it(`should edit the client and address of the ticket then click next`, (done) => {
|
||||
return nightmare
|
||||
.waitToClick(selectors.ticketBasicData.clientSelect)
|
||||
.waitToClick(selectors.ticketBasicData.clientSelectThirdOption)
|
||||
.wait(500)
|
||||
.waitToClick(selectors.ticketBasicData.addressSelect)
|
||||
.waitToClick(selectors.ticketBasicData.addressSelectSecondOption)
|
||||
.waitForTextInInput(selectors.ticketBasicData.addressSelect, 'Charles Xavier')
|
||||
.click(selectors.ticketBasicData.nextStepButton)
|
||||
.waitForURL('data/step-two')
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toContain('data/step-two');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitToClick(selectors.ticketBasicData.clientSelect)
|
||||
.waitToClick(selectors.ticketBasicData.clientSelectThirdOption)
|
||||
.wait(500)
|
||||
.waitToClick(selectors.ticketBasicData.addressSelect)
|
||||
.waitToClick(selectors.ticketBasicData.addressSelectSecondOption)
|
||||
.waitForTextInInput(selectors.ticketBasicData.addressSelect, 'Charles Xavier')
|
||||
.click(selectors.ticketBasicData.nextStepButton)
|
||||
.waitForURL('data/step-two')
|
||||
.url()
|
||||
.then((url) => {
|
||||
expect(url).toContain('data/step-two');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should have no price diference`, done => {
|
||||
it(`should have no price diference`, (done) => {
|
||||
return nightmare
|
||||
.getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif)
|
||||
.then(result => {
|
||||
expect(result).toContain('0');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif)
|
||||
.then((result) => {
|
||||
expect(result).toContain('0');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should click next to move on to step three`, done => {
|
||||
it(`should click next to move on to step three`, (done) => {
|
||||
return nightmare
|
||||
.click(selectors.ticketBasicData.nextStepButton)
|
||||
.waitForURL('data/step-three')
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toContain('data/step-three');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.click(selectors.ticketBasicData.nextStepButton)
|
||||
.waitForURL('data/step-three')
|
||||
.url()
|
||||
.then((url) => {
|
||||
expect(url).toContain('data/step-three');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should select a reason for the changes made then click on finalize`, done => {
|
||||
it(`should select a reason for the changes made then click on finalize`, (done) => {
|
||||
return nightmare
|
||||
.waitToClick(selectors.ticketBasicData.chargesReason)
|
||||
.waitToClick(selectors.ticketBasicData.chargesReasonFourthOption)
|
||||
.waitForTextInInput(selectors.ticketBasicData.chargesReason, 'No realizar modificaciones en precios')
|
||||
.click(selectors.ticketBasicData.finalizeButton)
|
||||
.waitForURL('summary')
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toContain('summary');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitToClick(selectors.ticketBasicData.chargesReason)
|
||||
.waitToClick(selectors.ticketBasicData.chargesReasonFourthOption)
|
||||
.waitForTextInInput(selectors.ticketBasicData.chargesReason, 'No realizar modificaciones en precios')
|
||||
.click(selectors.ticketBasicData.finalizeButton)
|
||||
.waitForURL('summary')
|
||||
.url()
|
||||
.then((url) => {
|
||||
expect(url).toContain('summary');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should go back to ticket.basicData section`, done => {
|
||||
it(`should go back to ticket.basicData section`, (done) => {
|
||||
return nightmare
|
||||
.waitToClick(selectors.ticketBasicData.basicDataButton)
|
||||
.waitForURL('data/step-one')
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toContain('data/step-one');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitToClick(selectors.ticketBasicData.basicDataButton)
|
||||
.waitForURL('data/step-one')
|
||||
.url()
|
||||
.then((url) => {
|
||||
expect(url).toContain('data/step-one');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should edit the ticket agency then click next`, done => {
|
||||
it(`should edit the ticket agency then click next`, (done) => {
|
||||
return nightmare
|
||||
.waitToClick(selectors.ticketBasicData.agencySelect)
|
||||
.waitToClick(selectors.ticketBasicData.agencySelectOptionSix)
|
||||
.waitForTextInInput(selectors.ticketBasicData.agencySelect, 'Expensive')
|
||||
.click(selectors.ticketBasicData.nextStepButton)
|
||||
.waitForURL('data/step-two')
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toContain('data/step-two');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitToClick(selectors.ticketBasicData.agencySelect)
|
||||
.waitToClick(selectors.ticketBasicData.agencySelectOptionSix)
|
||||
.waitForTextInInput(selectors.ticketBasicData.agencySelect, 'Expensive')
|
||||
.click(selectors.ticketBasicData.nextStepButton)
|
||||
.waitForURL('data/step-two')
|
||||
.url()
|
||||
.then((url) => {
|
||||
expect(url).toContain('data/step-two');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should have a price diference`, done => {
|
||||
it(`should have a price diference`, (done) => {
|
||||
return nightmare
|
||||
.getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif)
|
||||
.then(result => {
|
||||
expect(result).toContain('-20.65');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif)
|
||||
.then((result) => {
|
||||
expect(result).toContain('-20.65');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should then click next to move on to step three`, done => {
|
||||
it(`should then click next to move on to step three`, (done) => {
|
||||
return nightmare
|
||||
.click(selectors.ticketBasicData.nextStepButton)
|
||||
.waitForURL('data/step-three')
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toContain('data/step-three');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.click(selectors.ticketBasicData.nextStepButton)
|
||||
.waitForURL('data/step-three')
|
||||
.url()
|
||||
.then((url) => {
|
||||
expect(url).toContain('data/step-three');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should select a new reason for the changes made then click on finalize`, done => {
|
||||
it(`should select a new reason for the changes made then click on finalize`, (done) => {
|
||||
return nightmare
|
||||
.waitToClick(selectors.ticketBasicData.chargesReason)
|
||||
.waitToClick(selectors.ticketBasicData.chargesReasonFirstOption)
|
||||
.waitForTextInInput(selectors.ticketBasicData.chargesReason, 'Cambiar los precios en el ticket')
|
||||
.click(selectors.ticketBasicData.finalizeButton)
|
||||
.waitForURL('summary')
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toContain('summary');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
.waitToClick(selectors.ticketBasicData.chargesReason)
|
||||
.waitToClick(selectors.ticketBasicData.chargesReasonFirstOption)
|
||||
.waitForTextInInput(selectors.ticketBasicData.chargesReason, 'Cambiar los precios en el ticket')
|
||||
.click(selectors.ticketBasicData.finalizeButton)
|
||||
.waitForURL('summary')
|
||||
.url()
|
||||
.then((url) => {
|
||||
expect(url).toContain('summary');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue