#737 Modificar E2E billing data + version de nightmare

This commit is contained in:
Carlos Jimenez 2018-10-24 10:57:14 +02:00
parent af508b664c
commit 784f00c860
35 changed files with 404 additions and 593 deletions

View File

@ -1,14 +0,0 @@
import createNightmare from './nightmare';
export default myCreateNightmare;
function myCreateNightmare() {
let nightmare = createNightmare();
nightmare.header('Accept-Language', 'en');
afterAll(() => {
return nightmare
.end();
});
return nightmare;
}

View File

@ -2,16 +2,15 @@
import Nightmare from 'nightmare';
export default function createNightmare(width = 1280, height = 720) {
const nightmare = new Nightmare({show: process.env.E2E_SHOW, typeInterval: 10, x: 0, y: 0})
const nightmare = new Nightmare({show: process.env.E2E_SHOW, typeInterval: 10, x: 0, y: 0, waitTimeout: 2000})
.viewport(width, height);
nightmare.on('page', (type, message, error) => {
fail(error);
});
nightmare.on('dom-ready', function() {
nightmare.inject('js', `${__dirname}/nightmareModifiers.js`);
});
// nightmare.on('page', (type, message, error) => {
// console.log(type);
// console.log(message.name);
// console.log(error);
// fail(error);
// });
nightmare.on('console', (type, message) => {
if (type === 'error') {
@ -21,6 +20,14 @@ export default function createNightmare(width = 1280, height = 720) {
// console.log(message);
}
});
nightmare.header('Accept-Language', 'en');
afterAll(() => {
return nightmare
.end();
});
return nightmare;
}

View File

@ -85,6 +85,11 @@ export default {
receivedCoreLCRCheckbox: `vn-check[label='Received LCR'] > label > input`,
receivedCoreVNLCheckbox: `vn-check[label='Received core VNL'] > label > input`,
receivedB2BVNLCheckbox: `vn-check[label='Received B2B VNL'] > label > input`,
swiftBicInput: 'vn-client-billing-data vn-autocomplete[field="$ctrl.client.bankEntityFk"] input',
newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button',
newBankEntityName: 'vn-client-billing-data > vn-dialog vn-textfield[label="Name"] input',
newBankEntityBIC: 'vn-client-billing-data > vn-dialog vn-textfield[label="Swift / BIC"] input',
acceptBankEntityButton: 'vn-client-billing-data > vn-dialog button[response="ACCEPT"]',
saveButton: `${components.vnSubmit}`
},
clientAddresses: {
@ -335,7 +340,7 @@ export default {
secondSaleDiscount: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(8)`,
secondSaleImport: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(9)`,
secondSaleText: `vn-table div > vn-tbody > vn-tr:nth-child(2)`,
totalImport: 'vn-ticket-sale vn-tfoot > vn-tr > vn-td:nth-child(9) > section > p:nth-child(3) > strong',
totalImport: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > div > p:nth-child(3) > strong',
selectAllSalesCheckbox: `vn-ticket-sale vn-thead vn-check label`,
secondSaleCheckbox: `vn-ticket-sale vn-tr:nth-child(2) vn-check[field="sale.checked"] label`,
thirdSaleCheckbox: `vn-ticket-sale vn-tr:nth-child(3) vn-check[field="sale.checked"] label`,
@ -353,7 +358,7 @@ export default {
moreMenuDeleteOption: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(2)',
moreMenuReseveOption: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(4)',
moreMenuUnmarkResevedOption: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(5)',
moreMenuUpdateDiscount: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(5)',
moreMenuUpdateDiscount: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(6)',
moreMenuUpdateDiscountInput: 'vn-ticket-sale vn-dialog.shown vn-ticket-sale-edit-discount input',
moreMenuCreateClaim: 'vn-ticket-sale vn-drop-down > vn-popover ul > li:nth-child(1)'
},

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers.js';
import createNightmare from '../../helpers/nightmare';
describe('Claim edit basic data path', () => {
const nightmare = createNightmare();

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Client', () => {
describe('create path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Client Edit basicData path', () => {
const nightmare = createNightmare();

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Client Edit fiscalData path', () => {
const nightmare = createNightmare();

View File

@ -1,56 +1,50 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
xdescribe('Client', () => {
describe('Client', () => {
describe('Edit pay method path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
nightmare
.waitForLogin('administrative');
});
it('should click on the Clients button of the top bar menu', done => {
return nightmare
it('should click on the Clients button of the top bar menu', async() => {
let url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
done();
}).catch(done.fail);
});
it('should search for the user Bruce Banner', done => {
return nightmare
it('should search for the user Bruce Banner', async() => {
let resultCount = await nightmare
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the client's pay method`, done => {
return nightmare
it(`should click on the search result to access to the client's pay method`, async() => {
let url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientPayMethod.payMethodButton)
.waitForURL('billing-data')
.url()
.then(url => {
.url();
expect(url).toContain('billing-data');
done();
}).catch(done.fail);
});
it(`should attempt to edit the Pay method without an IBAN but fail`, done => {
return nightmare
it(`should attempt to edit the Pay method without an IBAN but fail`, async() => {
let snackbarMessage = await nightmare
.waitToClick(selectors.clientPayMethod.payMethodInput)
.waitToClick(selectors.clientPayMethod.payMethodIBANOption)
.waitForTextInInput(selectors.clientPayMethod.payMethodInput, 'PayMethod with IBAN')
@ -61,75 +55,88 @@ xdescribe('Client', () => {
.waitToClick(selectors.clientPayMethod.receivedCoreVNLCheckbox)
.waitToClick(selectors.clientPayMethod.receivedB2BVNLCheckbox)
.waitToClick(selectors.clientPayMethod.saveButton)
.waitForLastSnackbar()
.then(result => {
expect(result).toEqual('That payment method requires an IBAN');
done();
}).catch(done.fail);
.waitForLastSnackbar();
expect(snackbarMessage).toEqual('That payment method requires an IBAN');
});
it(`should add the IBAN`, done => {
return nightmare
it(`should add the IBAN but fail as it requires a BIC code`, async() => {
let snackbarMessage = await nightmare
.clearInput(selectors.clientPayMethod.IBANInput)
.type(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332')
.waitForTextInInput(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332')
.waitToClick(selectors.clientPayMethod.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Data saved!', 'Notification sent!']));
done();
}).catch(done.fail);
.waitForLastSnackbar();
expect(snackbarMessage).toEqual('That payment method requires a BIC');
});
it(`should confirm the IBAN pay method is sucessfully saved`, done => {
return nightmare
.getInputValue(selectors.clientPayMethod.payMethodInput)
.then(result => {
expect(result).toEqual('PayMethod with IBAN');
done();
}).catch(done.fail);
it(`should create a new BIC code`, async() => {
let newcode = await nightmare
.click(selectors.clientPayMethod.newBankEntityButton)
.type(selectors.clientPayMethod.newBankEntityName, 'Gotham City Banks')
.type(selectors.clientPayMethod.newBankEntityBIC, 'GTHMCT')
.click(selectors.clientPayMethod.acceptBankEntityButton)
.getInputValue(selectors.clientPayMethod.swiftBicInput);
expect(newcode).toEqual('');
});
it('should confirm the due day have been edited', done => {
return nightmare
.getInputValue(selectors.clientPayMethod.dueDayInput)
.then(result => {
expect(result).toEqual('60');
done();
}).catch(done.fail);
it(`should confirm the IBAN pay method is sucessfully saved`, async() => {
let payMethod = await nightmare
.getInputValue(selectors.clientPayMethod.payMethodInput);
expect(payMethod).toEqual('PayMethod with IBAN');
});
it('should confirm Received LCR checkbox is checked', done => {
return nightmare
it('should confirm the due day have been edited', async() => {
let dueDate = await nightmare
.getInputValue(selectors.clientPayMethod.dueDayInput);
expect(dueDate).toEqual('60');
});
it('should confirm the IBAN was saved', async() => {
let IBAN = await nightmare
.waitProperty(selectors.clientPayMethod.IBANInput, 'value')
.getProperty(selectors.clientPayMethod.IBANInput, 'value');
expect(IBAN).toEqual('ES91 2100 0418 4502 0005 1332');
});
it('should confirm the swift / BIC code was saved', async() => {
let code = await nightmare
.waitProperty(selectors.clientPayMethod.swiftBicInput, 'value')
.getProperty(selectors.clientPayMethod.swiftBicInput, 'value');
expect(code).toEqual('GTHMCT');
});
it('should confirm Received LCR checkbox is checked', async() => {
let checkedBox = await nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedCoreLCRCheckbox)
.then(value => {
expect(value).toBeTruthy();
done();
}).catch(done.fail);
}, selectors.clientPayMethod.receivedCoreLCRCheckbox);
expect(checkedBox).toBeTruthy();
});
it('should confirm Received core VNL checkbox is unchecked', done => {
return nightmare
it('should confirm Received core VNL checkbox is unchecked', async() => {
let checkedBox = await nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedCoreVNLCheckbox)
.then(value => {
expect(value).toBeFalsy();
done();
}).catch(done.fail);
}, selectors.clientPayMethod.receivedCoreVNLCheckbox);
expect(checkedBox).toBeFalsy();
});
it('should confirm Received B2B VNL checkbox is unchecked', done => {
return nightmare
it('should confirm Received B2B VNL checkbox is unchecked', async() => {
let checkedBox = await nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedB2BVNLCheckbox)
.then(value => {
expect(value).toBeFalsy();
done();
}).catch(done.fail);
}, selectors.clientPayMethod.receivedB2BVNLCheckbox);
expect(checkedBox).toBeFalsy();
});
});
});

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Client', () => {
describe('Add address path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Client add address notes path', () => {
const nightmare = createNightmare();

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Client', () => {
describe('Edit web access path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Client', () => {
describe('Add notes path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Client', () => {
describe('Add credit path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Client', () => {
describe('Add greuge path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Client', () => {
describe('mandate path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Client lock verified data path', () => {
const nightmare = createNightmare();

View File

@ -1,17 +1,18 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Item', () => {
describe('Summary path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
beforeAll(done => {
nightmare
.waitForLogin('employee');
done();
});
it('should access to the items index by clicking the items button', done => {
return nightmare
nightmare
.click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton)
.parsedUrl()
@ -22,7 +23,7 @@ describe('Item', () => {
});
it('should search for the item Gem of Time', done => {
return nightmare
nightmare
.wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
.click(selectors.itemsIndex.searchButton)
@ -35,7 +36,7 @@ describe('Item', () => {
});
it(`should click on the search result summary button to open the item summary popup`, done => {
return nightmare
nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.isVisible(selectors.itemSummary.basicData)
.then(result => {
@ -51,7 +52,7 @@ describe('Item', () => {
});
it(`should check the item summary preview shows fields from basic data`, done => {
return nightmare
nightmare
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time')
.getInnerText(selectors.itemSummary.basicData)
.then(result => {
@ -61,7 +62,7 @@ describe('Item', () => {
});
it(`should check the item summary preview shows fields from tags`, done => {
return nightmare
nightmare
.waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow')
.getInnerText(selectors.itemSummary.tags)
.then(result => {
@ -80,18 +81,16 @@ describe('Item', () => {
}).catch(done.fail);
});
it(`should check the item summary preview shows fields from botanical`, done => {
return nightmare
it(`should check the item summary preview shows fields from botanical`, async() => {
let result = await nightmare
.waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix')
.getInnerText(selectors.itemSummary.botanical)
.then(result => {
.getInnerText(selectors.itemSummary.botanical);
expect(result).toContain('Botanical: Hedera helix');
done();
}).catch(done.fail);
});
it(`should check the item summary preview shows fields from barcode`, done => {
return nightmare
nightmare
.waitForTextInElement(selectors.itemSummary.barcode, '1')
.getInnerText(selectors.itemSummary.barcode)
.then(result => {
@ -101,7 +100,7 @@ describe('Item', () => {
});
it(`should close the summary popup`, done => {
return nightmare
nightmare
.waitToClick(selectors.itemsIndex.closeItemSummaryPreview)
.isVisible(selectors.itemSummary.basicData)
.then(result => {
@ -111,7 +110,7 @@ describe('Item', () => {
});
it(`should navigate to the one of the items detailed section`, done => {
return nightmare
nightmare
.waitToClick(selectors.itemsIndex.searchResult)
.waitForURL('summary')
.parsedUrl()
@ -122,7 +121,7 @@ describe('Item', () => {
});
it(`should check the item summary shows fields from basic data section`, done => {
return nightmare
nightmare
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time')
.getInnerText(selectors.itemSummary.basicData)
.then(result => {
@ -132,7 +131,7 @@ describe('Item', () => {
});
it(`should check the item summary shows fields from tags section`, done => {
return nightmare
nightmare
.getInnerText(selectors.itemSummary.tags)
.then(result => {
expect(result).toContain('Color: Yellow');
@ -141,7 +140,7 @@ describe('Item', () => {
});
it(`should check the item summary shows fields from niches section`, done => {
return nightmare
nightmare
.getInnerText(selectors.itemSummary.niche)
.then(result => {
expect(result).toContain('Warehouse One: A1');
@ -150,7 +149,7 @@ describe('Item', () => {
});
it(`should check the item summary shows fields from botanical section`, done => {
return nightmare
nightmare
.getInnerText(selectors.itemSummary.botanical)
.then(result => {
expect(result).toContain('Botanical: Hedera helix');
@ -159,7 +158,7 @@ describe('Item', () => {
});
it(`should check the item summary shows fields from barcodes section`, done => {
return nightmare
nightmare
.getInnerText(selectors.itemSummary.barcode)
.then(result => {
expect(result).toContain('1');

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Item', () => {
describe('Edit basic data path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Item', () => {
describe('Edit tax path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Item', () => {
describe('Create tags path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Item', () => {
describe('Create niche path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Item', () => {
describe('Create botanical path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Item', () => {
describe('Create barcodes path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Item', () => {
const nightmare = createNightmare();

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Ticket', () => {
describe('Create notes path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Ticket', () => {
describe('Delete expeditions path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Ticket List sale path', () => {
const nightmare = createNightmare();

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Ticket Create packages path', () => {
const nightmare = createNightmare();

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Ticket', () => {
describe('Create new tracking state path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Ticket', () => {
describe('Edit basic data path', () => {

View File

@ -1,5 +1,5 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
import createNightmare from '../../helpers/nightmare';
describe('Ticket Edit sale path', () => {
const nightmare = createNightmare();

View File

@ -1,5 +1,5 @@
import selectors from '../helpers/selectors';
import createNightmare from '../helpers/helpers';
import createNightmare from '../helpers/nightmare';
describe('create client path', () => {
let nightmare = createNightmare();

696
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -35,7 +35,7 @@
"cors": "^2.8.4",
"css-loader": "^0.25.0",
"del": "^2.2.2",
"electron": "^1.8.8",
"nightmare": "^3.0.1",
"eslint": "^3.19.0",
"eslint-config-angular": "^0.5.0",
"eslint-config-google": "^0.6.0",
@ -66,7 +66,6 @@
"minimist": "^1.2.0",
"mustache": "^2.3.2",
"mysql2": "^1.6.1",
"nightmare": "^2.10.0",
"node-sass": "^4.9.3",
"nodemon": "^1.18.4",
"plugin-error": "^1.0.1",