Merge branch '2026-itemDescriptorPopoverRelocate' of verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Javi Gallego 2020-04-09 15:58:18 +00:00 committed by Gitea
commit 7f6cca8094
66 changed files with 632 additions and 748 deletions

View File

@ -65,15 +65,6 @@ let actions = {
},
doLogin: async function(userName, password = 'nightmare') {
await this.waitForSelector(`vn-login vn-textfield[ng-model="$ctrl.user"]`, {visible: true});
await this.clearInput(`vn-login vn-textfield[ng-model="$ctrl.user"]`);
await this.write(`vn-login vn-textfield[ng-model="$ctrl.user"]`, userName);
await this.clearInput(`vn-login vn-textfield[ng-model="$ctrl.password"]`);
await this.write(`vn-login vn-textfield[ng-model="$ctrl.password"]`, password);
await this.waitToClick('vn-login button[type=submit]');
},
login: async function(userName) {
let state = await this.getState();
if (state != 'login') {
@ -91,6 +82,16 @@ let actions = {
}
await this.waitForState('login');
await this.waitForSelector(`vn-login vn-textfield[ng-model="$ctrl.user"]`, {visible: true});
await this.clearInput(`vn-login vn-textfield[ng-model="$ctrl.user"]`);
await this.write(`vn-login vn-textfield[ng-model="$ctrl.user"]`, userName);
await this.clearInput(`vn-login vn-textfield[ng-model="$ctrl.password"]`);
await this.write(`vn-login vn-textfield[ng-model="$ctrl.password"]`, password);
await this.waitToClick('vn-login button[type=submit]');
},
login: async function(userName) {
await this.doLogin(userName);
await this.waitForState('home');
},
@ -114,10 +115,11 @@ let actions = {
},
gotoState: async function(state, params) {
return await this.evaluate((state, params) => {
await this.evaluate((state, params) => {
let $state = angular.element(document.body).injector().get('$state');
return $state.go(state, params);
}, state, params);
await this.waitForSpinnerLoad();
},
waitForState: async function(state) {
@ -192,6 +194,12 @@ let actions = {
}, selector, property);
},
getClassName: async function(selector) {
const element = await this.$(selector);
const handle = await element.getProperty('className');
return await handle.jsonValue();
},
waitPropertyLength: async function(selector, property, minLength) {
await this.waitForFunction((selector, property, minLength) => {
const element = document.querySelector(selector);
@ -355,24 +363,37 @@ let actions = {
await this.waitFor(300);
await this.evaluate(() => {
let hideButton = document.querySelector('#shapes .shown button');
let hideButton = document
.querySelector('vn-snackbar .shape.shown button');
if (hideButton)
return document.querySelector('#shapes .shown button').click();
return hideButton.click();
});
await this.waitFor('#shapes > .shape', {hidden: true});
await this.waitFor('vn-snackbar .shape.shown', {hidden: true});
},
waitForLastSnackbar: async function() {
const selector = 'vn-snackbar .shown .text';
waitForSnackbar: async function() {
const selector = 'vn-snackbar .shape.shown';
await this.waitForSelector(selector);
let snackBarText = await this.evaluate(selector => {
const shape = document.querySelector(selector);
return shape.innerText;
let message = await this.evaluate(selector => {
const shape = document.querySelector(selector);
const message = {
text: shape.querySelector('.text').innerText
};
const types = ['error', 'success'];
for (let type of types) {
if (shape.classList.contains(type)) {
message.type = type;
break;
}
}
return message;
}, selector);
await this.hideSnackbar();
return snackBarText;
return message;
},
pickDate: async function(selector, date) {
@ -454,7 +475,6 @@ let actions = {
.includes(searchValue.toLowerCase());
}, {}, builtSelector, searchValue);
await this.waitForMutation('.vn-drop-down', 'childList');
await this.waitFor('.vn-drop-down', {hidden: true});
},

View File

@ -2,6 +2,8 @@
export default {
globalItems: {
applicationsMenuButton: '#apps',
userMenuButton: '#user',
logoutButton: '#logout',
applicationsMenuVisible: '.modules-menu',
clientsButton: '.modules-menu > li[ui-sref="client.index"]',
itemsButton: '.modules-menu > li[ui-sref="item.index"]',
@ -10,7 +12,6 @@ export default {
claimsButton: '.modules-menu > li[ui-sref="claim.index"]',
returnToModuleIndexButton: 'a[ui-sref="order.index"]',
homeButton: 'vn-topbar > div.side.start > a',
userMenuButton: '#user',
userLocalWarehouse: '.user-popover vn-autocomplete[ng-model="$ctrl.localWarehouseFk"]',
userLocalBank: '.user-popover vn-autocomplete[ng-model="$ctrl.localBankFk"]',
userLocalCompany: '.user-popover vn-autocomplete[ng-model="$ctrl.localCompanyFk"]',
@ -336,8 +337,8 @@ export default {
},
itemDiary: {
secondTicketId: 'vn-item-diary vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(2) > span',
fourthBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(4) > vn-td.balance > span',
firstBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(1) > vn-td.balance',
fourthBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(4) > vn-td.balance',
warehouse: 'vn-item-diary vn-autocomplete[ng-model="$ctrl.warehouseFk"]',
},
itemLog: {
@ -350,7 +351,7 @@ export default {
route: 'vn-ticket-summary vn-label-value[label="Route"] > section > span > span',
total: 'vn-ticket-summary vn-one.taxes > p:nth-child(3) > strong',
sale: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr',
firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span',
firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table vn-tbody > :nth-child(1) > vn-td:nth-child(2) > span',
firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img',
itemDescriptorPopover: '.vn-popover.shown vn-item-descriptor',
itemDescriptorPopoverItemDiaryButton: 'vn-item-descriptor a[href="#!/item/2/diary?warehouseFk=5&ticketFk=20"]',

View File

@ -1,3 +1,4 @@
import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer';
describe('Login path', async() => {
@ -13,41 +14,54 @@ describe('Login path', async() => {
});
describe('Bad login', async() => {
it('should receive an error when the username is incorrect', async() => {
await page.doLogin('badUser', '');
const result = await page.waitForLastSnackbar();
it('should receive an error when the password is invalid', async() => {
await page.doLogin('employee', 'badPassword');
const message = await page.waitForSnackbar();
const state = await page.getState();
expect(result.length).toBeGreaterThan(0);
expect(message.type).toBe('error');
expect(state).toBe('login');
});
it('should receive an error when the username is invalid', async() => {
await page.doLogin('badUser', '');
const message = await page.waitForSnackbar();
const state = await page.getState();
expect(message.type).toBe('error');
expect(state).toBe('login');
});
it('should receive an error when the username is blank', async() => {
await page.doLogin('', '');
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
const state = await page.getState();
expect(result.length).toBeGreaterThan(0);
expect(state).toBe('login');
});
it('should receive an error when the password is incorrect', async() => {
await page.doLogin('employee', 'badPassword');
const result = await page.waitForLastSnackbar();
const state = await page.getState();
expect(result.length).toBeGreaterThan(0);
expect(message.type).toBe('error');
expect(state).toBe('login');
});
});
describe('Successful login', async() => {
it('should log in', async() => {
await page.doLogin('employee', 'nightmare');
await page.waitForNavigation();
it('should log in and go to home state', async() => {
await page.doLogin('employee');
await page.waitFor('vn-home');
const state = await page.getState();
expect(state).toBe('home');
});
});
describe('Logout', async() => {
it('should logout and return to login state', async() => {
await page.doLogin('employee');
await page.waitToClick(selectors.globalItems.userMenuButton);
await page.waitToClick(selectors.globalItems.logoutButton);
await page.waitFor('vn-login');
const state = await page.getState();
expect(state).toBe('login');
});
});
});

View File

@ -1,9 +1,10 @@
import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer';
describe('Client create path', async() => {
describe('Client create path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
@ -28,9 +29,9 @@ describe('Client create path', async() => {
it('should receive an error when clicking the create button having all the form fields empty', async() => {
await page.waitToClick(selectors.createClientView.createButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Some fields are invalid');
expect(message.text).toBe('Some fields are invalid');
});
it('should receive an error when clicking the create button having name and Business name fields empty', async() => {
@ -39,9 +40,9 @@ describe('Client create path', async() => {
await page.write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es');
await page.autocompleteSearch(selectors.createClientView.salesPerson, 'replenisher');
await page.waitToClick(selectors.createClientView.createButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Some fields are invalid');
expect(message.text).toBe('Some fields are invalid');
});
it(`should attempt to create a new user with all it's data but wrong email`, async() => {
@ -55,9 +56,9 @@ describe('Client create path', async() => {
await page.clearInput(selectors.createClientView.email);
await page.write(selectors.createClientView.email, 'incorrect email format');
await page.waitToClick(selectors.createClientView.createButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Some fields are invalid');
expect(message.text).toBe('Some fields are invalid');
});
it(`should attempt to create a new user with all it's data but wrong postal code`, async() => {
@ -66,9 +67,9 @@ describe('Client create path', async() => {
await page.clearInput(selectors.createClientView.postcode);
await page.write(selectors.createClientView.postcode, '479999');
await page.waitToClick(selectors.createClientView.createButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual(`The postcode doesn't exist. Please enter a correct one`);
expect(message.text).toBe(`The postcode doesn't exist. Please enter a correct one`);
});
it(`should check for autocompleted city, province and country`, async() => {
@ -90,9 +91,9 @@ describe('Client create path', async() => {
await page.clearInput(selectors.createClientView.postcode);
await page.write(selectors.createClientView.postcode, '46000');
await page.waitToClick(selectors.createClientView.createButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should click on the Clients button of the top bar menu', async() => {

View File

@ -35,9 +35,9 @@ describe('Client Edit basicData path', () => {
await page.write(selectors.clientBasicData.email, 'PWallace@verdnatura.es');
await page.autocompleteSearch(selectors.clientBasicData.channel, 'Rumors on the streets');
await page.waitToClick(selectors.clientBasicData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the name have been edited', async() => {
@ -99,9 +99,9 @@ describe('Client Edit basicData path', () => {
await page.autocompleteSearch(selectors.clientBasicData.salesPerson, 'replenisherNick');
await page.autocompleteSearch(selectors.clientBasicData.channel, 'Metropolis newspaper');
await page.waitToClick(selectors.clientBasicData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should now confirm the name have been edited', async() => {

View File

@ -78,9 +78,9 @@ describe('Client Edit fiscalData path', () => {
await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox);
await page.waitToClick(selectors.clientFiscalData.saveButton);
await page.waitToClick(selectors.clientFiscalData.acceptDuplicationButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Invalid Tax number');
expect(message.text).toBe('Invalid Tax number');
});
it(`should edit the fiscal this time with a valid fiscal id`, async() => {
@ -88,16 +88,16 @@ describe('Client Edit fiscalData path', () => {
await page.write(selectors.clientFiscalData.fiscalId, '94980061C');
await page.waitToClick(selectors.clientFiscalData.saveButton);
await page.waitToClick(selectors.clientFiscalData.acceptDuplicationButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should propagate the Equalization tax', async() => {
await page.waitToClick(selectors.clientFiscalData.acceptPropagationButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Equivalent tax spreaded');
expect(message.text).toBe('Equivalent tax spreaded');
});
it('should receive an error if the fiscal id contains A or B at the beginning', async() => {
@ -105,18 +105,18 @@ describe('Client Edit fiscalData path', () => {
await page.clearInput(selectors.clientFiscalData.fiscalId);
await page.write(selectors.clientFiscalData.fiscalId, 'A94980061C');
await page.waitToClick(selectors.clientFiscalData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Cannot check Equalization Tax in this NIF/CIF');
expect(message.text).toBe('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() => {
await page.clearInput(selectors.clientFiscalData.fiscalId);
await page.write(selectors.clientFiscalData.fiscalId, '94980061C');
await page.waitToClick(selectors.clientFiscalData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
// confirm all addresses have now EQtax checked step 1
@ -150,17 +150,17 @@ describe('Client Edit fiscalData path', () => {
await page.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox);
await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox);
await page.waitToClick(selectors.clientFiscalData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should propagate the Equalization tax changes', async() => {
await page.waitFor(1000);
await page.waitToClick(selectors.clientFiscalData.acceptPropagationButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Equivalent tax spreaded');
expect(message.text).toBe('Equivalent tax spreaded');
});
it('should confirm its name have been edited', async() => {
@ -266,9 +266,9 @@ describe('Client Edit fiscalData path', () => {
await page.waitForTextInField(selectors.clientAddresses.city, 'Silla');
await page.waitToClick(selectors.clientAddresses.equalizationTaxCheckbox);
await page.waitToClick(selectors.clientAddresses.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 3

View File

@ -26,9 +26,9 @@ describe('Client Edit billing data path', () => {
await page.waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox);
await page.waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox);
await page.waitToClick(selectors.clientBillingData.saveButton);
let snackbarMessage = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(snackbarMessage).toEqual('That payment method requires an IBAN');
expect(message.text).toBe('That payment method requires an IBAN');
});
// 2215: Windows (hidden mode): Entity code doesn't get the focus, '9999' is written in entity name.
@ -39,13 +39,13 @@ describe('Client Edit billing data path', () => {
await page.write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT');
await page.waitToClick(selectors.clientBillingData.acceptBankEntityButton);
await page.waitForTextInField(selectors.clientBillingData.swiftBic, 'Gotham City Bank');
let newcode = await page.waitToGetProperty(selectors.clientBillingData.swiftBic, 'value');
const newcode = await page.waitToGetProperty(selectors.clientBillingData.swiftBic, 'value');
expect(newcode).toEqual('GTHMCT Gotham City Bank');
});
xit(`should confirm the IBAN pay method was sucessfully saved`, async() => {
let payMethod = await page.waitToGetProperty(selectors.clientBillingData.payMethod, 'value');
const payMethod = await page.waitToGetProperty(selectors.clientBillingData.payMethod, 'value');
expect(payMethod).toEqual('PayMethod with IBAN');
});
@ -63,43 +63,43 @@ describe('Client Edit billing data path', () => {
it(`should save the form with all its new data`, async() => {
await page.waitForWatcherData(selectors.clientBillingData.watcher);
await page.waitToClick(selectors.clientBillingData.saveButton);
let snackbarMessage = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(snackbarMessage).toEqual('Notification sent!');
expect(message.text).toBe('Notification sent!');
});
it('should confirm the due day have been edited', async() => {
let dueDate = await page.waitToGetProperty(selectors.clientBillingData.dueDay, 'value');
const dueDate = await page.waitToGetProperty(selectors.clientBillingData.dueDay, 'value');
expect(dueDate).toEqual('60');
});
it('should confirm the IBAN was saved', async() => {
let IBAN = await page.waitToGetProperty(selectors.clientBillingData.IBAN, 'value');
const IBAN = await page.waitToGetProperty(selectors.clientBillingData.IBAN, 'value');
expect(IBAN).toEqual('ES9121000418450200051332');
});
it('should confirm the swift / BIC code was saved', async() => {
let code = await page.waitToGetProperty(selectors.clientBillingData.swiftBic, 'value');
const code = await page.waitToGetProperty(selectors.clientBillingData.swiftBic, 'value');
expect(code).toEqual('CAIXESBB Caixa Bank');
});
it('should confirm Received LCR checkbox is checked', async() => {
let result = await page.checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox);
const result = await page.checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox);
expect(result).toBe('checked');
});
it('should confirm Received core VNL checkbox is unchecked', async() => {
let result = await page.checkboxState(selectors.clientBillingData.receivedCoreVNLCheckbox);
const result = await page.checkboxState(selectors.clientBillingData.receivedCoreVNLCheckbox);
expect(result).toBe('unchecked');
});
it('should confirm Received B2B VNL checkbox is unchecked', async() => {
let result = await page.checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox);
const result = await page.checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox);
expect(result).toBe('unchecked');
});

View File

@ -28,9 +28,9 @@ describe('Client Add address path', () => {
await page.write(selectors.clientAddresses.phone, '999887744');
await page.write(selectors.clientAddresses.mobileInput, '999887744');
await page.waitToClick(selectors.clientFiscalData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Some fields are invalid');
expect(message.text).toBe('Some fields are invalid');
});
it('should confirm that the city and province are propertly filled', async() => {
@ -48,25 +48,25 @@ describe('Client Add address path', () => {
await page.write(selectors.clientAddresses.consignee, 'Bruce Bunner');
await page.write(selectors.clientAddresses.streetAddress, '320 Park Avenue New York');
await page.waitToClick(selectors.clientAddresses.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Incoterms is required for a non UEE member');
expect(message.text).toBe('Incoterms is required for a non UEE member');
});
it(`should receive an error after clicking save button as customsAgent is empty`, async() => {
await page.autocompleteSearch(selectors.clientAddresses.incoterms, 'Free Alongside Ship');
await page.waitToClick(selectors.clientAddresses.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Customs agent is required for a non UEE member');
expect(message.text).toBe('Customs agent is required for a non UEE member');
});
it(`should create a new address with all it's data`, async() => {
await page.autocompleteSearch(selectors.clientAddresses.customsAgent, 'Agent one');
await page.waitToClick(selectors.clientAddresses.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should navigate back to the addresses index`, async() => {
@ -82,9 +82,9 @@ describe('Client Add address path', () => {
it('should click on the make default icon of the second address', async() => {
await page.waitToClick(selectors.clientAddresses.secondMakeDefaultStar);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should confirm the default address is the expected one`, async() => {
@ -104,9 +104,9 @@ describe('Client Add address path', () => {
await page.waitForWatcherData(selectors.clientAddresses.watcher);
await page.waitToClick(selectors.clientAddresses.activeCheckbox);
await page.waitToClick(selectors.clientAddresses.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('The default consignee can not be unchecked');
expect(message.text).toBe('The default consignee can not be unchecked');
});
it(`should go back to the addreses section by clicking the cancel button`, async() => {

View File

@ -26,18 +26,18 @@ describe('Client add address notes path', () => {
await page.waitToClick(selectors.clientAddresses.addObservationButton);
await page.write(selectors.clientAddresses.firstObservationDescription, 'first description');
await page.waitToClick(selectors.clientAddresses.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Some fields are invalid');
expect(message.text).toBe('Some fields are invalid');
});
it('should not save an observation type without description', async() => {
await page.clearInput(selectors.clientAddresses.firstObservationDescription);
await page.autocompleteSearch(selectors.clientAddresses.firstObservationType, 'comercial');
await page.waitToClick(selectors.clientAddresses.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Some fields are invalid');
expect(message.text).toBe('Some fields are invalid');
});
it('should create two new observations', async() => {
@ -46,8 +46,8 @@ describe('Client add address notes path', () => {
await page.autocompleteSearch(selectors.clientAddresses.secondObservationType, 'observation one');
await page.write(selectors.clientAddresses.secondObservationDescription, 'second description');
await page.waitToClick(selectors.clientAddresses.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
});

View File

@ -21,9 +21,9 @@ describe('Client Edit web access path', () => {
await page.clearInput(selectors.clientWebAccess.userName);
await page.write(selectors.clientWebAccess.userName, 'Hulk');
await page.waitToClick(selectors.clientWebAccess.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm web access is now unchecked', async() => {

View File

@ -29,9 +29,9 @@ describe('Client Add notes path', () => {
await page.waitFor(selectors.clientNotes.note);
await page.type(`${selectors.clientNotes.note} textarea`, 'Meeting with Black Widow 21st 9am');
await page.waitToClick(selectors.clientNotes.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the note was created', async() => {

View File

@ -25,9 +25,9 @@ describe('Client Add credit path', () => {
await page.clearInput(selectors.clientCredit.credit);
await page.write(selectors.clientCredit.credit, '999');
await page.waitToClick(selectors.clientCredit.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the credit was updated', async() => {

View File

@ -24,9 +24,9 @@ describe('Client Add greuge path', () => {
it(`should receive an error if all fields are empty but date and type on submit`, async() => {
await page.autocompleteSearch(selectors.clientGreuge.type, 'Diff');
await page.waitToClick(selectors.clientGreuge.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Some fields are invalid');
expect(message.text).toBe('Some fields are invalid');
});
it(`should create a new greuge with all its data`, async() => {
@ -34,9 +34,9 @@ describe('Client Add greuge path', () => {
await page.waitForTextInField(selectors.clientGreuge.amount, '999');
await page.write(selectors.clientGreuge.description, 'new armor for Batman!');
await page.waitToClick(selectors.clientGreuge.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the greuge was added to the list', async() => {

View File

@ -30,9 +30,9 @@ describe('Client lock verified data path', () => {
await page.clearInput(selectors.clientFiscalData.socialName);
await page.write(selectors.clientFiscalData.socialName, 'Captain America Civil War');
await page.waitToClick(selectors.clientFiscalData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the social name have been edited', async() => {
@ -60,9 +60,9 @@ describe('Client lock verified data path', () => {
await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox);
await page.waitToClick(selectors.clientFiscalData.saveButton);
await page.waitToClick(selectors.clientFiscalData.acceptDuplicationButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm Verified data checkbox is checked', async() => {
@ -77,9 +77,9 @@ describe('Client lock verified data path', () => {
await page.clearInput(selectors.clientFiscalData.socialName);
await page.write(selectors.clientFiscalData.socialName, 'Ant man and the Wasp');
await page.waitToClick(selectors.clientFiscalData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should again confirm the social name have been edited', async() => {
@ -107,9 +107,9 @@ describe('Client lock verified data path', () => {
await page.clearInput(selectors.clientFiscalData.socialName);
await page.write(selectors.clientFiscalData.socialName, 'This wont happen');
await page.waitToClick(selectors.clientFiscalData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual(`You can't make changes on a client with verified data`);
expect(message.text).toBe(`You can't make changes on a client with verified data`);
});
});
@ -131,9 +131,9 @@ describe('Client lock verified data path', () => {
await page.clearInput(selectors.clientFiscalData.socialName);
await page.write(selectors.clientFiscalData.socialName, 'new social name edition');
await page.waitToClick(selectors.clientFiscalData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should now confirm the social name have been edited once and for all', async() => {

View File

@ -20,9 +20,9 @@ describe('Client log path', () => {
await page.clearInput(selectors.clientBasicData.name);
await page.write(selectors.clientBasicData.name, 'this is a test');
await page.waitToClick(selectors.clientBasicData.saveButton);
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should navigate to the log section', async() => {

View File

@ -18,9 +18,9 @@ describe('Client balance path', () => {
it('should now edit the local user config data', async() => {
await page.waitToClick(selectors.globalItems.userMenuButton);
await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs');
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should access to the balance section to check the data shown matches the local settings', async() => {
@ -33,9 +33,9 @@ describe('Client balance path', () => {
it('should now clear the user local settings', async() => {
await page.waitToClick(selectors.globalItems.userMenuButton);
await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete);
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toContain('Data saved!');
expect(message.type).toBe('success');
});
it('should click the new payment button', async() => {
@ -48,9 +48,9 @@ describe('Client balance path', () => {
await page.waitToClick(selectors.clientBalance.newPaymentButton);
await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt');
await page.waitToClick(selectors.clientBalance.saveButton);
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toContain('Data saved!');
expect(message.type).toBe('success');
});
it('should check balance is now 0 and the company is now VNL becouse the user local settings were removed', async() => {
@ -69,9 +69,9 @@ describe('Client balance path', () => {
await page.waitToClick(selectors.clientBalance.newPaymentButton);
await page.overwrite(selectors.clientBalance.newPaymentAmount, '100');
await page.waitToClick(selectors.clientBalance.saveButton);
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toContain('Data saved!');
expect(message.type).toBe('success');
});
it('should check balance is now -100', async() => {
@ -85,9 +85,9 @@ describe('Client balance path', () => {
await page.waitToClick(selectors.clientBalance.newPaymentButton);
await page.overwrite(selectors.clientBalance.newPaymentAmount, '-150');
await page.waitToClick(selectors.clientBalance.saveButton);
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toContain('Data saved!');
expect(message.type).toBe('success');
});
it('should check balance is now 50', async() => {

View File

@ -79,9 +79,9 @@ describe('User config', () => {
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();
const message = await page.waitForSnackbar();
expect(result).toContain('Data saved!');
expect(message.type).toBe('success');
});
});
@ -118,9 +118,9 @@ describe('User config', () => {
await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete);
await page.clearInput(selectors.globalItems.userConfigSecondAutocomplete);
await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete);
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toContain('Data saved!');
expect(message.type).toBe('success');
});
});
});

View File

@ -20,9 +20,9 @@ describe('Client DMS', () => {
it('should delete de first file', async() => {
await page.waitToClick(selectors.dms.deleteFileButton);
await page.respondToDialog('accept');
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should click on the first document line worker name making the descriptor visible`, async() => {

View File

@ -22,17 +22,17 @@ describe('Client contacts', () => {
await page.write(selectors.clientContacts.name, 'Ansible');
await page.write(selectors.clientContacts.phone, 'FTL comms');
await page.waitToClick(selectors.clientContacts.saveButton);
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should delete de contact', async() => {
await page.waitFor(3000);
await page.waitToClick(selectors.clientContacts.deleteFirstPhone);
await page.waitToClick(selectors.clientContacts.saveButton);
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toContain('Data saved!');
expect(message.type).toBe('success');
});
});

View File

@ -24,9 +24,9 @@ describe('Worker basic data path', () => {
await page.clearInput(selectors.workerBasicData.phone);
await page.write(selectors.workerBasicData.phone, '444332211');
await page.waitToClick(selectors.workerBasicData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should reload the section then check the name was edited', async() => {

View File

@ -19,17 +19,17 @@ describe('Worker pbx path', () => {
it('should receive an error when the extension exceeds 4 characters', async() => {
await page.write(selectors.workerPbx.extension, '55555');
await page.waitToClick(selectors.workerPbx.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Extension format is invalid');
expect(message.text).toBe('Extension format is invalid');
});
it('should sucessfully save the changes', async() => {
await page.clearInput(selectors.workerPbx.extension);
await page.write(selectors.workerPbx.extension, '4444');
await page.waitToClick(selectors.workerPbx.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved! User must access web');
expect(message.text).toBe('Data saved! User must access web');
});
});

View File

@ -57,9 +57,9 @@ describe('Worker time control path', () => {
await page.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime);
await page.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete);
await page.respondToDialog('accept');
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Entry removed');
expect(message.text).toBe('Entry removed');
});
it(`should scan out Hank Pym to leave early`, async() => {

View File

@ -34,9 +34,9 @@ describe('Item Edit basic data path', () => {
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
await page.waitToClick(selectors.itemBasicData.priceInKgCheckbox);
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should create a new intrastat`, async() => {
@ -53,9 +53,9 @@ describe('Item Edit basic data path', () => {
it('should save with the new intrastat', async() => {
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should confirm the item name was edited`, async() => {

View File

@ -21,9 +21,9 @@ describe('Item edit tax path', () => {
await page.autocompleteSearch(selectors.itemTax.secondClass, 'General VAT');
await page.autocompleteSearch(selectors.itemTax.thirdClass, 'General VAT');
await page.waitToClick(selectors.itemTax.submitTaxButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should confirm the first item tax class was edited`, async() => {

View File

@ -24,9 +24,9 @@ describe('Item create tags path', () => {
await page.clearInput(selectors.itemTags.seventhRelevancy);
await page.write(selectors.itemTags.seventhRelevancy, '4');
await page.waitToClick(selectors.itemTags.submitItemTagsButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should confirm the fourth row data is the expected one`, async() => {

View File

@ -23,9 +23,9 @@ describe('Item create niche path', () => {
await page.autocompleteSearch(selectors.itemNiches.thirdWarehouse, 'Warehouse Two');
await page.write(selectors.itemNiches.thirdCode, 'A4');
await page.waitToClick(selectors.itemNiches.submitNichesButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should confirm the first niche is the expected one`, async() => {

View File

@ -21,9 +21,9 @@ describe('Item Create botanical path', () => {
await page.autocompleteSearch(selectors.itemBotanical.genus, 'Abelia');
await page.autocompleteSearch(selectors.itemBotanical.species, 'dealbata');
await page.waitToClick(selectors.itemBotanical.submitBotanicalButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should confirm the botanical for the item was created`, async() => {
@ -56,9 +56,9 @@ describe('Item Create botanical path', () => {
await page.autocompleteSearch(selectors.itemBotanical.genus, 'Abies');
await page.autocompleteSearch(selectors.itemBotanical.species, 'decurrens');
await page.waitToClick(selectors.itemBotanical.submitBotanicalButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should confirm the botanical for the item was edited`, async() => {

View File

@ -21,9 +21,9 @@ describe('Item Create barcodes path', () => {
await page.waitToClick(selectors.itemBarcodes.addBarcodeButton);
await page.write(selectors.itemBarcodes.thirdCode, '5');
await page.waitToClick(selectors.itemBarcodes.submitBarcodesButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, async() => {

View File

@ -43,9 +43,9 @@ describe('Item Create/Clone path', () => {
await page.autocompleteSearch(selectors.itemCreateView.intrastat, 'Coral y materiales similares');
await page.autocompleteSearch(selectors.itemCreateView.origin, 'Holand');
await page.waitToClick(selectors.itemCreateView.createButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm Infinity Gauntlet item was created', async() => {

View File

@ -18,9 +18,9 @@ describe('Item regularize path', () => {
await page.waitForSpinnerLoad();
await page.waitToClick(selectors.globalItems.userMenuButton);
await page.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four');
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should check the local settings were saved', async() => {
@ -49,9 +49,9 @@ describe('Item regularize path', () => {
await page.write(selectors.itemDescriptor.regularizeQuantity, '100');
await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouse, 'Warehouse One');
await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should click on the Tickets button of the top bar menu', async() => {
@ -68,9 +68,9 @@ describe('Item regularize path', () => {
await page.waitToClick(selectors.globalItems.userMenuButton);
await page.waitForContentLoaded();
await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should search for the ticket with alias missing', async() => {
@ -112,9 +112,9 @@ describe('Item regularize path', () => {
await page.write(selectors.itemDescriptor.regularizeQuantity, '100');
await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouse, 'Warehouse One');
await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should again click on the Tickets button of the top bar menu', async() => {

View File

@ -34,9 +34,9 @@ describe('Item index path', () => {
await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
await page.waitToClick(selectors.itemsIndex.destinyCheckbox);
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should navigate forth and back to see the images column is still visible', async() => {
@ -68,9 +68,9 @@ describe('Item index path', () => {
await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
await page.waitToClick(selectors.itemsIndex.destinyCheckbox);
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should now navigate forth and back to see the ids column is now visible', async() => {

View File

@ -32,9 +32,9 @@ describe('Item log path', () => {
await page.autocompleteSearch(selectors.itemCreateView.intrastat, 'Coral y materiales similares');
await page.autocompleteSearch(selectors.itemCreateView.origin, 'Holand');
await page.waitToClick(selectors.itemCreateView.createButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should return to the items index by clicking the return to items button', async() => {

View File

@ -19,7 +19,7 @@ describe('Item descriptor path', () => {
it('should check the descriptor inactive icon is dark as the item is active', async() => {
await page.wait(selectors.itemDescriptor.inactiveIcon);
await page.waitForClassNotPresent(selectors.itemDescriptor.inactiveIcon, 'bright');
let darkIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
const darkIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
expect(darkIcon).toBeTruthy();
});
@ -27,15 +27,15 @@ describe('Item descriptor path', () => {
it('should set the item to inactive', async() => {
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should reload the section and check the inactive icon is bright', async() => {
await page.reloadSection('item.card.basicData');
await page.waitForClassPresent(selectors.itemDescriptor.inactiveIcon, 'bright');
let brightIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
const brightIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
expect(brightIcon).toBeTruthy();
});
@ -43,8 +43,8 @@ describe('Item descriptor path', () => {
it('should set the item back to active', async() => {
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
});

View File

@ -74,9 +74,9 @@ describe('Ticket List sale path', () => {
await page.keyboard.press('Enter');
await page.write(selectors.ticketSales.secondSaleQuantity, '1');
await page.keyboard.press('Enter');
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
// #1865
@ -84,9 +84,9 @@ describe('Ticket List sale path', () => {
await page.focusElement(selectors.ticketSales.secondSaleConceptCell);
await page.write(selectors.ticketSales.secondSaleConceptInput, 'Aegis of Valor');
await page.keyboard.press('Enter');
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should add a third empty item to the sale list', async() => {
@ -102,9 +102,9 @@ describe('Ticket List sale path', () => {
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
await page.waitToClick(selectors.ticketSales.deleteSaleButton);
await page.waitToClick(selectors.ticketSales.acceptDeleteLineButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should verify there's only 1 single line remaining`, async() => {

View File

@ -19,245 +19,218 @@ xdescribe('Ticket Edit sale path', () => {
});
it(`should click on the first sale claim icon to navigate over there`, async() => {
const url = await nightmare
.waitToClick(selectors.ticketSales.firstSaleClaimIcon)
.wait(selectors.claimBasicData.claimState)
.parsedUrl();
await page.waitToClick(selectors.ticketSales.firstSaleClaimIcon);
await page.wait(selectors.claimBasicData.claimState);
const url = await page.parsedUrl();
expect(url.hash).toEqual('#!/claim/2/basic-data');
});
it('should navigate to the tickets index', async() => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.topbarSearch)
.parsedUrl();
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.wait(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.ticketsButton);
await page.wait(selectors.ticketsIndex.topbarSearch);
const url = await page.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
});
it(`should search for a ticket and then navigate to it's sales`, async() => {
const url = await nightmare
.accessToSearchResult(16)
.accessToSection('ticket.card.sale')
.waitForURL('/sale')
.parsedUrl();
await page.accessToSearchResult(16);
await page.accessToSection('ticket.card.sale');
await page.waitForURL('/sale');
const url = await page.parsedUrl();
expect(url.hash).toContain('/sale');
});
it(`should check the zoomed image isn't present`, async() => {
const result = await nightmare
.countElement(selectors.ticketSales.firstSaleZoomedImage);
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
expect(result).toEqual(0);
});
it(`should click on the thumbnail image of the 1st sale and see the zoomed image`, async() => {
const result = await nightmare
.clickIfVisible(selectors.ticketSales.firstSaleThumbnailImage)
.countElement(selectors.ticketSales.firstSaleZoomedImage);
await page.clickIfVisible(selectors.ticketSales.firstSaleThumbnailImage);
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
expect(result).toEqual(1);
});
it(`should click on the zoomed image to close it`, async() => {
const result = await nightmare
.clickIfVisible(selectors.ticketSales.firstSaleZoomedImage)
.countElement(selectors.ticketSales.firstSaleZoomedImage);
await page.clickIfVisible(selectors.ticketSales.firstSaleZoomedImage);
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
expect(result).toEqual(0);
});
it(`should confirm the item descriptor insnt visible yet`, async() => {
const visible = await nightmare
.isVisible(selectors.ticketSales.saleDescriptorPopover);
const visible = await page.isVisible(selectors.ticketSales.saleDescriptorPopover);
expect(visible).toBeFalsy();
});
it(`should click on the first sale ID making the item descriptor visible`, async() => {
const visible = await nightmare
.waitToClick(selectors.ticketSales.firstSaleId)
.waitImgLoad(selectors.ticketSales.firstSaleDescriptorImage)
.isVisible(selectors.ticketSales.saleDescriptorPopover);
await page.waitToClick(selectors.ticketSales.firstSaleId);
await page.waitImgLoad(selectors.ticketSales.firstSaleDescriptorImage);
const visible = await page.isVisible(selectors.ticketSales.saleDescriptorPopover);
expect(visible).toBeTruthy();
});
it(`should click on the descriptor image of the 1st sale and see the zoomed image`, async() => {
const result = await nightmare
.clickIfVisible('vn-item-descriptor img')
.countElement(selectors.ticketSales.firstSaleZoomedImage);
await page.clickIfVisible('vn-item-descriptor img');
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
expect(result).toEqual(1);
});
it(`should now click on the zoomed image to close it`, async() => {
const result = await nightmare
.clickIfVisible(selectors.ticketSales.firstSaleZoomedImage)
.countElement(selectors.ticketSales.firstSaleZoomedImage);
await page.clickIfVisible(selectors.ticketSales.firstSaleZoomedImage);
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
expect(result).toEqual(0);
});
it(`should click on the summary icon of the item-descriptor to access to the item summary`, async() => {
const url = await nightmare
.waitToClick(selectors.ticketSales.saleDescriptorPopoverSummaryButton)
.waitForURL('/summary')
.parsedUrl();
await page.waitToClick(selectors.ticketSales.saleDescriptorPopoverSummaryButton);
await page.waitForURL('/summary');
const url = await page.parsedUrl();
expect(url.hash).toContain('/summary');
});
it('should return to ticket sales section', async() => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.accessToSearchResult(16)
.accessToSection('ticket.card.sale')
.waitForURL('/sale')
.parsedUrl();
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.wait(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.ticketsButton);
await page.accessToSearchResult(16);
await page.accessToSection('ticket.card.sale');
await page.waitForURL('/sale');
const url = await page.parsedUrl();
expect(url.hash).toContain('/sale');
});
it('should try to add a higher quantity value and then receive an error', async() => {
const result = await nightmare
.focusElement(selectors.ticketSales.firstSaleQuantityCell)
.write(selectors.ticketSales.firstSaleQuantity, '11\u000d')
.waitForLastSnackbar();
await page.focusElement(selectors.ticketSales.firstSaleQuantityCell);
await page.write(selectors.ticketSales.firstSaleQuantity, '11\u000d');
const message = await page.waitForSnackbar();
expect(result).toEqual('The new quantity should be smaller than the old one');
expect(message.text).toBe('The new quantity should be smaller than the old one');
});
it('should remove 1 from the first sale quantity', async() => {
const result = await nightmare
.focusElement(selectors.ticketSales.firstSaleQuantityCell)
.write(selectors.ticketSales.firstSaleQuantity, '9\u000d')
.waitForLastSnackbar();
await page.focusElement(selectors.ticketSales.firstSaleQuantityCell);
await page.write(selectors.ticketSales.firstSaleQuantity, '9\u000d');
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should update the price', async() => {
const result = await nightmare
.waitToClick(`${selectors.ticketSales.firstSalePrice} > span`)
.write(selectors.ticketSales.firstSalePriceInput, '5\u000d')
.waitForLastSnackbar();
await page.waitToClick(`${selectors.ticketSales.firstSalePrice} > span`);
await page.write(selectors.ticketSales.firstSalePriceInput, '5\u000d');
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the price have been updated', async() => {
const result = await nightmare
.waitToGetProperty(`${selectors.ticketSales.firstSalePrice} span`, 'innerText');
const result = await page.waitToGetProperty(`${selectors.ticketSales.firstSalePrice} span`, 'innerText');
expect(result).toContain('5.00');
});
it('should confirm the total price for that item have been updated', async() => {
const result = await nightmare
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
const result = await page.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
expect(result).toContain('45.00');
});
it('should update the discount', async() => {
const result = await nightmare
.waitToClick(`${selectors.ticketSales.firstSaleDiscount} > span`)
.write(selectors.ticketSales.firstSaleDiscountInput, '50\u000d')
.waitForLastSnackbar();
await page.waitToClick(`${selectors.ticketSales.firstSaleDiscount} > span`);
await page.write(selectors.ticketSales.firstSaleDiscountInput, '50\u000d');
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the discount have been updated', async() => {
const result = await nightmare
.waitForTextInElement(`${selectors.ticketSales.firstSaleDiscount} > span`, '50.00%')
.waitToGetProperty(`${selectors.ticketSales.firstSaleDiscount} > span`, 'innerText');
await page.waitForTextInElement(`${selectors.ticketSales.firstSaleDiscount} > span`, '50.00%');
const result = await page.waitToGetProperty(`${selectors.ticketSales.firstSaleDiscount} > span`, 'innerText');
expect(result).toContain('50.00%');
});
it('should confirm the total import for that item have been updated', async() => {
const result = await nightmare
.waitForTextInElement(selectors.ticketSales.firstSaleImport, '22.50')
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
await page.waitForTextInElement(selectors.ticketSales.firstSaleImport, '22.50');
const result = await page.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
expect(result).toContain('22.50');
});
it('should select the third sale and create a claim of it', async() => {
const url = await nightmare
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
.waitToClick(selectors.ticketSales.moreMenu)
.waitToClick(selectors.ticketSales.moreMenuCreateClaim)
.wait(selectors.claimBasicData.claimState)
.parsedUrl();
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
await page.waitToClick(selectors.ticketSales.moreMenu);
await page.waitToClick(selectors.ticketSales.moreMenuCreateClaim);
await page.wait(selectors.claimBasicData.claimState);
const url = await page.parsedUrl();
expect(url.hash).toContain('basic-data');
});
it('should click on the Claims button of the top bar menu', async() => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.claimsButton)
.wait(selectors.claimsIndex.searchClaimInput)
.parsedUrl();
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.wait(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.claimsButton);
await page.wait(selectors.claimsIndex.searchClaimInput);
const url = await page.parsedUrl();
expect(url.hash).toEqual('#!/claim/index');
});
it('should search for the claim with id 4', async() => {
const result = await nightmare
.write(selectors.claimsIndex.searchClaimInput, 4)
.waitToClick(selectors.claimsIndex.searchButton)
.waitForNumberOfElements(selectors.claimsIndex.searchResult, 1)
.countElement(selectors.claimsIndex.searchResult);
await page.write(selectors.claimsIndex.searchClaimInput, 4);
await page.waitToClick(selectors.claimsIndex.searchButton);
await page.waitForNumberOfElements(selectors.claimsIndex.searchResult, 1);
const result = await page.countElement(selectors.claimsIndex.searchResult);
expect(result).toEqual(1);
});
it('should click the Tickets button of the top bar menu', async() => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.topbarSearch)
.parsedUrl();
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.wait(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.ticketsButton);
await page.wait(selectors.ticketsIndex.topbarSearch);
const url = await page.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
});
it('should search for a ticket then access to the sales section', async() => {
const url = await nightmare
.accessToSearchResult(16)
.accessToSection('ticket.card.sale')
.waitForURL('/sale')
.parsedUrl();
await page.accessToSearchResult(16);
await page.accessToSection('ticket.card.sale');
await page.waitForURL('/sale');
const url = await page.parsedUrl();
expect(url.hash).toContain('/sale');
});
it('should select the third sale and delete it', async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
.waitToClick(selectors.ticketSales.deleteSaleButton)
.waitToClick(selectors.ticketSales.acceptDeleteLineButton)
.waitForSpinnerLoad()
.waitForLastSnackbar();
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
await page.waitToClick(selectors.ticketSales.deleteSaleButton);
await page.waitToClick(selectors.ticketSales.acceptDeleteLineButton);
await page.waitForSpinnerLoad();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should confirm the third sale was deleted`, async() => {
const result = await nightmare
.countElement(selectors.ticketSales.saleLine);
const result = await page.countElement(selectors.ticketSales.saleLine);
expect(result).toEqual(3);
});
@ -265,67 +238,60 @@ xdescribe('Ticket Edit sale path', () => {
it('should select the second sale and transfer it to a valid ticket', async() => {
const targetTicketId = 12;
const result = await nightmare
.waitToClick(selectors.ticketSales.secondSaleCheckbox)
.waitToClick(selectors.ticketSales.transferSaleButton)
.focusElement(selectors.ticketSales.transferQuantityCell)
.write(selectors.ticketSales.transferQuantityInput, '10\u000d')
.write(selectors.ticketSales.moveToTicketInput, targetTicketId)
.waitToClick(selectors.ticketSales.moveToTicketButton)
.waitForURL(`ticket/${targetTicketId}/sale`)
.parsedUrl();
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
await page.waitToClick(selectors.ticketSales.transferSaleButton);
await page.focusElement(selectors.ticketSales.transferQuantityCell);
await page.write(selectors.ticketSales.transferQuantityInput, '10\u000d');
await page.write(selectors.ticketSales.moveToTicketInput, targetTicketId);
await page.waitToClick(selectors.ticketSales.moveToTicketButton);
await page.waitForURL(`ticket/${targetTicketId}/sale`);
const result = await page.parsedUrl();
expect(result.hash).toContain(`ticket/${targetTicketId}/sale`);
});
it('should confirm the transfered line is the correct one', async() => {
const result = await nightmare
.wait(selectors.ticketSales.secondSaleText)
.waitToGetProperty(selectors.ticketSales.secondSaleText, 'innerText');
await page.wait(selectors.ticketSales.secondSaleText);
const result = await page.waitToGetProperty(selectors.ticketSales.secondSaleText, 'innerText');
expect(result).toContain(`Melee weapon heavy shield`);
});
it('should confirm the transfered quantity is the correct one', async() => {
const result = await nightmare
.waitToGetProperty(selectors.ticketSales.secondSaleQuantityCell, 'innerText');
const result = await page.waitToGetProperty(selectors.ticketSales.secondSaleQuantityCell, 'innerText');
expect(result).toContain('10');
});
it('should go back to the original ticket sales section', async() => {
const url = await nightmare
.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton)
.accessToSearchResult(16)
.accessToSection('ticket.card.sale')
.waitForURL('/sale')
.parsedUrl();
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
await page.accessToSearchResult(16);
await page.accessToSection('ticket.card.sale');
await page.waitForURL('/sale');
const url = await page.parsedUrl();
expect(url.hash).toContain('/sale');
});
it(`should confirm the original ticket has still three lines`, async() => {
const result = await nightmare
.wait(selectors.ticketSales.saleLine)
.countElement(selectors.ticketSales.saleLine);
await page.wait(selectors.ticketSales.saleLine);
const result = await page.countElement(selectors.ticketSales.saleLine);
expect(result).toEqual(3);
});
it(`should confirm the second sale quantity is now half of it's original value after the transfer`, async() => {
const result = await nightmare
.waitToGetProperty(selectors.ticketSales.secondSaleQuantityCell, 'innerText');
const result = await page.waitToGetProperty(selectors.ticketSales.secondSaleQuantityCell, 'innerText');
expect(result).toContain('10');
});
it('should go back to the receiver ticket sales section', async() => {
const url = await nightmare
.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton)
.accessToSearchResult(12)
.accessToSection('ticket.card.sale')
.waitForURL('/sale')
.parsedUrl();
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
await page.accessToSearchResult(12);
await page.accessToSection('ticket.card.sale');
await page.waitForURL('/sale');
const url = await page.parsedUrl();
expect(url.hash).toContain('/sale');
});
@ -333,44 +299,40 @@ xdescribe('Ticket Edit sale path', () => {
it('should transfer the sale back to the original ticket', async() => {
const targetTicketId = 16;
const result = await nightmare
.waitToClick(selectors.ticketSales.secondSaleCheckbox)
.waitToClick(selectors.ticketSales.transferSaleButton)
.write(selectors.ticketSales.moveToTicketInput, targetTicketId)
.waitToClick(selectors.ticketSales.moveToTicketButton)
.waitForURL(`ticket/${targetTicketId}/sale`)
.parsedUrl();
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
await page.waitToClick(selectors.ticketSales.transferSaleButton);
await page.write(selectors.ticketSales.moveToTicketInput, targetTicketId);
await page.waitToClick(selectors.ticketSales.moveToTicketButton);
await page.waitForURL(`ticket/${targetTicketId}/sale`);
const result = await page.parsedUrl();
expect(result.hash).toContain(`ticket/${targetTicketId}/sale`);
});
it('should confirm the original ticket received the line', async() => {
const expectedLines = 4;
const result = await nightmare
.waitForNumberOfElements(selectors.ticketSales.saleLine, expectedLines)
.countElement(selectors.ticketSales.saleLine);
await page.waitForNumberOfElements(selectors.ticketSales.saleLine, expectedLines);
const result = await page.countElement(selectors.ticketSales.saleLine);
expect(result).toEqual(expectedLines);
});
it(`should throw an error when attempting to create a ticket for an inactive client`, async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.transferSaleButton)
.waitToClick(selectors.ticketSales.moveToNewTicketButton)
.waitToClick(selectors.ticketSales.acceptDeleteTicketButton)
.waitForLastSnackbar();
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
await page.waitToClick(selectors.ticketSales.transferSaleButton);
await page.waitToClick(selectors.ticketSales.moveToNewTicketButton);
await page.waitToClick(selectors.ticketSales.acceptDeleteTicketButton);
const message = await page.waitForSnackbar();
expect(result).toEqual(`You can't create a ticket for a inactive client`);
expect(message.text).toBe(`You can't create a ticket for a inactive client`);
});
it('should go now to the ticket sales section of an active, not frozen client', async() => {
const url = await nightmare
.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton)
.accessToSearchResult(13)
.accessToSection('ticket.card.sale')
.waitForURL('/sale')
.parsedUrl();
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
await page.accessToSearchResult(13);
await page.accessToSection('ticket.card.sale');
await page.waitForURL('/sale');
const url = await page.parsedUrl();
expect(url.hash).toContain('/sale');
});
@ -378,118 +340,106 @@ xdescribe('Ticket Edit sale path', () => {
it(`should select all sales, tranfer them to a new ticket and delete the sender ticket as it would've been left empty`, async() => {
const senderTicketId = 13;
const url = await nightmare
.waitToClick(selectors.ticketSales.selectAllSalesCheckbox)
.waitToClick(selectors.ticketSales.transferSaleButton)
.waitToClick(selectors.ticketSales.moveToNewTicketButton)
.waitToClick(selectors.ticketSales.acceptDeleteTicketButton)
.wait((selector, ticketId) => {
return document.querySelector(selector).innerText.toLowerCase().indexOf(`${ticketId}`) == -1;
}, selectors.ticketDescriptor.idLabelValue, senderTicketId)
.parsedUrl();
await page.waitToClick(selectors.ticketSales.selectAllSalesCheckbox);
await page.waitToClick(selectors.ticketSales.transferSaleButton);
await page.waitToClick(selectors.ticketSales.moveToNewTicketButton);
await page.waitToClick(selectors.ticketSales.acceptDeleteTicketButton);
await page.wait((selector, ticketId) => {
return document.querySelector(selector).innerText.toLowerCase().indexOf(`${ticketId}`) == -1;
}, selectors.ticketDescriptor.idLabelValue, senderTicketId);
const url = await page.parsedUrl();
expect(url.hash).toContain('/sale');
});
it('should confirm the new ticket received the line', async() => {
const result = await nightmare
.countElement(selectors.ticketSales.saleLine);
const result = await page.countElement(selectors.ticketSales.saleLine);
expect(result).toEqual(1);
});
it('should check the first sale reserved icon isnt visible', async() => {
const result = await nightmare
.isVisible(selectors.ticketSales.firstSaleReservedIcon);
const result = await page.isVisible(selectors.ticketSales.firstSaleReservedIcon);
expect(result).toBeFalsy();
});
it('should mark the first sale as reserved', async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.moreMenu)
.waitToClick(selectors.ticketSales.moreMenuReserve)
.waitForClassNotPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide')
.isVisible(selectors.ticketSales.firstSaleReservedIcon);
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
await page.waitToClick(selectors.ticketSales.moreMenu);
await page.waitToClick(selectors.ticketSales.moreMenuReserve);
await page.waitForClassNotPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide');
const result = await page.isVisible(selectors.ticketSales.firstSaleReservedIcon);
expect(result).toBeTruthy();
});
it('should unmark the first sale as reserved', async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.moreMenu)
.waitToClick(selectors.ticketSales.moreMenuUnmarkReseved)
.waitForClassPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide')
.isVisible(selectors.ticketSales.firstSaleReservedIcon);
await page.waitToClick(selectors.ticketSales.moreMenu);
await page.waitToClick(selectors.ticketSales.moreMenuUnmarkReseved);
await page.waitForClassPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide');
const result = await page.isVisible(selectors.ticketSales.firstSaleReservedIcon);
expect(result).toBeFalsy();
});
it('should update all sales discount', async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.moreMenu)
.waitToClick(selectors.ticketSales.moreMenuUpdateDiscount)
// .write(selectors.ticketSales.moreMenuUpdateDiscountInput, 100) can't find the selector on app (deleted the selector), menu option was removed?
.write('body', '\u000d')
.waitForTextInElement(selectors.ticketSales.totalImport, '0.00')
.waitToGetProperty(selectors.ticketSales.totalImport, 'innerText');
await page.waitToClick(selectors.ticketSales.moreMenu);
await page.waitToClick(selectors.ticketSales.moreMenuUpdateDiscount);
// .write(selectors.ticketSales.moreMenuUpdateDiscountInput, 100) can't find the selector on app (deleted the selector), menu option was removed?
await page.write('body', '\u000d');
await page.waitForTextInElement(selectors.ticketSales.totalImport, '0.00');
const result = await page.waitToGetProperty(selectors.ticketSales.totalImport, 'innerText');
expect(result).toContain('0.00');
});
it('should log in as Production role and go to a target ticket summary', async() => {
const url = await nightmare
.loginAndModule('production', 'ticket')
.accessToSearchResult(13)
.waitForURL('/summary')
.parsedUrl();
await page.loginAndModule('production', 'ticket');
await page.accessToSearchResult(13);
await page.waitForURL('/summary');
const url = await page.parsedUrl();
expect(url.hash).toContain('/summary');
});
it(`should check it's state is deleted`, async() => {
const result = await nightmare
.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
const result = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
expect(result).toEqual('State Eliminado');
});
describe('when state is preparation and loged as Production', () => {
it(`should not be able to edit the sale price`, async() => {
const result = await nightmare
.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton)
.accessToSearchResult(8)
.accessToSection('ticket.card.sale')
.waitToClick(selectors.ticketSales.firstSalePrice)
.exists(selectors.ticketSales.firstSalePriceInput);
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
await page.accessToSearchResult(8);
await page.accessToSection('ticket.card.sale');
await page.waitToClick(selectors.ticketSales.firstSalePrice);
const result = await page.exists(selectors.ticketSales.firstSalePriceInput);
expect(result).toBeFalsy();
});
it(`should not be able to edit the sale discount`, async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.firstSaleDiscount)
.exists(selectors.ticketSales.firstSaleDiscountInput);
await page.waitToClick(selectors.ticketSales.firstSaleDiscount);
const result = await page.exists(selectors.ticketSales.firstSaleDiscountInput);
expect(result).toBeFalsy();
});
it(`should not be able to edit the sale state`, async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.stateMenuButton)
.exists(selectors.ticketSales.stateMenuOptions);
await page.waitToClick(selectors.ticketSales.stateMenuButton);
const result = await page.exists(selectors.ticketSales.stateMenuOptions);
expect(result).toBeFalsy();
});
it('should log in as salesPerson then go to the sales of a target ticket', async() => {
const url = await nightmare
.loginAndModule('salesPerson', 'ticket')
.accessToSearchResult(8)
.accessToSection('ticket.card.sale')
.waitForURL('/sale')
.parsedUrl();
await page.loginAndModule('salesPerson', 'ticket');
await page.accessToSearchResult(8);
await page.accessToSection('ticket.card.sale');
await page.waitForURL('/sale');
const url = await page.parsedUrl();
expect(url.hash).toContain('/sale');
});
@ -497,25 +447,22 @@ xdescribe('Ticket Edit sale path', () => {
describe('when state is preparation and loged as salesPerson', () => {
it(`shouldn't be able to edit the sale price`, async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.firstSalePrice)
.exists(selectors.ticketSales.firstSalePriceInput);
await page.waitToClick(selectors.ticketSales.firstSalePrice);
const result = await page.exists(selectors.ticketSales.firstSalePriceInput);
expect(result).toBeFalsy();
});
it(`should be able to edit the sale discount`, async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.firstSaleDiscount)
.exists(selectors.ticketSales.firstSaleDiscountInput);
await page.waitToClick(selectors.ticketSales.firstSaleDiscount);
const result = await page.exists(selectors.ticketSales.firstSaleDiscountInput);
expect(result).toBeFalsy();
});
it(`should not be able to edit the sale state`, async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.stateMenuButton)
.exists(selectors.ticketSales.stateMenuOptions);
await page.waitToClick(selectors.ticketSales.stateMenuButton);
const result = await page.exists(selectors.ticketSales.stateMenuOptions);
expect(result).toBeFalsy();
});

View File

@ -22,9 +22,9 @@ describe('Ticket Create notes path', () => {
await page.autocompleteSearch(selectors.ticketNotes.firstNoteType, 'observation one');
await page.write(selectors.ticketNotes.firstDescription, 'description');
await page.waitToClick(selectors.ticketNotes.submitNotesButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the note is the expected one', async() => {
@ -43,8 +43,8 @@ describe('Ticket Create notes path', () => {
it('should delete the note', async() => {
await page.waitToClick(selectors.ticketNotes.firstNoteRemoveButton);
await page.waitToClick(selectors.ticketNotes.submitNotesButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
});

View File

@ -22,18 +22,18 @@ describe('Ticket Create packages path', () => {
await page.waitToClick(selectors.ticketPackages.addPackageButton);
await page.write(selectors.ticketPackages.firstQuantity, '99');
await page.waitToClick(selectors.ticketPackages.savePackagesButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Package cannot be blank');
expect(message.text).toBe('Package cannot be blank');
});
it(`should delete the first package and receive and error to save a new one with blank quantity`, async() => {
await page.clearInput(selectors.ticketPackages.firstQuantity);
await page.autocompleteSearch(selectors.ticketPackages.firstPackage, 'Container medical box 1m');
await page.waitToClick(selectors.ticketPackages.savePackagesButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Some fields are invalid');
expect(message.text).toBe('Some fields are invalid');
});
it(`should confirm the quantity input isn't invalid yet`, async() => {
@ -49,9 +49,9 @@ describe('Ticket Create packages path', () => {
await page.clearInput(selectors.ticketPackages.firstQuantity);
await page.write(selectors.ticketPackages.firstQuantity, '-99');
await page.waitToClick(selectors.ticketPackages.savePackagesButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should confirm the first select is the expected one`, async() => {

View File

@ -26,17 +26,17 @@ describe('Ticket Create new tracking state path', () => {
it(`should attempt create a new state but receive an error if state is empty`, async() => {
await page.waitToClick(selectors.createStateView.saveStateButton);
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('State cannot be blank');
expect(message.text).toBe('State cannot be blank');
});
it(`should create a new state`, async() => {
await page.autocompleteSearch(selectors.createStateView.state, '¿Fecha?');
await page.waitToClick(selectors.createStateView.saveStateButton);
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
});
@ -56,14 +56,14 @@ describe('Ticket Create new tracking state path', () => {
await page.waitFor(1500);
await page.autocompleteSearch(selectors.createStateView.state, 'Encajado');
await page.waitToClick(selectors.createStateView.saveStateButton);
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual(`You don't have enough privileges`);
expect(message.text).toBe(`You don't have enough privileges`);
});
it(`should make sure the worker gets autocomplete uppon selecting the assigned state`, async() => {
await page.autocompleteSearch(selectors.createStateView.state, 'asignado');
let result = await page
const result = await page
.waitToGetProperty(selectors.createStateView.worker, 'value');
expect(result).toEqual('salesPersonNick');
@ -71,9 +71,9 @@ describe('Ticket Create new tracking state path', () => {
it(`should succesfully create a valid state`, async() => {
await page.waitToClick(selectors.createStateView.saveStateButton);
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
});
});

View File

@ -31,9 +31,9 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn);
await page.waitToClick(selectors.ticketDescriptor.thursdayButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should again click on the Tickets button of the top bar menu', async() => {
@ -66,9 +66,9 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn);
await page.waitToClick(selectors.ticketDescriptor.saturdayButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should click on the Tickets button of the top bar menu once again', async() => {
@ -95,9 +95,9 @@ describe('Ticket descriptor path', () => {
it('should delete the weekly ticket 11', async() => {
await page.waitToClick(selectors.ticketsIndex.firstWeeklyTicketDeleteIcon);
await page.waitToClick(selectors.ticketsIndex.acceptDeleteTurn);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the sixth weekly ticket was deleted', async() => {
@ -109,13 +109,13 @@ describe('Ticket descriptor path', () => {
it('should update the agency then remove it afterwards', async() => {
await page.autocompleteSearch(selectors.ticketsIndex.firstWeeklyTicketAgency, 'Silla247');
let result = await page.waitForLastSnackbar();
let message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
await page.clearInput(selectors.ticketsIndex.firstWeeklyTicketAgency);
result = await page.waitForLastSnackbar();
message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
});

View File

@ -24,9 +24,9 @@ describe('Ticket purchase request path', () => {
await page.autocompleteSearch(selectors.ticketRequests.atender, 'buyerNick');
await page.write(selectors.ticketRequests.price, '999');
await page.waitToClick(selectors.ticketRequests.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should have been redirected to the request index', async() => {
@ -36,9 +36,9 @@ describe('Ticket purchase request path', () => {
it(`should edit the third request quantity as it's state is still new`, async() => {
await page.write(selectors.ticketRequests.thirdRequestQuantity, '9');
await page.keyboard.press('Enter');
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the new request was added', async() => {
@ -64,9 +64,9 @@ describe('Ticket purchase request path', () => {
it('should delete the added request', async() => {
await page.waitToClick(selectors.ticketRequests.thirdRemoveRequestButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the request was deleted', async() => {

View File

@ -1,66 +1,31 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
// #2026 Fallo en relocate de descriptor popover
// #2221 Local MySQL8 crashes when rest method Items/getDiary is called
xdescribe('Ticket diary path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
page = (await getBrowser()).page;
await page.loginAndModule('employee', 'ticket');
});
afterAll(async() => {
await browser.close();
await page.browser().close();
});
it('should search for a specific ticket', async() => {
await page.write(selectors.ticketsIndex.topbarSearch, '1');
await page.waitToClick(selectors.ticketsIndex.searchButton);
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
const result = await page.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the search result to access to the ticket summary`, async() => {
await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave');
await page.waitToClick(selectors.ticketsIndex.searchResult);
let url = await page.expectURL('/summary'); // use waitForState instead
expect(url).toBe(true);
});
it(`should navigate to the item diary from the 1st sale item id descriptor popover`, async() => {
it(`should navigate to item diary from ticket sale and check the lines`, async() => {
await page.accessToSearchResult('1');
await page.waitToClick(selectors.ticketSummary.firstSaleItemId);
await page.waitForTransitionEnd('.vn-popover');
await page.waitToClick(selectors.ticketSummary.popoverDiaryButton);
let url = await page.expectURL('/diary'); // use waitForState instead
await page.waitForState('item.card.diary');
expect(url).toBe(true);
});
const secondIdClass = await page.getClassName(selectors.itemDiary.secondTicketId);
const fourthBalanceClass = await page.getClassName(selectors.itemDiary.fourthBalance);
const firstBalanceClass = await page.getClassName(selectors.itemDiary.firstBalance);
it(`should check the second line id is marked as message`, async() => {
const result = await page
.waitToGetProperty(selectors.itemDiary.secondTicketId, 'className');
expect(result).toContain('message');
});
it(`should check the third line balance is marked as message`, async() => {
const result = await page
.waitToGetProperty(`${selectors.itemDiary.fourthBalance} > span`, 'className');
expect(result).toContain('message');
});
it(`should change to the warehouse two and check there are sales marked as negative balance`, async() => {
await page.autocompleteSearch(selectors.itemDiary.warehouse, 'Warehouse Two');
const result = await page
.waitToGetProperty(selectors.itemDiary.firstBalance, 'className');
expect(result).toContain('balance');
expect(secondIdClass).toContain('message');
expect(fourthBalanceClass).toContain('message');
expect(firstBalanceClass).toContain('balance');
});
});

View File

@ -26,9 +26,9 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketDescriptor.moreMenuChangeShippedHour);
await page.pickTime(selectors.ticketDescriptor.changeShippedHour, '08:15');
await page.waitToClick(selectors.ticketDescriptor.acceptChangeHourButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Shipped hour updated');
expect(message.text).toBe('Shipped hour updated');
});
it(`should confirm the ticket descriptor shows the correct shipping hour`, async() => {
@ -42,9 +42,9 @@ describe('Ticket descriptor path', () => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket);
await page.waitToClick(selectors.ticketDescriptor.acceptDeleteButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Ticket deleted');
expect(message.text).toBe('Ticket deleted');
});
it('should have been relocated to the ticket index', async() => {
@ -82,9 +82,9 @@ describe('Ticket descriptor path', () => {
it('should add a ticket as stowaway', async() => {
await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should check the state of the stowaway ticket is embarked`, async() => {
@ -103,9 +103,9 @@ describe('Ticket descriptor path', () => {
await page.waitForContentLoaded();
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton);
await page.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should confirm the ship buton doesn't exisist any more`, async() => {
@ -134,9 +134,9 @@ describe('Ticket descriptor path', () => {
await page.waitForContentLoaded();
await page.waitToClick(selectors.ticketDescriptor.moreMenuMakeInvoice);
await page.waitToClick(selectors.ticketDescriptor.acceptInvoiceOutButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Ticket invoiced');
expect(message.text).toBe('Ticket invoiced');
});
it(`should make sure the ticket summary have an invoiceOutFk`, async() => {

View File

@ -32,9 +32,9 @@ describe('Ticket services path', () => {
await page.clearInput(selectors.ticketService.firstPrice);
await page.write(selectors.ticketService.firstPrice, '999');
await page.waitToClick(selectors.ticketService.saveServiceButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual(`The current ticket can't be modified`);
expect(message.text).toBe(`The current ticket can't be modified`);
});
});
@ -56,9 +56,9 @@ describe('Ticket services path', () => {
it('should receive an error if you attempt to save it with empty fields', async() => {
await page.waitToClick(selectors.ticketService.saveServiceButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual(`can't be blank`);
expect(message.text).toBe(`can't be blank`);
});
it('should click on the add new service type to open the dialog', async() => {
@ -71,9 +71,9 @@ describe('Ticket services path', () => {
it('should receive an error if service type is empty on submit', async() => {
await page.waitToClick(selectors.ticketService.saveServiceTypeButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual(`Name can't be empty`);
expect(message.text).toBe(`Name can't be empty`);
});
it('should create a new service type then add price then create the service', async() => {
@ -82,9 +82,9 @@ describe('Ticket services path', () => {
await page.waitToClick(selectors.ticketService.saveServiceTypeButton);
await page.write(selectors.ticketService.firstPrice, '999');
await page.waitToClick(selectors.ticketService.saveServiceButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the service description was created correctly', async() => {
@ -120,9 +120,9 @@ describe('Ticket services path', () => {
await page.waitToClick(selectors.ticketService.fistDeleteServiceButton);
await page.waitForNumberOfElements(selectors.ticketService.serviceLine, 0);
await page.waitToClick(selectors.ticketService.saveServiceButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should confirm the service was removed`, async() => {

View File

@ -30,9 +30,9 @@ describe('Ticket create path', () => {
await page.autocompleteSearch(selectors.createTicketView.warehouse, 'Warehouse One');
await page.autocompleteSearch(selectors.createTicketView.agency, 'Silla247');
await page.waitToClick(selectors.createTicketView.createButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should check the url is now the summary of the ticket', async() => {

View File

@ -78,14 +78,14 @@ describe('Ticket Summary path', () => {
it('should click on the SET OK button', async() => {
await page.waitToClick(selectors.ticketSummary.setOk);
let result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the ticket state was updated', async() => {
await page.waitForSpinnerLoad();
let result = await page.waitToGetProperty(selectors.ticketSummary.state, 'innerText');
const result = await page.waitToGetProperty(selectors.ticketSummary.state, 'innerText');
expect(result).toContain('OK');
});

View File

@ -27,9 +27,9 @@ describe('Ticket log path', () => {
await page.autocompleteSearch(selectors.ticketNotes.firstNoteType, 'observation one');
await page.write(selectors.ticketNotes.firstDescription, 'description');
await page.waitToClick(selectors.ticketNotes.submitNotesButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should navigate to the log section', async() => {

View File

@ -24,9 +24,9 @@ describe('Ticket index payout path', () => {
await page.waitToClick(selectors.ticketsIndex.secondTicketCheckbox);
await page.waitToClick(selectors.ticketsIndex.sixthTicketCheckbox);
await page.waitToClick(selectors.ticketsIndex.payoutButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('You cannot make a payment on account from multiple clients');
expect(message.text).toBe('You cannot make a payment on account from multiple clients');
});
it('should uncheck the sixth ticket result and check the third which is from the same client then open the payout form', async() => {
@ -40,9 +40,9 @@ describe('Ticket index payout path', () => {
it('should fill the company and bank to perform a payout', async() => {
await page.autocompleteSearch(selectors.ticketsIndex.payoutBank, 'cash');
await page.waitToClick(selectors.ticketsIndex.submitPayout);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should navigate to the client balance section and check a new balance line was entered', async() => {

View File

@ -25,9 +25,9 @@ describe('Claim edit basic data path', () => {
await page.clearTextarea(selectors.claimBasicData.observation);
await page.write(selectors.claimBasicData.observation, 'edited observation');
await page.waitToClick(selectors.claimBasicData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should have been redirected to the next section of claims as the role is salesAssistant`, async() => {
@ -54,8 +54,8 @@ describe('Claim edit basic data path', () => {
await page.clearTextarea(selectors.claimBasicData.observation);
await page.write(selectors.claimBasicData.observation, 'Observation one');
await page.waitToClick(selectors.claimBasicData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
});

View File

@ -26,9 +26,9 @@ describe('Claim development', () => {
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimWorker, 'deliveryNick');
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimRedelivery, 'Reparto');
await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should redirect to the next section of claims as the role is salesAssistant`, async() => {
@ -43,9 +43,9 @@ describe('Claim development', () => {
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimWorker, 'adminAssistantNick');
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimRedelivery, 'Cliente');
await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the first development is the expected one', async() => {

View File

@ -21,9 +21,9 @@ xdescribe('Claim detail', () => {
it('should add the first claimable item from ticket to the claim', async() => {
await page.waitToClick(selectors.claimDetail.addItemButton);
await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the claim contains now two items', async() => {
@ -36,9 +36,9 @@ xdescribe('Claim detail', () => {
await page.clearInput(selectors.claimDetail.firstItemQuantityInput); // selector deleted, find new upon fixes
await page.write(selectors.claimDetail.firstItemQuantityInput, '4'); // selector deleted, find new upon fixes
await page.keyboard.press('Enter');
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the first item quantity, and the claimed total were correctly edited', async() => {
@ -65,9 +65,9 @@ xdescribe('Claim detail', () => {
await page.waitToClick(selectors.claimDetail.secondItemDiscount);
await page.write(selectors.claimDetail.discount, '100');
await page.keyboard.press('Enter');
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should check the mana is the expected one', async() => {
@ -79,9 +79,9 @@ xdescribe('Claim detail', () => {
it('should delete the second item from the claim', async() => {
await page.waitToClick(selectors.claimDetail.secondItemDeleteButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the claim contains now one item', async() => {
@ -93,9 +93,9 @@ xdescribe('Claim detail', () => {
it('should add the deleted ticket from to the claim', async() => {
await page.waitToClick(selectors.claimDetail.addItemButton);
await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should have been redirected to the next section in claims`, async() => {

View File

@ -19,9 +19,9 @@ describe('Claim action path', () => {
it('should import the claim', async() => {
await page.waitToClick(selectors.claimAction.importClaimButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should import the second importable ticket', async() => {
@ -31,24 +31,24 @@ describe('Claim action path', () => {
await page.waitToClick(selectors.claimAction.importTicketButton);
await page.waitToClick(selectors.claimAction.secondImportableTicket);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should edit the second line destination field', async() => {
await page.waitForContentLoaded();
await page.autocompleteSearch(selectors.claimAction.secondLineDestination, 'Bueno');
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should delete the first line', async() => {
await page.waitToClick(selectors.claimAction.firstDeleteLine);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toContain('Data saved!');
expect(message.type).toBe('success');
});
it('should refresh the view to check the remaining line is the expected one', async() => {
@ -60,17 +60,17 @@ describe('Claim action path', () => {
it('should delete the current first line', async() => {
await page.waitToClick(selectors.claimAction.firstDeleteLine);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should check the "is paid with mana" checkbox', async() => {
page.waitFor(3000); // can't use waitForNavigation here and needs more time than a single second to get the section ready...
await page.waitToClick(selectors.claimAction.isPaidWithManaCheckbox);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the "is paid with mana" checkbox is checked', async() => {

View File

@ -40,9 +40,9 @@ describe('claim Descriptor path', () => {
it(`should delete the claim`, async() => {
await page.waitToClick(selectors.claimDescriptor.moreMenuDeleteClaim);
await page.waitToClick(selectors.claimDescriptor.acceptDeleteClaim);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Claim deleted!');
expect(message.text).toBe('Claim deleted!');
});
it(`should have been relocated to the claim index`, async() => {

View File

@ -23,9 +23,9 @@ describe('Order edit basic data path', () => {
await page.autocompleteSearch(selectors.orderBasicData.client, 'Tony Stark');
await page.autocompleteSearch(selectors.orderBasicData.address, 'Tony Stark');
await page.waitToClick(selectors.orderBasicData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual(`You can't make changes on the basic data of an confirmed order or with rows`);
expect(message.text).toBe(`You can't make changes on the basic data of an confirmed order or with rows`);
});
});
@ -45,9 +45,9 @@ describe('Order edit basic data path', () => {
it('should not be able to change anything', async() => {
await page.write(selectors.orderBasicData.observation, 'observation');
await page.waitToClick(selectors.orderBasicData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual(`You can't make changes on the basic data of an confirmed order or with rows`);
expect(message.text).toBe(`You can't make changes on the basic data of an confirmed order or with rows`);
});
});
@ -79,9 +79,9 @@ describe('Order edit basic data path', () => {
await page.autocompleteSearch(selectors.orderBasicData.agency, 'Silla247');
await page.write(selectors.orderBasicData.observation, 'my observation');
await page.waitToClick(selectors.orderBasicData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toContain('Data saved!');
expect(message.type).toBe('success');
});
it('should now confirm the client have been edited', async() => {

View File

@ -26,9 +26,9 @@ describe('Order lines', () => {
it('should delete the first line in the order', async() => {
await page.waitToClick(selectors.orderLine.firstLineDeleteButton);
await page.waitToClick(selectors.orderLine.confirmButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the order subtotal has changed', async() => {

View File

@ -31,9 +31,9 @@ describe('Route basic Data path', () => {
await page.type(`${selectors.routeBasicData.startedHour} input`, '0800');
await page.type(`${selectors.routeBasicData.finishedHour} input`, '1230');
await page.waitToClick(selectors.routeBasicData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the worker was edited', async() => {

View File

@ -24,9 +24,9 @@ describe('Route create path', () => {
it(`should attempt to create a new route but fail since employee has no access rights`, async() => {
await page.write(selectors.createRouteView.description, 'faster faster!!');
await page.waitToClick(selectors.createRouteView.submitButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Access denied');
expect(message.text).toBe('Access denied');
});
});
@ -48,9 +48,9 @@ describe('Route create path', () => {
await page.autocompleteSearch(selectors.createRouteView.agency, 'Teleportation device');
await page.write(selectors.createRouteView.description, 'faster faster!!');
await page.waitToClick(selectors.createRouteView.submitButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it(`should confirm the redirection to the created route summary`, async() => {

View File

@ -19,17 +19,15 @@ xdescribe('Route basic Data path', () => {
});
it('should modify the first ticket priority', async() => {
const result = await nightmare;
await page.write(selectors.routeTickets.firstTicketPriority, '2');
await page.keyboard.press('Enter');
await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should confirm the buscamanButton is disabled', async() => {
const result = await nightmare;
await page.evaluate(selector => {
const result = await page.evaluate(selector => {
return document.querySelector(selector);
}, `${selectors.routeTickets.buscamanButton} :disabled`);
@ -37,9 +35,8 @@ xdescribe('Route basic Data path', () => {
});
it('should check the first ticket checkbox and confirm the buscamanButton button is no longer disabled', async() => {
const result = await nightmare;
await page.waitToClick(selectors.routeTickets.firstTicketCheckbox);
await page.evaluate(selector => {
const result = await page.evaluate(selector => {
return document.querySelector(selector);
}, `${selectors.routeTickets.buscamanButton} :disabled`);
@ -47,47 +44,41 @@ xdescribe('Route basic Data path', () => {
});
it('should check the route volume on the descriptor', async() => {
const result = await nightmare;
await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText');
const result = await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText');
expect(result).toEqual('1.1 / 18 m³');
});
it('should count how many tickets are in route', async() => {
const result = await nightmare;
await page.countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]');
const result = await page.countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]');
expect(result).toEqual(11);
});
it('should delete the first ticket in route', async() => {
const result = await nightmare;
await page.waitToClick(selectors.routeTickets.firstTicketDeleteButton);
await page.waitToClick(selectors.routeTickets.confirmButton);
await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Ticket removed from route');
expect(message.text).toBe('Ticket removed from route');
});
it('should again delete the first ticket in route', async() => {
const result = await nightmare;
await page.waitToClick(selectors.routeTickets.firstTicketDeleteButton);
await page.waitToClick(selectors.routeTickets.confirmButton);
await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Ticket removed from route');
expect(message.text).toBe('Ticket removed from route');
});
it('should now count how many tickets are in route to find one less', async() => {
const result = await nightmare;
await page.countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]');
const result = await page.countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]');
expect(result).toEqual(9);
});
it('should confirm the route volume on the descriptor has been updated by the changes made', async() => {
const result = await nightmare;
await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText');
const result = await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText');
expect(result).toEqual('0.9 / 18 m³');
});

View File

@ -40,9 +40,9 @@ describe('InvoiceOut descriptor path', () => {
await page.waitToClick(selectors.invoiceOutDescriptor.moreMenu);
await page.waitToClick(selectors.invoiceOutDescriptor.moreMenuDeleteInvoiceOut);
await page.waitToClick(selectors.invoiceOutDescriptor.acceptDeleteButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('InvoiceOut deleted');
expect(message.text).toBe('InvoiceOut deleted');
});
it('should have been relocated to the invoiceOut index', async() => {
@ -93,9 +93,9 @@ describe('InvoiceOut descriptor path', () => {
await page.waitToClick(selectors.invoiceOutDescriptor.moreMenu);
await page.waitToClick(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut);
await page.waitToClick(selectors.invoiceOutDescriptor.acceptBookingButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('InvoiceOut booked');
expect(message.text).toBe('InvoiceOut booked');
});
it(`should check the invoiceOut booked in the summary data`, async() => {

View File

@ -27,17 +27,17 @@ describe('Travel basic data path', () => {
await page.pickDate(selectors.travelBasicDada.deliveryDate, lastMonth);
await page.waitToClick(selectors.travelBasicDada.save);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Landing cannot be lesser than shipment');
expect(message.text).toBe('Landing cannot be lesser than shipment');
});
it('should undo the changes', async() => {
await page.waitToClick(selectors.travelBasicDada.undoChanges);
await page.waitToClick(selectors.travelBasicDada.save);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('No changes to save');
expect(message.text).toBe('No changes to save');
});
it('should now edit the whole form then save', async() => {
@ -50,9 +50,9 @@ describe('Travel basic data path', () => {
await page.waitToClick(selectors.travelBasicDada.delivered);
await page.waitToClick(selectors.travelBasicDada.received);
await page.waitToClick(selectors.travelBasicDada.save);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should reload the section and check the reference was saved', async() => {

View File

@ -38,9 +38,9 @@ describe('Zone basic data path', () => {
await page.write(selectors.zoneBasicData.inflation, '200');
await page.waitToClick(selectors.zoneBasicData.volumetric);
await page.waitToClick(selectors.zoneBasicData.saveButton);
const result = await page.waitForLastSnackbar();
const message = await page.waitForSnackbar();
expect(result).toEqual('Data saved!');
expect(message.type).toBe('success');
});
it('should now reload the section', async() => {

View File

@ -45,8 +45,11 @@ export default class Auth {
}
login(user, password, remember) {
if (!user)
return this.$q.reject(new UserError('Please enter your username'));
if (!user) {
let err = new UserError('Please enter your username');
err.code = 'EmptyLogin';
return this.$q.reject(err);
}
let params = {
user,

View File

@ -1,12 +1,7 @@
import ngModule from '../module';
/**
* @property {Array} days Weekdays data array with the same indexes as Date.getDay()
* @property {Object} map Weekdays data map using weekday codes as key
* @property {Array} localeCodes Locale weekday codes indexes depend on current locale
* @property {Array} locale Weekday data array with indexes depending on current locale
*
* Weekday properties:
* Stores useful information about a weekday.
*
* @property {Number} index The weekday index acording to Date.getDay()
* @property {String} code The weekday code
@ -17,33 +12,34 @@ import ngModule from '../module';
* @property {String} localeChar The first weekday letter in current locale
* @property {String} localeAbr The abreviated 3 letters weekday name in current locale
*/
class WeekDays {
export class WeekDay {
constructor(code, name) {
this.code = code;
this.name = name;
}
}
/**
* Stores information about weekdays in many formats to be accessed in different
* ways depending on the context.
*
* @property {Array<WeekDay>} days Weekdays array with the same indexes as Date.getDay()
* @property {Object<WeekDay>} map Weekdays map using weekday codes as keys
* @property {Array<WeekDay>} locale Weekday data array with indexes depending on current locale
* @property {Array<String>} localeCodes Locale weekday codes with indexes depending on current locale
*/
export default class WeekDays {
constructor($translate) {
this.$translate = $translate;
this.days = [
{
code: 'sun',
name: 'Sunday'
}, {
code: 'mon',
name: 'Monday'
}, {
code: 'tue',
name: 'Tuesday'
}, {
code: 'wed',
name: 'Wednesday'
}, {
code: 'thu',
name: 'Thursday'
}, {
code: 'fri',
name: 'Friday'
}, {
code: 'sat',
name: 'Saturday'
}
new WeekDay('sun', 'Sunday'),
new WeekDay('mon', 'Monday'),
new WeekDay('tue', 'Tuesday'),
new WeekDay('wed', 'Wednesday'),
new WeekDay('thu', 'Thursday'),
new WeekDay('fri', 'Friday'),
new WeekDay('sat', 'Friday')
];
this.map = {};
@ -83,6 +79,13 @@ class WeekDays {
this.locales.push(this.map[code]);
}
/**
* Transforms weekday set into an array whose indexes are weekday index
* with selected days set to %true.
*
* @param {String} weekDays Weekday codes separated by commas
* @return {Array<Boolean>} Array with selected days set to %true
*/
fromSet(weekDays) {
let wdays = [];
@ -97,6 +100,14 @@ class WeekDays {
return wdays;
}
/**
* Perform the inverse operation of fromSet() method. Transforms an
* array whose indexes are weekday index with selected days set to %true to
* weekday codes separated by commas.
*
* @param {Array<Boolean>} wdays Array with selected days set to %true
* @return {String} weekDays Weekday codes separated by commas
*/
toSet(wdays) {
let weekDays = [];

View File

@ -85,7 +85,12 @@ async function backTestOnce() {
await new Promise((resolve, reject) => {
const jasmine = require('gulp-jasmine');
let options = {errorOnFail: false};
let options = {
errorOnFail: false,
config: {
random: false
}
};
if (argv.junit) {
const reporters = require('jasmine-reporters');
@ -181,13 +186,23 @@ function e2eSingleRun() {
return gulp.src(specFiles).pipe(jasmine({
errorOnFail: false,
timeout: 30000,
config: {
random: false,
// TODO: Waiting for this option to be implemented
// https://github.com/jasmine/jasmine/issues/1533
stopSpecOnExpectationFailure: false
},
reporter: [
new SpecReporter({
spec: {
displayStacktrace: 'summary',
displayStacktrace: 'none',
displaySuccessful: true,
displayFailedSpec: true,
displaySpecDuration: true,
},
summary: {
displayStacktrace: 'pretty',
displayPending: false
}
})
]

View File

@ -3,6 +3,7 @@ vn-item-descriptor {
display: block;
img[ng-src] {
min-height: 16em;
height: 100%;
width: 100%;
display: block;

99
package-lock.json generated
View File

@ -2946,15 +2946,6 @@
"ansi-wrap": "^0.1.0"
}
},
"ansi-cyan": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/ansi-cyan/-/ansi-cyan-0.1.1.tgz",
"integrity": "sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM=",
"dev": true,
"requires": {
"ansi-wrap": "0.1.0"
}
},
"ansi-escapes": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz",
@ -2976,15 +2967,6 @@
"integrity": "sha1-gTWEAhliqenm/QOflA0S9WynhZ4=",
"dev": true
},
"ansi-red": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/ansi-red/-/ansi-red-0.1.1.tgz",
"integrity": "sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=",
"dev": true,
"requires": {
"ansi-wrap": "0.1.0"
}
},
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
@ -8303,79 +8285,18 @@
}
},
"gulp-jasmine": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/gulp-jasmine/-/gulp-jasmine-3.0.0.tgz",
"integrity": "sha1-ATFIbwzVmv/toY4AxkOZKpGWljs=",
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/gulp-jasmine/-/gulp-jasmine-4.0.0.tgz",
"integrity": "sha512-0UqY2fA6RCdUDJDsVym3zXYSWmt0AV7YY/6PAeKb+oGTKEgS7zZOH5w/4gcSKs+2FXiWrucQwLDvtEKIDbpF4A==",
"dev": true,
"requires": {
"arrify": "^1.0.0",
"jasmine": "^2.8.0",
"arrify": "^1.0.1",
"jasmine": "^3.1.0",
"jasmine-terminal-reporter": "^1.0.3",
"plugin-error": "^0.1.2",
"through2": "^2.0.0"
"plugin-error": "^1.0.1",
"through2": "^2.0.3"
},
"dependencies": {
"arr-diff": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-1.1.0.tgz",
"integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=",
"dev": true,
"requires": {
"arr-flatten": "^1.0.1",
"array-slice": "^0.2.3"
}
},
"arr-union": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/arr-union/-/arr-union-2.1.0.tgz",
"integrity": "sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0=",
"dev": true
},
"array-slice": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz",
"integrity": "sha1-3Tz7gO15c6dRF82sabC5nshhhvU=",
"dev": true
},
"extend-shallow": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-1.1.4.tgz",
"integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=",
"dev": true,
"requires": {
"kind-of": "^1.1.0"
}
},
"jasmine": {
"version": "2.99.0",
"resolved": "https://registry.npmjs.org/jasmine/-/jasmine-2.99.0.tgz",
"integrity": "sha1-jKctEC5jm4Z8ZImFbg4YqceqQrc=",
"dev": true,
"requires": {
"exit": "^0.1.2",
"glob": "^7.0.6",
"jasmine-core": "~2.99.0"
}
},
"kind-of": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz",
"integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=",
"dev": true
},
"plugin-error": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-0.1.2.tgz",
"integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=",
"dev": true,
"requires": {
"ansi-cyan": "^0.1.1",
"ansi-red": "^0.1.1",
"arr-diff": "^1.0.1",
"arr-union": "^2.0.1",
"extend-shallow": "^1.1.2"
}
},
"through2": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",
@ -9993,12 +9914,6 @@
}
}
},
"jasmine-core": {
"version": "2.99.1",
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz",
"integrity": "sha1-5kAN8ea1bhMLYcS80JPap/boyhU=",
"dev": true
},
"jasmine-reporters": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/jasmine-reporters/-/jasmine-reporters-2.3.2.tgz",

View File

@ -54,7 +54,7 @@
"gulp-env": "^0.4.0",
"gulp-file": "^0.4.0",
"gulp-install": "^1.1.0",
"gulp-jasmine": "^3.0.0",
"gulp-jasmine": "^4.0.0",
"gulp-merge-json": "^1.3.1",
"gulp-nodemon": "^2.4.2",
"gulp-print": "^2.0.1",