This commit is contained in:
parent
e922a05e50
commit
6bf5b4c735
|
@ -2,8 +2,6 @@
|
|||
{
|
||||
// Carácter predeterminado de final de línea.
|
||||
"files.eol": "\n",
|
||||
"vsicons.presets.angular": false,
|
||||
"eslint.autoFixOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": true
|
||||
}
|
||||
|
|
|
@ -1,6 +1,20 @@
|
|||
/* eslint no-invalid-this: "off" */
|
||||
import {url as defaultURL} from './config';
|
||||
|
||||
let currentUser;
|
||||
|
||||
let actions = {
|
||||
clickIfExists: async function(selector) {
|
||||
let exists;
|
||||
try {
|
||||
exists = await this.waitForSelector(selector, {timeout: 500});
|
||||
} catch (error) {
|
||||
exists = false;
|
||||
}
|
||||
if (exists) await this.waitToClick(selector);
|
||||
return exists;
|
||||
},
|
||||
|
||||
parsedUrl: async function() {
|
||||
return new URL(await this.url());
|
||||
},
|
||||
|
@ -21,30 +35,48 @@ let actions = {
|
|||
if (lang !== 'English')
|
||||
await this.autocompleteSearch(langSelector, 'English');
|
||||
|
||||
await this.waitFor(250); // tryed {visible: true}, page 'mutation' and waitForSelector unsuccessfully...
|
||||
await this.mouse.down();
|
||||
await this.keyboard.press('Escape');
|
||||
await this.waitForSelector(langSelector, {hidden: true});
|
||||
},
|
||||
|
||||
doLogin: async function(userName, password = 'nightmare') {
|
||||
await this.wait(`vn-login [name=user]`);
|
||||
await this.clearInput(`vn-login [name=user]`);
|
||||
await this.write(`vn-login [name=user]`, userName);
|
||||
await this.clearInput(`vn-login [name=password]`);
|
||||
await this.write(`vn-login [name=password]`, password);
|
||||
await this.wait(`vn-login [ng-model="$ctrl.user"]`);
|
||||
await this.clearInput(`vn-login [ng-model="$ctrl.user"]`);
|
||||
await this.type(`vn-login [ng-model="$ctrl.user"]`, userName);
|
||||
await this.clearInput(`vn-login [ng-model="$ctrl.password"]`);
|
||||
await this.write(`vn-login [ng-model="$ctrl.password"]`, password);
|
||||
await this.click('vn-login button[type=submit]');
|
||||
},
|
||||
|
||||
login: async function(userName) {
|
||||
await this.doLogin(userName);
|
||||
await this.wait(() => {
|
||||
return document.location.hash === '#!/';
|
||||
}, {});
|
||||
await this.changeLanguageToEnglish();
|
||||
},
|
||||
if (currentUser !== userName) {
|
||||
let userPanelOpen = await this.evaluate(() => {
|
||||
return document.querySelector('.user-popover');
|
||||
});
|
||||
if (!userPanelOpen)
|
||||
await this.clickIfExists('#user');
|
||||
await this.clickIfExists('#logout');
|
||||
|
||||
waitForLogin: async function(userName) {
|
||||
await this.login(userName);
|
||||
try {
|
||||
await this.waitForURL('#!/login');
|
||||
} catch (e) {
|
||||
await this.goto(`${defaultURL}/#!/login`);
|
||||
}
|
||||
|
||||
await this.doLogin(userName);
|
||||
await this.wait(() => {
|
||||
return document.location.hash === '#!/';
|
||||
}, {});
|
||||
await this.changeLanguageToEnglish();
|
||||
|
||||
currentUser = userName;
|
||||
} else {
|
||||
await this.wait(() => {
|
||||
return document.location.hash === '#!/';
|
||||
}, {});
|
||||
await this.changeLanguageToEnglish();
|
||||
await this.waitToClick('a[ui-sref=home]');
|
||||
}
|
||||
},
|
||||
|
||||
selectModule: async function(moduleName) {
|
||||
|
@ -94,12 +126,17 @@ let actions = {
|
|||
|
||||
clearInput: async function(selector) {
|
||||
await this.wait(selector);
|
||||
return await this.evaluate(selector => {
|
||||
let $ctrl = document.querySelector(selector).closest('.vn-field').$ctrl;
|
||||
$ctrl.field = null;
|
||||
$ctrl.$.$apply();
|
||||
$ctrl.input.dispatchEvent(new Event('change'));
|
||||
let field = await this.evaluate(selector => {
|
||||
return document.querySelector(selector).closest('.vn-field').$ctrl.field;
|
||||
}, selector);
|
||||
if (field != null && field != '') {
|
||||
let coords = await this.evaluate(selector => {
|
||||
let rect = document.querySelector(selector).getBoundingClientRect();
|
||||
return {x: rect.x + (rect.width / 2), y: rect.y + (rect.height / 2)};
|
||||
}, selector);
|
||||
await this.mouse.move(coords.x, coords.y);
|
||||
await this.waitToClick(`${selector} [icon="clear"]`);
|
||||
}
|
||||
},
|
||||
|
||||
getProperty: async function(selector, property) {
|
||||
|
@ -134,8 +171,8 @@ let actions = {
|
|||
},
|
||||
|
||||
write: async function(selector, text) {
|
||||
await this.wait(selector);
|
||||
await this.type(selector, text);
|
||||
await this.wait(selector, {});
|
||||
await this.type(`${selector} input`, text);
|
||||
},
|
||||
|
||||
waitToClick: async function(selector) {
|
||||
|
@ -278,43 +315,31 @@ let actions = {
|
|||
}, {}, hashURL);
|
||||
},
|
||||
|
||||
waitForShapes: async function(selector) {
|
||||
await this.wait(selector);
|
||||
return await this.evaluate(selector => {
|
||||
const shapes = document.querySelectorAll(selector);
|
||||
const shapesList = [];
|
||||
|
||||
for (const shape of shapes)
|
||||
shapesList.push(shape.innerText);
|
||||
|
||||
return shapesList;
|
||||
}, selector);
|
||||
},
|
||||
|
||||
waitForSnackbar: async function() {
|
||||
await this.wait(500);
|
||||
return await this.waitForShapes('vn-snackbar .shape .text');
|
||||
hideSnackbar: async function() {
|
||||
await this.waitToClick('#shapes .shown button');
|
||||
},
|
||||
|
||||
waitForLastShape: async function(selector) {
|
||||
await this.wait(selector);
|
||||
return await this.evaluate(selector => {
|
||||
let snackBarText = await this.evaluate(selector => {
|
||||
const shape = document.querySelector(selector);
|
||||
|
||||
return shape.innerText;
|
||||
}, selector);
|
||||
await this.hideSnackbar();
|
||||
return snackBarText;
|
||||
},
|
||||
|
||||
waitForLastSnackbar: async function() {
|
||||
await this.wait(500);
|
||||
await this.wait(2000); // this needs a refactor to be somehow dynamic ie: page.waitForResponse(urlOrPredicate[, options]) or something to fire waitForLastShape once the request is completed
|
||||
await this.waitForSpinnerLoad();
|
||||
return await this.waitForLastShape('vn-snackbar .shape .text');
|
||||
return await this.waitForLastShape('vn-snackbar .shown .text');
|
||||
},
|
||||
|
||||
accessToSearchResult: async function(searchValue) {
|
||||
await this.clearInput('vn-searchbar input');
|
||||
await this.write('vn-searchbar input', searchValue);
|
||||
await this.click('vn-searchbar vn-icon[icon="search"]');
|
||||
await this.clearInput('vn-searchbar');
|
||||
await this.write('vn-searchbar', searchValue);
|
||||
await this.waitToClick('vn-searchbar vn-icon[icon="search"]');
|
||||
await this.waitForNumberOfElements('.search-result', 1);
|
||||
let result = await this.evaluate(() => {
|
||||
return document.querySelector('ui-view vn-card vn-table') != null;
|
||||
|
@ -327,23 +352,30 @@ let actions = {
|
|||
|
||||
accessToSection: async function(sectionRoute) {
|
||||
await this.wait(`vn-left-menu`);
|
||||
letnested = await this.evaluate(sectionRoute => {
|
||||
let nested = await this.evaluate(sectionRoute => {
|
||||
return document.querySelector(`vn-left-menu li li > a[ui-sref="${sectionRoute}"]`) != null;
|
||||
}, sectionRoute);
|
||||
|
||||
|
||||
if (nested) {
|
||||
await this.waitToClick('vn-left-menu vn-item-section > vn-icon[icon=keyboard_arrow_down]');
|
||||
await this.wait('vn-left-menu .expanded');
|
||||
}
|
||||
|
||||
await this.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
||||
await this.waitForSpinnerLoad();
|
||||
await this.evaluate(sectionRoute => {
|
||||
let navButton = document.querySelector(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
||||
navButton.scrollIntoViewIfNeeded();
|
||||
return navButton.click();
|
||||
}, sectionRoute);
|
||||
},
|
||||
|
||||
autocompleteSearch: async function(autocompleteSelector, searchValue) {
|
||||
await this.waitFor(100); // time in which the autocomplete data loads
|
||||
await this.waitToClick(`${autocompleteSelector} input`);
|
||||
await this.write(`.vn-drop-down.shown input`, searchValue);
|
||||
await this.waitFor(100); // ul to repaint
|
||||
await this.waitToClick(`.vn-drop-down.shown li.active`);
|
||||
await this.waitFor(100); // input to asign value
|
||||
await this.wait((autocompleteSelector, searchValue) => {
|
||||
return document.querySelector(`${autocompleteSelector} input`).value
|
||||
.toLowerCase()
|
||||
|
@ -355,7 +387,11 @@ let actions = {
|
|||
},
|
||||
|
||||
reloadSection: async function(sectionRoute) {
|
||||
await this.waitToClick('vn-icon[icon="desktop_windows"]');
|
||||
await this.evaluate(() => {
|
||||
let summayButton = document.querySelector('vn-icon[icon="desktop_windows"]');
|
||||
summayButton.scrollIntoViewIfNeeded();
|
||||
return summayButton.click();
|
||||
});
|
||||
await this.wait('vn-card.summary');
|
||||
await this.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
||||
},
|
||||
|
@ -404,10 +440,10 @@ let actions = {
|
|||
waitForWatcherData: async function(selector) {
|
||||
await this.wait(selector);
|
||||
await this.wait(selector => {
|
||||
const watcher = document.querySelector(selector);
|
||||
let watcher = document.querySelector(selector);
|
||||
let orgData = watcher.$ctrl.orgData;
|
||||
return !angular.equals({}, orgData) && orgData != null;
|
||||
}, selector);
|
||||
}, {}, selector);
|
||||
await this.waitForSpinnerLoad();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -12,15 +12,18 @@ export function getBrowser() {
|
|||
async function openPage(url = defaultURL) {
|
||||
if (!browser) {
|
||||
browser = await Puppeteer.launch({
|
||||
args: [
|
||||
'--start-maximized'
|
||||
// '--start-fullscreen'
|
||||
],
|
||||
defaultViewport: null,
|
||||
headless: false,
|
||||
slowMo: 0, // slow down by ms
|
||||
// devtools: true,
|
||||
});
|
||||
}
|
||||
const page = await browser.newPage();
|
||||
await page._client.send('Network.clearBrowserCookies');
|
||||
await page.goto(url);
|
||||
await page.setDefaultTimeout(5000);
|
||||
await page.goto(url, {waitUntil: 'networkidle0'});
|
||||
|
||||
page.on('console', msg => {
|
||||
let type = msg.type();
|
||||
|
|
|
@ -15,29 +15,29 @@ export default {
|
|||
userLocalCompany: '.user-popover vn-autocomplete[ng-model="$ctrl.localCompanyFk"]',
|
||||
userWarehouse: '.user-popover vn-autocomplete[ng-model="$ctrl.warehouseFk"]',
|
||||
userCompany: '.user-popover vn-autocomplete[ng-model="$ctrl.companyFk"]',
|
||||
userConfigFirstAutocompleteClear: '#localWarehouse .icons > vn-icon[icon=clear]',
|
||||
userConfigSecondAutocompleteClear: '#localBank .icons > vn-icon[icon=clear]',
|
||||
userConfigThirdAutocompleteClear: '#localCompany .icons > vn-icon[icon=clear]',
|
||||
userConfigFirstAutocomplete: '#localWarehouse',
|
||||
userConfigSecondAutocomplete: '#localBank',
|
||||
userConfigThirdAutocomplete: '#localCompany',
|
||||
acceptButton: '.vn-confirm.shown button[response=accept]'
|
||||
},
|
||||
clientsIndex: {
|
||||
searchClientInput: 'vn-topbar [name="searchString"]',
|
||||
searchClientInput: 'vn-topbar',
|
||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||
searchResult: 'vn-client-index .vn-item',
|
||||
createClientButton: `vn-float-button`,
|
||||
othersButton: 'vn-left-menu li[name="Others"] > a'
|
||||
},
|
||||
createClientView: {
|
||||
name: `vn-client-create [name="name"]`,
|
||||
taxNumber: 'vn-client-create [name="fi"]',
|
||||
socialName: 'vn-client-create [name="socialName"]',
|
||||
street: 'vn-client-create [name="street"]',
|
||||
postcode: 'vn-client-create [name="postcode"]',
|
||||
city: 'vn-client-create [name="city"]',
|
||||
name: `vn-client-create [ng-model="$ctrl.client.name"]`,
|
||||
taxNumber: 'vn-client-create [ng-model="$ctrl.client.fi"]',
|
||||
socialName: 'vn-client-create [ng-model="$ctrl.client.socialName"]',
|
||||
street: 'vn-client-create [ng-model="$ctrl.client.street"]',
|
||||
postcode: 'vn-client-create [ng-model="$ctrl.client.postcode"]',
|
||||
city: 'vn-client-create [ng-model="$ctrl.client.city"]',
|
||||
province: `vn-autocomplete[ng-model="$ctrl.client.provinceFk"]`,
|
||||
country: `vn-autocomplete[ng-model="$ctrl.client.countryFk"]`,
|
||||
userName: 'vn-client-create [name="userName"]',
|
||||
email: 'vn-client-create [name="email"]',
|
||||
userName: 'vn-client-create [ng-model="$ctrl.client.userName"]',
|
||||
email: 'vn-client-create [ng-model="$ctrl.client.email"]',
|
||||
salesPersonAutocomplete: `vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]`,
|
||||
createButton: `button[type=submit]`,
|
||||
cancelButton: 'vn-button[href="#!/client/index"]'
|
||||
|
@ -48,24 +48,24 @@ export default {
|
|||
},
|
||||
clientBasicData: {
|
||||
basicDataButton: 'vn-left-menu a[ui-sref="client.card.basicData"]',
|
||||
phoneInput: 'vn-client-basic-data [name="phone"]',
|
||||
mobileInput: 'vn-client-basic-data [name="mobile"]',
|
||||
nameInput: 'vn-textfield[ng-model="$ctrl.client.name"]',
|
||||
contactInput: 'vn-textfield[ng-model="$ctrl.client.contact"]',
|
||||
emailInput: 'vn-textfield[ng-model="$ctrl.client.email"]',
|
||||
nameInput: 'vn-client-basic-data [ng-model="$ctrl.client.name"]',
|
||||
contactInput: 'vn-client-basic-data [ng-model="$ctrl.client.contact"]',
|
||||
phoneInput: 'vn-client-basic-data [ng-model="$ctrl.client.phone"]',
|
||||
mobileInput: 'vn-client-basic-data [ng-model="$ctrl.client.mobile"]',
|
||||
emailInput: 'vn-client-basic-data [ng-model="$ctrl.client.email"]',
|
||||
salesPersonAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]',
|
||||
channelAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.contactChannelFk"]',
|
||||
saveButton: `button[type=submit]`
|
||||
},
|
||||
clientFiscalData: {
|
||||
fiscalDataButton: 'vn-left-menu a[ui-sref="client.card.fiscalData"]',
|
||||
socialNameInput: 'vn-client-fiscal-data [name="socialName"]',
|
||||
fiscalIdInput: 'vn-client-fiscal-data [name="fi"]',
|
||||
socialNameInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.socialName"]',
|
||||
fiscalIdInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.fi"]',
|
||||
equalizationTaxCheckbox: 'vn-check[ng-model="$ctrl.client.isEqualizated"]',
|
||||
acceptPropagationButton: '.vn-confirm.shown button[response=accept]',
|
||||
addressInput: 'vn-client-fiscal-data [name="street"]',
|
||||
postcodeInput: 'vn-client-fiscal-data [name="postcode"]',
|
||||
cityInput: 'vn-client-fiscal-data [name="city"]',
|
||||
addressInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.street"]',
|
||||
postcodeInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.postcode"]',
|
||||
cityInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.city"]',
|
||||
provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.provinceFk"]',
|
||||
countryAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.countryFk"]',
|
||||
activeCheckbox: 'vn-check[label="Active"]',
|
||||
|
@ -80,17 +80,17 @@ export default {
|
|||
},
|
||||
clientBillingData: {
|
||||
payMethodAutocomplete: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.payMethodFk"]',
|
||||
IBANInput: 'vn-client-billing-data [name="iban"]',
|
||||
dueDayInput: 'vn-client-billing-data [name="dueDay"]',
|
||||
IBANInput: 'vn-client-billing-data [ng-model="$ctrl.client.iban"]',
|
||||
dueDayInput: 'vn-client-billing-data [ng-model="$ctrl.client.dueDay"]',
|
||||
receivedCoreLCRCheckbox: 'vn-client-billing-data vn-check[label="Received LCR"]',
|
||||
receivedCoreVNLCheckbox: 'vn-client-billing-data vn-check[label="Received core VNL"]',
|
||||
receivedB2BVNLCheckbox: 'vn-client-billing-data vn-check[label="Received B2B VNL"]',
|
||||
swiftBicAutocomplete: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.bankEntityFk"]',
|
||||
clearswiftBicButton: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.bankEntityFk"] .icons > vn-icon[icon=clear]',
|
||||
newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button',
|
||||
newBankEntityName: '.vn-dialog.shown [name="name"]',
|
||||
newBankEntityBIC: '.vn-dialog.shown [name="bic"]',
|
||||
newBankEntityCode: '.vn-dialog.shown [name="id"]',
|
||||
newBankEntityName: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.name"]',
|
||||
newBankEntityBIC: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.bic"]',
|
||||
newBankEntityCode: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.id"]',
|
||||
acceptBankEntityButton: '.vn-dialog.shown button[response="accept"]',
|
||||
saveButton: `button[type=submit]`,
|
||||
watcher: 'vn-client-billing-data vn-watcher'
|
||||
|
@ -99,14 +99,14 @@ export default {
|
|||
addressesButton: 'vn-left-menu a[ui-sref="client.card.address.index"]',
|
||||
createAddress: `vn-client-address-index vn-float-button`,
|
||||
defaultCheckboxInput: 'vn-check[label="Default"]',
|
||||
consigneeInput: '[name="nickname"]',
|
||||
streetAddressInput: '[name="street"]',
|
||||
postcodeInput: '[name="postalCode"]',
|
||||
cityInput: '[name="city"]',
|
||||
consigneeInput: '[ng-model="$ctrl.address.nickname"]',
|
||||
streetAddressInput: '[ng-model="$ctrl.address.street"]',
|
||||
postcodeInput: '[ng-model="$ctrl.address.postalCode"]',
|
||||
cityInput: '[ng-model="$ctrl.address.city"]',
|
||||
provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.provinceFk"]',
|
||||
agencyAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.agencyModeFk"]',
|
||||
phoneInput: '[name="phone"]',
|
||||
mobileInput: '[name="mobile"]',
|
||||
phoneInput: '[ng-model="$ctrl.address.phone"]',
|
||||
mobileInput: '[ng-model="$ctrl.address.mobile"]',
|
||||
defaultAddress: 'vn-client-address-index div:nth-child(1) div[name="street"]',
|
||||
secondMakeDefaultStar: 'vn-client-address-index vn-card div:nth-child(2) vn-icon-button[icon="star_border"]',
|
||||
firstEditAddress: 'vn-client-address-index div:nth-child(1) > a',
|
||||
|
@ -114,9 +114,9 @@ export default {
|
|||
activeCheckbox: 'vn-check[label="Enabled"]',
|
||||
equalizationTaxCheckbox: 'vn-client-address-edit vn-check[label="Is equalizated"]',
|
||||
firstObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(1) [ng-model="observation.observationTypeFk"]',
|
||||
firstObservationDescriptionInput: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(1) [name="description"]',
|
||||
firstObservationDescriptionInput: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(1) [ng-model="observation.description"]',
|
||||
secondObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(2) [ng-model="observation.observationTypeFk"]',
|
||||
secondObservationDescriptionInput: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(2) [name="description"]',
|
||||
secondObservationDescriptionInput: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(2) [ng-model="observation.description"]',
|
||||
addObservationButton: 'vn-client-address-edit div[name="observations"] vn-icon-button[icon="add_circle"]',
|
||||
saveButton: 'button[type=submit]',
|
||||
cancelCreateAddressButton: 'button[ui-sref="client.card.address.index"]',
|
||||
|
@ -126,25 +126,25 @@ export default {
|
|||
clientWebAccess: {
|
||||
webAccessButton: 'vn-left-menu a[ui-sref="client.card.webAccess"]',
|
||||
enableWebAccessCheckbox: 'vn-check[label="Enable web access"]',
|
||||
userNameInput: 'vn-client-web-access [name="name"]',
|
||||
userNameInput: 'vn-client-web-access [ng-model="$ctrl.account.name"]',
|
||||
saveButton: 'button[type=submit]'
|
||||
},
|
||||
clientNotes: {
|
||||
addNoteFloatButton: 'vn-float-button',
|
||||
noteInput: 'vn-textarea[label="Note"]',
|
||||
noteInput: '[ng-model="$ctrl.note.text"]',
|
||||
saveButton: 'button[type=submit]',
|
||||
firstNoteText: 'vn-client-note .text'
|
||||
},
|
||||
clientCredit: {
|
||||
addCreditFloatButton: 'vn-float-button',
|
||||
creditInput: 'vn-client-credit-create [name="credit"]',
|
||||
creditInput: 'vn-client-credit-create [ng-model="$ctrl.client.credit"]',
|
||||
saveButton: 'button[type=submit]',
|
||||
firstCreditText: 'vn-client-credit-index vn-card vn-table vn-tbody > vn-tr'
|
||||
},
|
||||
clientGreuge: {
|
||||
addGreugeFloatButton: 'vn-float-button',
|
||||
amountInput: 'vn-client-greuge-create [name="amount"]',
|
||||
descriptionInput: 'vn-client-greuge-create [name="description"]',
|
||||
amountInput: 'vn-client-greuge-create [ng-model="$ctrl.greuge.amount"]',
|
||||
descriptionInput: 'vn-client-greuge-create [ng-model="$ctrl.greuge.description"]',
|
||||
typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.greuge.greugeTypeFk"]',
|
||||
saveButton: 'button[type=submit]',
|
||||
firstGreugeText: 'vn-client-greuge-index vn-card vn-table vn-tbody > vn-tr'
|
||||
|
@ -165,9 +165,9 @@ export default {
|
|||
clientBalance: {
|
||||
balanceButton: 'vn-left-menu a[ui-sref="client.card.balance.index"]',
|
||||
companyAutocomplete: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyFk"]',
|
||||
newPaymentButton: `vn-float-button`,
|
||||
newPaymentButton: 'vn-float-button',
|
||||
newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]',
|
||||
newPaymentAmountInput: '.vn-dialog.shown [name="amountPaid"]',
|
||||
newPaymentAmountInput: '.vn-dialog.shown [ng-model="$ctrl.receipt.amountPaid"]',
|
||||
saveButton: '.vn-dialog.shown vn-button[label="Save"]',
|
||||
firstBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)'
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
fdescribe('Login path', async() => {
|
||||
describe('Login path', async() => {
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
|
@ -33,9 +33,7 @@ fdescribe('Login path', async() => {
|
|||
|
||||
it('should log in', async() => {
|
||||
await page.doLogin('employee', 'nightmare');
|
||||
await page.wait(2000);
|
||||
await page.waitToClick('vn-login button[type=submit]');
|
||||
await page.wait('#user');
|
||||
await page.waitForNavigation();
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import selectors from '../../helpers/selectors';
|
||||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
fdescribe('Client create path', async() => {
|
||||
describe('Client create path', async() => {
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
|
@ -109,11 +109,9 @@ fdescribe('Client create path', async() => {
|
|||
});
|
||||
|
||||
it(`should search for the user Carol Danvers to confirm it exists`, async() => {
|
||||
await page.write(selectors.clientsIndex.searchClientInput, 'Carol Danvers');
|
||||
await page.waitToClick(selectors.clientsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.clientsIndex.searchResult);
|
||||
await page.accessToSearchResult('Carol Danvers');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(result).toEqual(1);
|
||||
expect(url.hash).toEqual('#!/client/114/summary');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,8 +6,8 @@ describe('Client Edit basicData path', () => {
|
|||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
await page.loginAndModule('employee', 'client');
|
||||
// await page.accessToSearchResult('Bruce Wayne');
|
||||
// await page.accessToSection('client.card.basicData');
|
||||
await page.accessToSearchResult('Bruce Wayne');
|
||||
await page.accessToSection('client.card.basicData');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
|
@ -16,54 +16,69 @@ describe('Client Edit basicData path', () => {
|
|||
|
||||
describe('as employee', () => {
|
||||
it('should not be able to change the salesPerson', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientBasicData.nameInput)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.clientBasicData.salesPersonAutocomplete} input`);
|
||||
await page.wait(selectors.clientBasicData.nameInput);
|
||||
const result = await page.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.clientBasicData.salesPersonAutocomplete} input`);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should edit the client basic data but leave salesPerson untainted', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientBasicData.nameInput)
|
||||
.write(selectors.clientBasicData.nameInput, 'Ptonomy Wallace')
|
||||
.clearInput(selectors.clientBasicData.contactInput)
|
||||
.write(selectors.clientBasicData.contactInput, 'David Haller')
|
||||
.clearInput(selectors.clientBasicData.emailInput)
|
||||
.write(selectors.clientBasicData.emailInput, 'PWallace@verdnatura.es')
|
||||
.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Rumors on the streets')
|
||||
.waitToClick(selectors.clientBasicData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientBasicData.nameInput);
|
||||
await page.write(selectors.clientBasicData.nameInput, 'Ptonomy Wallace');
|
||||
await page.clearInput(selectors.clientBasicData.contactInput);
|
||||
await page.write(selectors.clientBasicData.contactInput, 'David Haller');
|
||||
await page.clearInput(selectors.clientBasicData.phoneInput);
|
||||
await page.write(selectors.clientBasicData.phoneInput, '987654321');
|
||||
await page.clearInput(selectors.clientBasicData.mobileInput);
|
||||
await page.write(selectors.clientBasicData.mobileInput, '123456789');
|
||||
await page.clearInput(selectors.clientBasicData.emailInput);
|
||||
await page.write(selectors.clientBasicData.emailInput, 'PWallace@verdnatura.es');
|
||||
await page.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Rumors on the streets');
|
||||
await page.waitToClick(selectors.clientBasicData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('client.card.basicData')
|
||||
.waitToGetProperty(selectors.clientBasicData.nameInput, 'value');
|
||||
await page.reloadSection('client.card.basicData');
|
||||
const result = await page.waitToGetProperty(selectors.clientBasicData.nameInput, 'value');
|
||||
|
||||
expect(result).toEqual('Ptonomy Wallace');
|
||||
});
|
||||
|
||||
it('should confirm the contact name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.clientBasicData.contactInput, 'value');
|
||||
|
||||
expect(result).toEqual('David Haller');
|
||||
});
|
||||
|
||||
it('should confirm the landline phone number have been added', async() => {
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.clientBasicData.phoneInput, 'value');
|
||||
|
||||
expect(result).toEqual('987654321');
|
||||
});
|
||||
|
||||
it('should confirm the mobile phone number have been added', async() => {
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.clientBasicData.mobileInput, 'value');
|
||||
|
||||
expect(result).toEqual('123456789');
|
||||
});
|
||||
|
||||
it('should confirm the email have been edited', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.clientBasicData.emailInput, 'value');
|
||||
|
||||
expect(result).toEqual('PWallace@verdnatura.es');
|
||||
});
|
||||
|
||||
it('should confirm the channel have been selected', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.channelAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Rumors on the streets');
|
||||
|
@ -71,70 +86,84 @@ describe('Client Edit basicData path', () => {
|
|||
});
|
||||
|
||||
describe('as salesAssistant', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesASsistant', 'client')
|
||||
.accessToSearchResult('Ptonomy Wallace')
|
||||
.accessToSection('client.card.basicData');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('salesASsistant', 'client');
|
||||
await page.accessToSearchResult('Ptonomy Wallace');
|
||||
await page.accessToSection('client.card.basicData');
|
||||
});
|
||||
|
||||
it('should be able to change the salesPerson', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientBasicData.nameInput)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.clientBasicData.salesPersonAutocomplete} input`);
|
||||
await page.wait(selectors.clientBasicData.nameInput);
|
||||
const result = await page.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.clientBasicData.salesPersonAutocomplete} input`);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should edit the client basic data including salesPerson', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientBasicData.nameInput)
|
||||
.write(selectors.clientBasicData.nameInput, 'Ororo Munroe')
|
||||
.clearInput(selectors.clientBasicData.contactInput)
|
||||
.write(selectors.clientBasicData.contactInput, 'Black Panther')
|
||||
.clearInput(selectors.clientBasicData.emailInput)
|
||||
.write(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es')
|
||||
.autocompleteSearch(selectors.clientBasicData.salesPersonAutocomplete, 'replenisherNick')
|
||||
.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Metropolis newspaper')
|
||||
.waitToClick(selectors.clientBasicData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientBasicData.nameInput);
|
||||
await page.write(selectors.clientBasicData.nameInput, 'Ororo Munroe');
|
||||
await page.clearInput(selectors.clientBasicData.contactInput);
|
||||
await page.write(selectors.clientBasicData.contactInput, 'Black Panther');
|
||||
await page.clearInput(selectors.clientBasicData.phoneInput);
|
||||
await page.write(selectors.clientBasicData.phoneInput, '123456789');
|
||||
await page.clearInput(selectors.clientBasicData.mobileInput);
|
||||
await page.write(selectors.clientBasicData.mobileInput, '987654321');
|
||||
await page.clearInput(selectors.clientBasicData.emailInput);
|
||||
await page.write(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es');
|
||||
await page.autocompleteSearch(selectors.clientBasicData.salesPersonAutocomplete, 'replenisherNick');
|
||||
await page.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Metropolis newspaper');
|
||||
await page.waitToClick(selectors.clientBasicData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should now confirm the name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('client.card.basicData')
|
||||
.waitToGetProperty(selectors.clientBasicData.nameInput, 'value');
|
||||
await page.reloadSection('client.card.basicData');
|
||||
const result = await page.waitToGetProperty(selectors.clientBasicData.nameInput, 'value');
|
||||
|
||||
expect(result).toEqual('Ororo Munroe');
|
||||
});
|
||||
|
||||
it('should now confirm the contact name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.clientBasicData.contactInput, 'value');
|
||||
|
||||
expect(result).toEqual('Black Panther');
|
||||
});
|
||||
|
||||
it('should now confirm the landline phone number have been added', async() => {
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.clientBasicData.phoneInput, 'value');
|
||||
|
||||
expect(result).toEqual('123456789');
|
||||
});
|
||||
|
||||
it('should now confirm the mobile phone number have been added', async() => {
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.clientBasicData.mobileInput, 'value');
|
||||
|
||||
expect(result).toEqual('987654321');
|
||||
});
|
||||
|
||||
it('should now confirm the email have been edited', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.clientBasicData.emailInput, 'value');
|
||||
|
||||
expect(result).toEqual('Storm@verdnatura.es');
|
||||
});
|
||||
|
||||
it('should confirm the sales person have been selected', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.salesPersonAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('replenisherNick');
|
||||
});
|
||||
|
||||
it('should now confirm the channel have been selected', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.channelAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Metropolis newspaper');
|
||||
|
|
|
@ -2,313 +2,284 @@ import selectors from '../../helpers/selectors.js';
|
|||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Edit fiscalData path', () => {
|
||||
const nightmare = createNightmare();
|
||||
describe('as employee', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.address.index');
|
||||
});
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.address.index');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
page.close();
|
||||
});
|
||||
|
||||
describe('as employee', () => {
|
||||
// Confirms all addresses have EQtax false for future propagation test step 1
|
||||
it(`should click on the 1st edit icon to check EQtax isnt checked`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||
const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
// Confirms all addresses have EQtax false for future propagation test step 2
|
||||
it(`should go back to addresses then select the second one and confirm the EQtax isnt checked`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitToClick(selectors.clientAddresses.secondEditAddress)
|
||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.addressesButton);
|
||||
await page.waitToClick(selectors.clientAddresses.secondEditAddress);
|
||||
const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it(`should click on the fiscal data button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.waitForURL('fiscal-data')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientFiscalData.fiscalDataButton);
|
||||
await page.waitForURL('fiscal-data');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('fiscal-data');
|
||||
});
|
||||
|
||||
it('should not be able to edit the verified data checkbox', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.verifiedDataCheckbox)
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
await page.wait(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('as administrative', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('administrative', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it(`should edit the fiscal data but fail as the fiscal id ain't valid`, async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'SMASH')
|
||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
||||
.write(selectors.clientFiscalData.fiscalIdInput, 'INVALID!')
|
||||
.clearInput(selectors.clientFiscalData.addressInput)
|
||||
.write(selectors.clientFiscalData.addressInput, 'Somewhere edited')
|
||||
.autocompleteSearch(selectors.clientFiscalData.countryAutocomplete, 'España')
|
||||
.autocompleteSearch(selectors.clientFiscalData.provinceAutocomplete, 'Province one')
|
||||
.clearInput(selectors.clientFiscalData.cityInput)
|
||||
.write(selectors.clientFiscalData.cityInput, 'Valencia')
|
||||
.clearInput(selectors.clientFiscalData.postcodeInput)
|
||||
.write(selectors.clientFiscalData.postcodeInput, '46000')
|
||||
.waitToClick(selectors.clientFiscalData.activeCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.frozenCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.hasToInvoiceCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.viesCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.invoiceByMailCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.wait(selectors.clientFiscalData.socialNameInput);
|
||||
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||
await page.write(selectors.clientFiscalData.socialNameInput, 'SMASH');
|
||||
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);
|
||||
await page.write(selectors.clientFiscalData.fiscalIdInput, 'INVALID!');
|
||||
await page.clearInput(selectors.clientFiscalData.addressInput);
|
||||
await page.write(selectors.clientFiscalData.addressInput, 'Somewhere edited');
|
||||
await page.autocompleteSearch(selectors.clientFiscalData.countryAutocomplete, 'España');
|
||||
await page.autocompleteSearch(selectors.clientFiscalData.provinceAutocomplete, 'Province one');
|
||||
await page.clearInput(selectors.clientFiscalData.cityInput);
|
||||
await page.write(selectors.clientFiscalData.cityInput, 'Valencia');
|
||||
await page.clearInput(selectors.clientFiscalData.postcodeInput);
|
||||
await page.write(selectors.clientFiscalData.postcodeInput, '46000');
|
||||
await page.waitToClick(selectors.clientFiscalData.activeCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.frozenCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.hasToInvoiceCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.viesCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.invoiceByMailCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Invalid Tax number');
|
||||
});
|
||||
|
||||
it(`should edit the fiscal this time with a valid fiscal id`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
||||
.write(selectors.clientFiscalData.fiscalIdInput, '94980061C')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);
|
||||
await page.write(selectors.clientFiscalData.fiscalIdInput, '94980061C');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should propagate the Equalization tax', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.acceptPropagationButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientFiscalData.acceptPropagationButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Equivalent tax spreaded');
|
||||
});
|
||||
|
||||
it('should receive an error if the fiscal id contains A or B at the beginning', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.viesCheckbox)
|
||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
||||
.write(selectors.clientFiscalData.fiscalIdInput, 'A94980061C')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientFiscalData.viesCheckbox);
|
||||
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);
|
||||
await page.write(selectors.clientFiscalData.fiscalIdInput, 'A94980061C');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Cannot check Equalization Tax in this NIF/CIF');
|
||||
});
|
||||
|
||||
it('should finally edit the fixcal data correctly as VIES isnt checked and fiscal id is valid for EQtax', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
||||
.write(selectors.clientFiscalData.fiscalIdInput, '94980061C')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);
|
||||
await page.write(selectors.clientFiscalData.fiscalIdInput, '94980061C');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
// confirm all addresses have now EQtax checked step 1
|
||||
it(`should click on the addresses button to access to the client's addresses`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitForURL('/address/index')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientAddresses.addressesButton);
|
||||
await page.waitForURL('/address/index');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/address/index');
|
||||
});
|
||||
|
||||
// confirm all addresses have now EQtax checked step 2
|
||||
it(`should click on the 1st edit icon to confirm EQtax is checked`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.waitForWatcherData(selectors.clientAddresses.watcher)
|
||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||
await page.waitForWatcherData(selectors.clientAddresses.watcher);
|
||||
const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
// confirm all addresses have now EQtax checked step 3
|
||||
it(`should go back to addresses then select the second one and confirm the EQtax is checked`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitToClick(selectors.clientAddresses.secondEditAddress)
|
||||
.waitForWatcherData(selectors.clientAddresses.watcher)
|
||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.addressesButton);
|
||||
await page.waitToClick(selectors.clientAddresses.secondEditAddress);
|
||||
await page.waitForWatcherData(selectors.clientAddresses.watcher);
|
||||
const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
it('should navigate back to fiscal data and uncheck EQtax then check VIES', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.waitToClick(selectors.clientFiscalData.viesCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientFiscalData.fiscalDataButton);
|
||||
await page.waitToClick(selectors.clientFiscalData.viesCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should propagate the Equalization tax changes', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.acceptPropagationButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientFiscalData.acceptPropagationButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Equivalent tax spreaded');
|
||||
});
|
||||
|
||||
it('should confirm its name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
await page.waitToClick(selectors.clientFiscalData.fiscalDataButton);
|
||||
const result = await page.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
|
||||
expect(result).toEqual('SMASH');
|
||||
});
|
||||
|
||||
it('should confirm the fiscal id have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientFiscalData.fiscalIdInput, 'value');
|
||||
const result = await page.waitToGetProperty(selectors.clientFiscalData.fiscalIdInput, 'value');
|
||||
|
||||
expect(result).toEqual('94980061C');
|
||||
});
|
||||
|
||||
it('should confirm the address have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientFiscalData.addressInput, 'value');
|
||||
const result = await page.waitToGetProperty(selectors.clientFiscalData.addressInput, 'value');
|
||||
|
||||
expect(result).toEqual('Somewhere edited');
|
||||
});
|
||||
|
||||
it('should confirm the postcode have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientFiscalData.postcodeInput}`, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.postcodeInput}`, 'value');
|
||||
|
||||
expect(result).toContain('46000');
|
||||
});
|
||||
|
||||
it('should confirm the city have been autocompleted', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientFiscalData.cityInput}`, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.cityInput}`, 'value');
|
||||
|
||||
expect(result).toEqual('Valencia');
|
||||
});
|
||||
|
||||
|
||||
it(`should confirm the province have been autocompleted`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientFiscalData.provinceAutocomplete} input`, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.provinceAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Province one');
|
||||
});
|
||||
|
||||
it('should confirm the country have been autocompleted', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientFiscalData.countryAutocomplete} input`, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.countryAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('España');
|
||||
});
|
||||
|
||||
it('should confirm active checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.activeCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.activeCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm frozen checkbox is checked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.frozenCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.frozenCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
it('should confirm Has to invoice checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.hasToInvoiceCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.hasToInvoiceCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm Vies checkbox is checked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.viesCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.viesCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
it('should confirm Invoice by mail checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.invoiceByMailCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.invoiceByMailCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm invoice by address checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm Equalization tax checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.equalizationTaxCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm Verified data checkbox is checked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 1
|
||||
it(`should click on the addresses button to access to the client's addresses`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitForURL('/address/index')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientAddresses.addressesButton);
|
||||
await page.waitForURL('/address/index');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/address/index');
|
||||
});
|
||||
|
||||
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 2
|
||||
it(`should click on the 1st edit icon to access the address details and uncheck EQtax checkbox`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.waitForTextInInput(selectors.clientAddresses.cityInput, 'Silla')
|
||||
.waitToClick(selectors.clientAddresses.equalizationTaxCheckbox)
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||
await page.waitForTextInInput(selectors.clientAddresses.cityInput, 'Silla');
|
||||
await page.waitToClick(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 3
|
||||
it('should navigate back to fiscal data to confirm invoice by address is now checked', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.waitForWatcherData(selectors.clientFiscalData.watcher)
|
||||
.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.fiscalDataButton);
|
||||
await page.waitForWatcherData(selectors.clientFiscalData.watcher);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
|
|
@ -2,120 +2,101 @@ import selectors from '../../helpers/selectors.js';
|
|||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Edit billing data path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
await page.loginAndModule('administrative', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.billingData');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.billingData');
|
||||
afterAll(async() => {
|
||||
page.close();
|
||||
});
|
||||
|
||||
it(`should attempt to edit the billing data without an IBAN but fail`, async() => {
|
||||
const snackbarMessage = await nightmare
|
||||
.autocompleteSearch(selectors.clientBillingData.payMethodAutocomplete, 'PayMethod with IBAN')
|
||||
.autocompleteSearch(selectors.clientBillingData.swiftBicAutocomplete, 'BBKKESMMMMM')
|
||||
.clearInput(selectors.clientBillingData.dueDayInput)
|
||||
.write(selectors.clientBillingData.dueDayInput, '60')
|
||||
.waitForTextInInput(selectors.clientBillingData.dueDayInput, '60')
|
||||
.waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox)
|
||||
.waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox)
|
||||
.waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox)
|
||||
.waitToClick(selectors.clientBillingData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.clientBillingData.payMethodAutocomplete, 'PayMethod with IBAN');
|
||||
await page.autocompleteSearch(selectors.clientBillingData.swiftBicAutocomplete, 'BBKKESMMMMM');
|
||||
await page.clearInput(selectors.clientBillingData.dueDayInput);
|
||||
await page.write(selectors.clientBillingData.dueDayInput, '60');
|
||||
await page.waitForTextInInput(selectors.clientBillingData.dueDayInput, '60');
|
||||
await page.waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox);
|
||||
await page.waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox);
|
||||
await page.waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox);
|
||||
await page.waitToClick(selectors.clientBillingData.saveButton);
|
||||
let snackbarMessage = await page.waitForLastSnackbar();
|
||||
|
||||
expect(snackbarMessage).toEqual('That payment method requires an IBAN');
|
||||
});
|
||||
|
||||
it(`should add the IBAN but fail as it requires a BIC code`, async() => {
|
||||
const snackbarMessage = await nightmare
|
||||
.waitToClick(selectors.clientBillingData.clearswiftBicButton)
|
||||
.clearInput(selectors.clientBillingData.IBANInput)
|
||||
.write(selectors.clientBillingData.IBANInput, 'FR9121000418450200051332')
|
||||
.waitForTextInInput(selectors.clientBillingData.IBANInput, 'FR9121000418450200051332')
|
||||
.wait(1000)
|
||||
.waitToClick(selectors.clientBillingData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(snackbarMessage).toEqual('That payment method requires a BIC');
|
||||
});
|
||||
|
||||
it(`should create a new BIC code`, async() => {
|
||||
const newcode = await nightmare
|
||||
.waitToClick(selectors.clientBillingData.newBankEntityButton)
|
||||
.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank')
|
||||
.write(selectors.clientBillingData.newBankEntityCode, 9999)
|
||||
.write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT')
|
||||
.waitToClick(selectors.clientBillingData.acceptBankEntityButton)
|
||||
.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
await page.waitToClick(selectors.clientBillingData.newBankEntityButton);
|
||||
await page.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank');
|
||||
await page.write(selectors.clientBillingData.newBankEntityCode, '9999');
|
||||
await page.write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT');
|
||||
await page.waitToClick(selectors.clientBillingData.acceptBankEntityButton);
|
||||
await page.waitForTextInInput(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'Gotham City Bank');
|
||||
let newcode = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
|
||||
expect(newcode).toEqual('GTHMCT Gotham City Bank');
|
||||
});
|
||||
|
||||
it(`should confirm the IBAN pay method is sucessfully saved`, async() => {
|
||||
const payMethod = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientBillingData.payMethodAutocomplete} input`, 'value');
|
||||
it(`should confirm the IBAN pay method was sucessfully saved`, async() => {
|
||||
let payMethod = await page.waitToGetProperty(`${selectors.clientBillingData.payMethodAutocomplete} input`, 'value');
|
||||
|
||||
expect(payMethod).toEqual('PayMethod with IBAN');
|
||||
});
|
||||
|
||||
it(`should clear the BIC code field, update the IBAN to see how he BIC code autocompletes`, async() => {
|
||||
const AutomaticCode = await nightmare
|
||||
.clearInput(selectors.clientBillingData.IBANInput)
|
||||
.write(selectors.clientBillingData.IBANInput, 'ES9121000418450200051332')
|
||||
.waitForTextInInput(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'caixesbb')
|
||||
.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
await page.write(selectors.clientBillingData.IBANInput, 'ES9121000418450200051332');
|
||||
await page.keyboard.press('Tab');
|
||||
await page.keyboard.press('Tab');
|
||||
await page.waitForTextInInput(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'caixesbb');
|
||||
let automaticCode = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
|
||||
expect(AutomaticCode).toEqual('CAIXESBB Caixa Bank');
|
||||
expect(automaticCode).toEqual('CAIXESBB Caixa Bank');
|
||||
});
|
||||
|
||||
it(`should save the form with all its new data`, async() => {
|
||||
const snackbarMessages = await nightmare
|
||||
.waitForWatcherData(selectors.clientBillingData.watcher)
|
||||
.waitToClick(selectors.clientBillingData.saveButton)
|
||||
.waitForSnackbar();
|
||||
await page.waitForWatcherData(selectors.clientBillingData.watcher);
|
||||
await page.waitToClick(selectors.clientBillingData.saveButton);
|
||||
let snackbarMessage = await page.waitForLastSnackbar();
|
||||
|
||||
expect(snackbarMessages).toEqual(jasmine.arrayContaining(['Data saved!']));
|
||||
expect(snackbarMessage).toEqual('Notification sent!');
|
||||
});
|
||||
|
||||
it('should confirm the due day have been edited', async() => {
|
||||
const dueDate = await nightmare
|
||||
.waitToGetProperty(selectors.clientBillingData.dueDayInput, 'value');
|
||||
let dueDate = await page.waitToGetProperty(selectors.clientBillingData.dueDayInput, 'value');
|
||||
|
||||
expect(dueDate).toEqual('60');
|
||||
});
|
||||
|
||||
it('should confirm the IBAN was saved', async() => {
|
||||
const IBAN = await nightmare
|
||||
.waitToGetProperty(selectors.clientBillingData.IBANInput, 'value');
|
||||
let IBAN = await page.waitToGetProperty(selectors.clientBillingData.IBANInput, 'value');
|
||||
|
||||
expect(IBAN).toEqual('ES9121000418450200051332');
|
||||
});
|
||||
|
||||
it('should confirm the swift / BIC code was saved', async() => {
|
||||
const code = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
let code = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
|
||||
expect(code).toEqual('CAIXESBB Caixa Bank');
|
||||
});
|
||||
|
||||
it('should confirm Received LCR checkbox is checked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox);
|
||||
let result = await page.checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
it('should confirm Received core VNL checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientBillingData.receivedCoreVNLCheckbox);
|
||||
let result = await page.checkboxState(selectors.clientBillingData.receivedCoreVNLCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm Received B2B VNL checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox);
|
||||
let result = await page.checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
|
|
@ -2,118 +2,108 @@ import selectors from '../../helpers/selectors.js';
|
|||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Add address path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.address.index');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.address.index');
|
||||
afterAll(async() => {
|
||||
page.close();
|
||||
});
|
||||
|
||||
it(`should click on the add new address button to access to the new address form`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.createAddress)
|
||||
.waitForURL('address/create')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientAddresses.createAddress);
|
||||
await page.waitForURL('address/create');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('address/create');
|
||||
});
|
||||
|
||||
it('should receive an error after clicking save button as consignee, street and town fields are empty', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.defaultCheckboxInput)
|
||||
.clearInput(selectors.clientAddresses.streetAddressInput)
|
||||
.autocompleteSearch(selectors.clientAddresses.provinceAutocomplete, 'Province one')
|
||||
.clearInput(selectors.clientAddresses.cityInput)
|
||||
.write(selectors.clientAddresses.cityInput, 'Valencia')
|
||||
.clearInput(selectors.clientAddresses.postcodeInput)
|
||||
.write(selectors.clientAddresses.postcodeInput, '46000')
|
||||
.autocompleteSearch(selectors.clientAddresses.agencyAutocomplete, 'Entanglement')
|
||||
.write(selectors.clientAddresses.phoneInput, '999887744')
|
||||
.write(selectors.clientAddresses.mobileInput, '999887744')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientAddresses.defaultCheckboxInput);
|
||||
await page.clearInput(selectors.clientAddresses.streetAddressInput);
|
||||
await page.autocompleteSearch(selectors.clientAddresses.provinceAutocomplete, 'Province one');
|
||||
await page.clearInput(selectors.clientAddresses.cityInput);
|
||||
await page.write(selectors.clientAddresses.cityInput, 'Valencia');
|
||||
await page.clearInput(selectors.clientAddresses.postcodeInput);
|
||||
await page.write(selectors.clientAddresses.postcodeInput, '46000');
|
||||
await page.autocompleteSearch(selectors.clientAddresses.agencyAutocomplete, 'Entanglement');
|
||||
await page.write(selectors.clientAddresses.phoneInput, '999887744');
|
||||
await page.write(selectors.clientAddresses.mobileInput, '999887744');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it('should confirm the postcode have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientAddresses.postcodeInput}`, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientAddresses.postcodeInput}`, 'value');
|
||||
|
||||
expect(result).toContain('46000');
|
||||
});
|
||||
|
||||
it('should confirm the city have been autocompleted', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientAddresses.cityInput}`, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientAddresses.cityInput}`, 'value');
|
||||
|
||||
expect(result).toEqual('Valencia');
|
||||
});
|
||||
|
||||
|
||||
it(`should confirm the province have been autocompleted`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientAddresses.provinceAutocomplete} input`, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientAddresses.provinceAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Province one');
|
||||
});
|
||||
|
||||
it(`should create a new address with all it's data`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.clientAddresses.consigneeInput, 'Bruce Bunner')
|
||||
.write(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York')
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.clientAddresses.consigneeInput, 'Bruce Bunner');
|
||||
await page.write(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York');
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should click on the addresses button confirm the new address exists and it's the default one`, async() => {
|
||||
const result = await nightmare
|
||||
// .waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
||||
|
||||
expect(result).toContain('320 Park Avenue New York');
|
||||
});
|
||||
|
||||
it(`should click on the make default icon of the second address then confirm it is the default one now`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.secondMakeDefaultStar)
|
||||
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
|
||||
.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
||||
await page.waitToClick(selectors.clientAddresses.secondMakeDefaultStar);
|
||||
await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand');
|
||||
const result = await page.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
||||
|
||||
expect(result).toContain('Somewhere in Thailand');
|
||||
});
|
||||
|
||||
it(`should click on the edit icon of the default address`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.waitForURL('/edit')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand');
|
||||
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||
await page.waitForURL('/edit');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/edit');
|
||||
});
|
||||
|
||||
it(`should click on the active checkbox and receive an error to save it because it is the default address`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForWatcherData(selectors.clientAddresses.watcher)
|
||||
.waitToClick(selectors.clientAddresses.activeCheckbox)
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForWatcherData(selectors.clientAddresses.watcher);
|
||||
await page.waitToClick(selectors.clientAddresses.activeCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('The default consignee can not be unchecked');
|
||||
});
|
||||
|
||||
// this "it" should be removed if the watcher doesn't prevent the navigation upon state changes
|
||||
it(`should go back to the addreses section by clicking the cancel button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.cancelEditAddressButton)
|
||||
.waitToClick('.vn-confirm.shown button[response="accept"]')
|
||||
.waitForURL('address/index')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientAddresses.cancelEditAddressButton);
|
||||
await page.waitToClick('.vn-confirm.shown button[response="accept"]');
|
||||
await page.waitForURL('address/index');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('address/index');
|
||||
});
|
||||
|
|
|
@ -2,53 +2,52 @@ import selectors from '../../helpers/selectors.js';
|
|||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client add address notes path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Petter Parker');
|
||||
await page.accessToSection('client.card.address.index');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Petter Parker')
|
||||
.accessToSection('client.card.address.index');
|
||||
afterAll(async() => {
|
||||
page.close();
|
||||
});
|
||||
|
||||
it(`should click on the edit icon of the default address`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street')
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.waitForURL('/edit')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street');
|
||||
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||
await page.waitForURL('/edit');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/edit');
|
||||
});
|
||||
|
||||
it('should not save a description without observation type', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addObservationButton)
|
||||
.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientAddresses.addObservationButton);
|
||||
await page.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description');
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it('should not save an observation type without description', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientAddresses.firstObservationDescriptionInput)
|
||||
.autocompleteSearch(selectors.clientAddresses.firstObservationTypeAutocomplete, 'comercial')
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientAddresses.firstObservationDescriptionInput);
|
||||
await page.autocompleteSearch(selectors.clientAddresses.firstObservationTypeAutocomplete, 'comercial');
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it('should create two new observations', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
|
||||
.waitToClick(selectors.clientAddresses.addObservationButton)
|
||||
.autocompleteSearch(selectors.clientAddresses.secondObservationTypeAutocomplete, 'observation one')
|
||||
.write(selectors.clientAddresses.secondObservationDescriptionInput, 'second description')
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description');
|
||||
await page.waitToClick(selectors.clientAddresses.addObservationButton);
|
||||
await page.autocompleteSearch(selectors.clientAddresses.secondObservationTypeAutocomplete, 'observation one');
|
||||
await page.write(selectors.clientAddresses.secondObservationDescriptionInput, 'second description');
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
|
|
@ -2,40 +2,40 @@ import selectors from '../../helpers/selectors.js';
|
|||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Edit web access path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.webAccess');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.webAccess');
|
||||
afterAll(async() => {
|
||||
page.close();
|
||||
});
|
||||
|
||||
it(`should uncheck the Enable web access checkbox and update the name`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox)
|
||||
.clearInput(selectors.clientWebAccess.userNameInput)
|
||||
.write(selectors.clientWebAccess.userNameInput, 'Hulk')
|
||||
.waitToClick(selectors.clientWebAccess.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox);
|
||||
await page.clearInput(selectors.clientWebAccess.userNameInput);
|
||||
await page.write(selectors.clientWebAccess.userNameInput, 'Hulk');
|
||||
await page.waitToClick(selectors.clientWebAccess.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm web access is now unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientBasicData.basicDataButton)
|
||||
.wait(selectors.clientBasicData.nameInput)
|
||||
.waitToClick(selectors.clientsIndex.othersButton)
|
||||
.waitToClick(selectors.clientWebAccess.webAccessButton)
|
||||
.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox);
|
||||
await page.waitToClick(selectors.clientBasicData.basicDataButton);
|
||||
await page.wait(selectors.clientBasicData.nameInput);
|
||||
await page.waitToClick(selectors.clientsIndex.othersButton);
|
||||
await page.waitToClick(selectors.clientWebAccess.webAccessButton);
|
||||
const result = await page.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm web access name have been updated', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientWebAccess.userNameInput, 'value');
|
||||
const result = await page.waitToGetProperty(selectors.clientWebAccess.userNameInput, 'value');
|
||||
|
||||
expect(result).toEqual('Hulk');
|
||||
});
|
||||
|
|
|
@ -2,36 +2,36 @@ import selectors from '../../helpers/selectors.js';
|
|||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Add notes path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.note.index');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.note.index');
|
||||
afterAll(async() => {
|
||||
page.close();
|
||||
});
|
||||
|
||||
it(`should click on the add note button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientNotes.addNoteFloatButton)
|
||||
.waitForURL('/note/create')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientNotes.addNoteFloatButton);
|
||||
await page.waitForURL('/note/create');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/note/create');
|
||||
});
|
||||
|
||||
it(`should create a note`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.clientNotes.noteInput, 'Meeting with Black Widow 21st 9am')
|
||||
.waitToClick(selectors.clientNotes.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.clientNotes.noteInput, 'Meeting with Black Widow 21st 9am');
|
||||
await page.waitToClick(selectors.clientNotes.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the note was created', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientNotes.firstNoteText, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.clientNotes.firstNoteText, 'innerText');
|
||||
|
||||
expect(result).toEqual('Meeting with Black Widow 21st 9am');
|
||||
});
|
||||
|
|
|
@ -2,37 +2,37 @@ import selectors from '../../helpers/selectors.js';
|
|||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Add credit path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
await page.loginAndModule('salesAssistant', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.credit.index');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesAssistant', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.credit.index');
|
||||
afterAll(async() => {
|
||||
page.close();
|
||||
});
|
||||
|
||||
it(`should click on the add credit button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientCredit.addCreditFloatButton)
|
||||
.waitForURL('/credit/create')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientCredit.addCreditFloatButton);
|
||||
await page.waitForURL('/credit/create');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/credit/create');
|
||||
});
|
||||
|
||||
it(`should edit the credit`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientCredit.creditInput)
|
||||
.write(selectors.clientCredit.creditInput, 999)
|
||||
.waitToClick(selectors.clientCredit.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientCredit.creditInput);
|
||||
await page.write(selectors.clientCredit.creditInput, '999');
|
||||
await page.waitToClick(selectors.clientCredit.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the credit was updated', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText');
|
||||
|
||||
expect(result).toContain(999);
|
||||
expect(result).toContain('salesAssistant');
|
||||
|
|
|
@ -2,47 +2,46 @@ import selectors from '../../helpers/selectors.js';
|
|||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Add greuge path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
await page.loginAndModule('salesAssistant', 'client');
|
||||
await page.accessToSearchResult('Petter Parker');
|
||||
await page.accessToSection('client.card.greuge.index');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesAssistant', 'client')
|
||||
.accessToSearchResult('Petter Parker')
|
||||
.accessToSection('client.card.greuge.index');
|
||||
afterAll(async() => {
|
||||
page.close();
|
||||
});
|
||||
|
||||
it(`should click on the add greuge button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientGreuge.addGreugeFloatButton)
|
||||
.waitForURL('greuge/create')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientGreuge.addGreugeFloatButton);
|
||||
await page.waitForURL('greuge/create');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('greuge/create');
|
||||
});
|
||||
|
||||
it(`should receive an error if all fields are empty but date and type on submit`, async() => {
|
||||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.clientGreuge.typeAutocomplete, 'Diff')
|
||||
.waitToClick(selectors.clientGreuge.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.clientGreuge.typeAutocomplete, 'Diff');
|
||||
await page.waitToClick(selectors.clientGreuge.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it(`should create a new greuge with all its data`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.clientGreuge.amountInput, 999)
|
||||
.waitForTextInInput(selectors.clientGreuge.amountInput, '999')
|
||||
.write(selectors.clientGreuge.descriptionInput, 'new armor for Batman!')
|
||||
.waitToClick(selectors.clientGreuge.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.clientGreuge.amountInput, '999');
|
||||
await page.waitForTextInInput(selectors.clientGreuge.amountInput, '999');
|
||||
await page.write(selectors.clientGreuge.descriptionInput, 'new armor for Batman!');
|
||||
await page.waitToClick(selectors.clientGreuge.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the greuge was added to the list', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText');
|
||||
|
||||
expect(result).toContain(999);
|
||||
expect(result).toContain('new armor for Batman!');
|
||||
|
|
|
@ -2,17 +2,20 @@ import selectors from '../../helpers/selectors.js';
|
|||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client mandate path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
await page.loginAndModule('salesPerson', 'client');
|
||||
await page.accessToSearchResult('Petter Parker');
|
||||
await page.accessToSection('client.card.mandate');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'client')
|
||||
.accessToSearchResult('Petter Parker')
|
||||
.accessToSection('client.card.mandate');
|
||||
afterAll(async() => {
|
||||
page.close();
|
||||
});
|
||||
|
||||
it('should confirm the client has a mandate of the CORE type', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.clientMandate.firstMandateText, 'innerText');
|
||||
|
||||
expect(result).toContain('1');
|
||||
|
|
|
@ -2,179 +2,164 @@ import selectors from '../../helpers/selectors.js';
|
|||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client lock verified data path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
await page.loginAndModule('salesPerson', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
page.close();
|
||||
});
|
||||
|
||||
describe('as salesPerson', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it('should confirm verified data button is disabled for salesPerson', async() => {
|
||||
const result = await nightmare
|
||||
.wait(200)
|
||||
.wait(selectors.clientFiscalData.verifiedDataCheckbox)
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
await page.wait(200);
|
||||
await page.wait(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should edit the social name', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'Captain America Civil War')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.wait(selectors.clientFiscalData.socialNameInput);
|
||||
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||
await page.write(selectors.clientFiscalData.socialNameInput, 'Captain America Civil War');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the social name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('client.card.fiscalData')
|
||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
await page.reloadSection('client.card.fiscalData');
|
||||
const result = await page.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
|
||||
expect(result).toEqual('Captain America Civil War');
|
||||
});
|
||||
});
|
||||
|
||||
describe('as administrative', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('administrative', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it('should confirm verified data button is enabled for administrative', async() => {
|
||||
const result = await nightmare
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should check the Verified data checkbox', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm Verified data checkbox is checked', async() => {
|
||||
const isChecked = await nightmare
|
||||
.reloadSection('client.card.fiscalData')
|
||||
.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
await page.reloadSection('client.card.fiscalData');
|
||||
const isChecked = await page.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(isChecked).toEqual('checked');
|
||||
});
|
||||
|
||||
it('should again edit the social name', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'Ant man and the Wasp')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.wait(selectors.clientFiscalData.socialNameInput);
|
||||
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||
await page.write(selectors.clientFiscalData.socialNameInput, 'Ant man and the Wasp');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should again confirm the social name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('client.card.fiscalData')
|
||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
await page.reloadSection('client.card.fiscalData');
|
||||
const result = await page.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
|
||||
expect(result).toEqual('Ant man and the Wasp');
|
||||
});
|
||||
});
|
||||
|
||||
describe('as salesPerson second run', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('salesPerson', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it('should confirm verified data button is disabled once again for salesPerson', async() => {
|
||||
const isDisabled = await nightmare
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(isDisabled).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should not be able to save change throwing a verified data error', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'This wont happen')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||
await page.write(selectors.clientFiscalData.socialNameInput, 'This wont happen');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(jasmine.arrayContaining([`You can't make changes on a client with verified data`]));
|
||||
});
|
||||
});
|
||||
|
||||
describe('as salesAssistant', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.forceReloadSection('client.card.fiscalData')
|
||||
.loginAndModule('salesAssistant', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
beforeAll(async() => {
|
||||
await page.forceReloadSection('client.card.fiscalData');
|
||||
await page.loginAndModule('salesAssistant', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it('should confirm verified data button is enabled for salesAssistant', async() => {
|
||||
const isDisabled = await nightmare
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(isDisabled).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should now edit the social name', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'new social name edition')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||
await page.write(selectors.clientFiscalData.socialNameInput, 'new social name edition');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should now confirm the social name have been edited once and for all', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('client.card.fiscalData')
|
||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
await page.reloadSection('client.card.fiscalData');
|
||||
const result = await page.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
|
||||
expect(result).toEqual('new social name edition');
|
||||
});
|
||||
});
|
||||
|
||||
describe('as salesPerson third run', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('salesPerson', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it('should confirm verified data button is enabled once again', async() => {
|
||||
const isDisabled = await nightmare
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const isDisabled = await page;
|
||||
await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(isDisabled).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should confirm the form is enabled for salesPerson', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, 'vn-textfield[ng-model="$ctrl.client.socialName"] > div');
|
||||
await page.wait(selectors.clientFiscalData.socialNameInput);
|
||||
const result = await page.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, 'vn-textfield[ng-model="$ctrl.client.socialName"] > div');
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
|
|
@ -2,47 +2,48 @@ import selectors from '../../helpers/selectors.js';
|
|||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client log path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('DavidCharlesHaller');
|
||||
await page.accessToSection('client.card.basicData');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('DavidCharlesHaller')
|
||||
.accessToSection('client.card.basicData');
|
||||
afterAll(async() => {
|
||||
page.close();
|
||||
});
|
||||
|
||||
it('should update the clients name', async() => {
|
||||
let result = await nightmare
|
||||
.clearInput(selectors.clientBasicData.nameInput)
|
||||
.write(selectors.clientBasicData.nameInput, 'this is a test')
|
||||
.waitToClick(selectors.clientBasicData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientBasicData.nameInput);
|
||||
await page.write(selectors.clientBasicData.nameInput, 'this is a test');
|
||||
await page.waitToClick(selectors.clientBasicData.saveButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should navigate to the log section', async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.clientLog.logButton)
|
||||
.waitForURL('log')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientLog.logButton);
|
||||
await page.waitForURL('log');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('log');
|
||||
});
|
||||
|
||||
it('should check the previous value of the last logged change', async() => {
|
||||
let lastModificationPreviousValue = await nightmare
|
||||
let lastModificationPreviousValue = await page
|
||||
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
|
||||
|
||||
expect(lastModificationPreviousValue).toContain('DavidCharlesHaller');
|
||||
});
|
||||
|
||||
it('should check the current value of the last logged change', async() => {
|
||||
let lastModificationPreviousValue = await nightmare
|
||||
let lastModificationPreviousValue = await page
|
||||
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
|
||||
|
||||
let lastModificationCurrentValue = await nightmare
|
||||
.waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
|
||||
let lastModificationCurrentValue = await page.
|
||||
waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
|
||||
|
||||
|
||||
expect(lastModificationPreviousValue).toEqual('name: DavidCharlesHaller');
|
||||
|
|
|
@ -1,66 +1,66 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client balance path', () => {
|
||||
const nightmare = createNightmare();
|
||||
fdescribe('Client balance path', () => {
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
await page.loginAndModule('administrative', 'client');
|
||||
await page.accessToSearchResult('Petter Parker');
|
||||
}, 30000);
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'client')
|
||||
.accessToSearchResult('Petter Parker');
|
||||
afterAll(async() => {
|
||||
page.close();
|
||||
});
|
||||
|
||||
it('should now edit the local user config data', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs')
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs');
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should access to the balance section to check the data shown matches the local settings', async() => {
|
||||
let result = await nightmare
|
||||
.accessToSection('client.card.balance.index')
|
||||
.waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value');
|
||||
await page.accessToSection('client.card.balance.index');
|
||||
let result = await page.waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('CCs');
|
||||
});
|
||||
|
||||
it('should now clear the user local settings', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
.waitToClick(selectors.globalItems.userConfigThirdAutocompleteClear)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should click the new payment button', async() => {
|
||||
let url = await nightmare
|
||||
.reloadSection('client.card.balance.index')
|
||||
.waitToClick(selectors.clientBalance.newPaymentButton)
|
||||
.waitForURL('/balance')
|
||||
.parsedUrl();
|
||||
await page.keyboard.press('Escape');
|
||||
await page.reloadSection('client.card.balance.index');
|
||||
await page.waitToClick(selectors.clientBalance.newPaymentButton);
|
||||
await page.waitForURL('/balance');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/balance');
|
||||
});
|
||||
|
||||
it('should create a new payment that clears the debt', async() => {
|
||||
let result = await nightmare
|
||||
.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt')
|
||||
.waitToClick(selectors.clientBalance.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitFor(1000);
|
||||
await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt');
|
||||
await page.waitToClick(selectors.clientBalance.saveButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should check balance is now 0 and the company is now VNL becouse the user local settings were removed', async() => {
|
||||
let company = await nightmare
|
||||
.waitForSpinnerLoad()
|
||||
await page.waitForSpinnerLoad();
|
||||
let company = await page
|
||||
.waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value');
|
||||
|
||||
let firstBalanceLine = await nightmare
|
||||
let firstBalanceLine = await page
|
||||
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
||||
|
||||
|
||||
|
@ -69,94 +69,78 @@ describe('Client balance path', () => {
|
|||
});
|
||||
|
||||
it('should now click the new payment button', async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.clientBalance.newPaymentButton)
|
||||
.waitForURL('/balance')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientBalance.newPaymentButton);
|
||||
await page.waitForURL('/balance');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/balance');
|
||||
});
|
||||
|
||||
it('should create a new payment that sets the balance to positive value', async() => {
|
||||
let result = await nightmare
|
||||
.clearInput(selectors.clientBalance.newPaymentAmountInput)
|
||||
.write(selectors.clientBalance.newPaymentAmountInput, '100')
|
||||
.waitToClick(selectors.clientBalance.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientBalance.newPaymentAmountInput);
|
||||
await page.write(selectors.clientBalance.newPaymentAmountInput, '100');
|
||||
await page.waitToClick(selectors.clientBalance.saveButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should check balance is now -100', async() => {
|
||||
let result = await nightmare
|
||||
let result = await page
|
||||
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
||||
|
||||
expect(result).toContain('-€100.00');
|
||||
});
|
||||
|
||||
it('should again click the new payment button', async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.clientBalance.newPaymentButton)
|
||||
.waitForURL('/balance')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/balance');
|
||||
});
|
||||
|
||||
it('should create a new payment that sets the balance back to the original negative value', async() => {
|
||||
let result = await nightmare
|
||||
.clearInput(selectors.clientBalance.newPaymentAmountInput)
|
||||
.write(selectors.clientBalance.newPaymentAmountInput, '-150')
|
||||
.waitToClick(selectors.clientBalance.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientBalance.newPaymentButton);
|
||||
await page.waitFor(4000);
|
||||
await page.clearInput(selectors.clientBalance.newPaymentAmountInput);
|
||||
await page.write(selectors.clientBalance.newPaymentAmountInput, '-150');
|
||||
await page.waitToClick(selectors.clientBalance.saveButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should check balance is now 50', async() => {
|
||||
let result = await nightmare
|
||||
let result = await page
|
||||
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
||||
|
||||
expect(result).toEqual('€50.00');
|
||||
});
|
||||
|
||||
it('should now click on the Clients button of the top bar menu', async() => {
|
||||
let url = await nightmare
|
||||
.waitForLogin('employee')
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.clientsButton)
|
||||
.wait(selectors.clientsIndex.createClientButton)
|
||||
.parsedUrl();
|
||||
await page.login('employee');
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await page.waitToClick(selectors.globalItems.clientsButton);
|
||||
await page.wait(selectors.clientsIndex.createClientButton);
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/client/index');
|
||||
});
|
||||
|
||||
it('should now search for the user Petter Parker', async() => {
|
||||
let resultCount = await nightmare
|
||||
.write(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
||||
.waitToClick(selectors.clientsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
||||
.countElement(selectors.clientsIndex.searchResult);
|
||||
await page.write(selectors.clientsIndex.searchClientInput, 'Petter Parker');
|
||||
await page.waitToClick(selectors.clientsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1);
|
||||
let resultCount = await page.countElement(selectors.clientsIndex.searchResult);
|
||||
|
||||
expect(resultCount).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the client's balance`, async() => {
|
||||
let url = await nightmare
|
||||
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
||||
.waitToClick(selectors.clientsIndex.searchResult)
|
||||
.waitToClick(selectors.clientBalance.balanceButton)
|
||||
.waitForURL('/balance')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker');
|
||||
await page.waitToClick(selectors.clientsIndex.searchResult);
|
||||
await page.waitToClick(selectors.clientBalance.balanceButton);
|
||||
await page.waitForURL('/balance');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/balance');
|
||||
});
|
||||
|
||||
it('should not be able to click the new payment button as it isnt present', async() => {
|
||||
let result = await nightmare
|
||||
.exists(selectors.clientBalance.newPaymentButton);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
await page.waitFor(selectors.clientBalance.newPaymentButton, {hidden: true});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,29 +2,37 @@ import selectors from '../../helpers/selectors.js';
|
|||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
describe('User config', () => {
|
||||
const nightmare = createNightmare();
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
page.close();
|
||||
});
|
||||
|
||||
describe('as salesPerson', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.waitForLogin('salesPerson');
|
||||
it('should login', async() => {
|
||||
await page.login('salesPerson');
|
||||
});
|
||||
|
||||
it('should now open the user config form to check the settings', async() => {
|
||||
let userLocalWarehouse = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
|
||||
let userLocalWarehouse = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
||||
|
||||
let userLocalBank = await nightmare
|
||||
|
||||
let userLocalBank = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalBank} input`, 'value');
|
||||
|
||||
let userLocalCompany = await nightmare
|
||||
let userLocalCompany = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalCompany} input`, 'value');
|
||||
|
||||
let userWarehouse = await nightmare
|
||||
let userWarehouse = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value');
|
||||
|
||||
let userCompany = await nightmare
|
||||
let userCompany = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value');
|
||||
|
||||
expect(userLocalWarehouse).toEqual('');
|
||||
|
@ -36,26 +44,25 @@ describe('User config', () => {
|
|||
});
|
||||
|
||||
describe('as employee', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.waitForLogin('employee');
|
||||
it('should log in', async() => {
|
||||
await page.login('employee');
|
||||
});
|
||||
|
||||
it('should open the user config form to check the settings', async() => {
|
||||
let userLocalWarehouse = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
let userLocalWarehouse = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
||||
|
||||
let userLocalBank = await nightmare
|
||||
let userLocalBank = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalBank} input`, 'value');
|
||||
|
||||
let userLocalCompany = await nightmare
|
||||
let userLocalCompany = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalCompany} input`, 'value');
|
||||
|
||||
let userWarehouse = await nightmare
|
||||
let userWarehouse = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value');
|
||||
|
||||
let userCompany = await nightmare
|
||||
let userCompany = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value');
|
||||
|
||||
expect(userLocalWarehouse).toEqual('');
|
||||
|
@ -66,37 +73,35 @@ describe('User config', () => {
|
|||
});
|
||||
|
||||
it('should now edit the user config data', async() => {
|
||||
let result = await nightmare
|
||||
.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four')
|
||||
.autocompleteSearch(selectors.globalItems.userLocalBank, 'Pay on receipt')
|
||||
.autocompleteSearch(selectors.globalItems.userLocalCompany, 'VNL')
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four');
|
||||
await page.autocompleteSearch(selectors.globalItems.userLocalBank, 'Pay on receipt');
|
||||
await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'VNL');
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
});
|
||||
|
||||
describe('as salesPerson 2nd run', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.waitForLogin('salesPerson');
|
||||
it('should log in once more', async() => {
|
||||
await page.login('salesPerson');
|
||||
});
|
||||
|
||||
it('should again open the user config form to check the local settings', async() => {
|
||||
let userLocalWarehouse = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
let userLocalWarehouse = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
||||
|
||||
let userLocalBank = await nightmare
|
||||
let userLocalBank = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userLocalBank} input`, 'value');
|
||||
|
||||
let userLocalCompany = await nightmare
|
||||
let userLocalCompany = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userLocalCompany} input`, 'value');
|
||||
|
||||
let userWarehouse = await nightmare
|
||||
let userWarehouse = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value');
|
||||
|
||||
let userCompany = await nightmare
|
||||
let userCompany = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value');
|
||||
|
||||
expect(userLocalWarehouse).toContain('Warehouse Four');
|
||||
|
@ -107,12 +112,10 @@ describe('User config', () => {
|
|||
});
|
||||
|
||||
it('should now clear the local settings', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
.waitToClick(selectors.globalItems.userConfigFirstAutocompleteClear)
|
||||
.waitToClick(selectors.globalItems.userConfigSecondAutocompleteClear)
|
||||
.waitToClick(selectors.globalItems.userConfigThirdAutocompleteClear)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete);
|
||||
await page.clearInput(selectors.globalItems.userConfigSecondAutocomplete);
|
||||
await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
|
|
@ -2,39 +2,34 @@ import selectors from '../../helpers/selectors.js';
|
|||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client web Payment', () => {
|
||||
const nightmare = createNightmare();
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Tony Stark');
|
||||
await page.accessToSection('client.card.webPayment');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
page.close();
|
||||
});
|
||||
|
||||
describe('as employee', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Tony Stark')
|
||||
.accessToSection('client.card.webPayment');
|
||||
});
|
||||
|
||||
it('should not be able to confirm payments', async() => {
|
||||
let exists = await nightmare
|
||||
.exists(selectors.webPayment.confirmFirstPaymentButton);
|
||||
|
||||
expect(exists).toBeFalsy();
|
||||
await page.waitFor(selectors.webPayment.confirmFirstPaymentButton, {hidden: true});
|
||||
});
|
||||
});
|
||||
|
||||
describe('as administrative', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'client')
|
||||
.accessToSearchResult('Tony Stark')
|
||||
.accessToSection('client.card.webPayment');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('administrative', 'client');
|
||||
await page.accessToSearchResult('Tony Stark');
|
||||
await page.accessToSection('client.card.webPayment');
|
||||
});
|
||||
|
||||
it('should be able to confirm payments', async() => {
|
||||
let exists = await nightmare
|
||||
.waitToClick(selectors.webPayment.confirmFirstPaymentButton)
|
||||
.wait(selectors.webPayment.firstPaymentConfirmed)
|
||||
.exists(selectors.webPayment.firstPaymentConfirmed);
|
||||
|
||||
expect(exists).toBeTruthy();
|
||||
await page.waitToClick(selectors.webPayment.confirmFirstPaymentButton);
|
||||
await page.waitFor(selectors.webPayment.firstPaymentConfirmed, {hidden: true});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,30 +2,31 @@ import selectors from '../../helpers/selectors.js';
|
|||
import openPage from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client DMS', () => {
|
||||
const nightmare = createNightmare();
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
page = await openPage();
|
||||
await page.loginAndModule('salesPerson', 'client');
|
||||
await page.accessToSearchResult('Tony Stark');
|
||||
await page.accessToSection('client.card.dms.index');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
page.close();
|
||||
});
|
||||
|
||||
describe('as salesPerson', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'client')
|
||||
.accessToSearchResult('Tony Stark')
|
||||
.accessToSection('client.card.dms.index');
|
||||
});
|
||||
|
||||
it('should delete de first file', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.dms.deleteFileButton)
|
||||
.waitToClick(selectors.dms.acceptDeleteButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.dms.deleteFileButton);
|
||||
await page.waitToClick(selectors.dms.acceptDeleteButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should click on the first document line worker name making the descriptor visible`, async() => {
|
||||
const visible = await nightmare
|
||||
.waitToClick(selectors.dms.firstDocWorker)
|
||||
.wait(selectors.dms.firstDocWorkerDescriptor)
|
||||
.isVisible(selectors.dms.firstDocWorkerDescriptor);
|
||||
await page.waitToClick(selectors.dms.firstDocWorker);
|
||||
await page.wait(selectors.dms.firstDocWorkerDescriptor);
|
||||
const visible = await page.isVisible(selectors.dms.firstDocWorkerDescriptor);
|
||||
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
|
|
|
@ -78,7 +78,7 @@ describe('Item regularize path', () => {
|
|||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
});
|
||||
|
||||
it('should now clear the user local settings', async() => {
|
||||
it('should clear the user local settings now', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
.waitToClick(selectors.globalItems.userConfigFirstAutocompleteClear)
|
||||
|
|
Loading…
Reference in New Issue