#1350 route.index
This commit is contained in:
parent
b60ee825ba
commit
a578c84dba
|
@ -6,24 +6,25 @@ import config from './config.js';
|
|||
|
||||
let currentUser;
|
||||
|
||||
Nightmare.asyncAction = function(name, func) {
|
||||
Nightmare.action(name, function(...args) {
|
||||
let done = args[arguments.length - 1];
|
||||
func.apply(this, args)
|
||||
.then(result => done(null, result))
|
||||
.catch(done);
|
||||
});
|
||||
};
|
||||
|
||||
Nightmare.asyncAction('clearInput', async function(selector) {
|
||||
const backSpaces = [];
|
||||
for (let i = 0; i < 50; i += 1)
|
||||
backSpaces.push('\u0008');
|
||||
|
||||
await this.write(selector, backSpaces.join(''));
|
||||
});
|
||||
|
||||
let actions = {
|
||||
clearTextarea: function(selector, done) {
|
||||
this.wait(selector)
|
||||
.evaluate(inputSelector => {
|
||||
return document.querySelector(inputSelector).value = '';
|
||||
}, selector)
|
||||
.then(done)
|
||||
.catch(done);
|
||||
},
|
||||
|
||||
clearInput: function(selector, done) {
|
||||
this.wait(selector)
|
||||
.evaluate(inputSelector => {
|
||||
return document.querySelector(inputSelector).closest('*[model], *[field], *[value]').$ctrl.value = '';
|
||||
}, selector)
|
||||
.then(done)
|
||||
.catch(done);
|
||||
},
|
||||
|
||||
login: function(userName, done) {
|
||||
if (currentUser)
|
||||
this.waitToClick('#logout');
|
||||
|
@ -334,7 +335,6 @@ let actions = {
|
|||
return shapesList;
|
||||
}, done, selector);
|
||||
},
|
||||
|
||||
waitForSnackbar: function(done) {
|
||||
this.wait(500).waitForShapes('vn-snackbar .shape .text')
|
||||
.then(shapes => {
|
||||
|
@ -359,8 +359,9 @@ let actions = {
|
|||
},
|
||||
|
||||
accessToSearchResult: function(searchValue, done) {
|
||||
this.write(`vn-searchbar input`, searchValue)
|
||||
.click(`vn-searchbar vn-icon[icon="search"]`)
|
||||
this.clearInput('vn-searchbar input')
|
||||
.write('vn-searchbar input', searchValue)
|
||||
.click('vn-searchbar vn-icon[icon="search"]')
|
||||
.wait(100)
|
||||
.waitForNumberOfElements('.searchResult', 1)
|
||||
.evaluate(() => {
|
||||
|
|
|
@ -45,12 +45,11 @@ export default {
|
|||
},
|
||||
clientBasicData: {
|
||||
basicDataButton: 'vn-left-menu a[ui-sref="client.card.basicData"]',
|
||||
nameInput: `${components.vnTextfield}[name="name"]`,
|
||||
contactInput: `${components.vnTextfield}[name="contact"]`,
|
||||
phoneInput: `${components.vnTextfield}[name="phone"]`,
|
||||
mobileInput: `${components.vnTextfield}[name="mobile"]`,
|
||||
faxInput: `${components.vnTextfield}[name="fax"]`,
|
||||
emailInput: `${components.vnTextfield}[name="email"]`,
|
||||
nameInput: 'vn-textfield[field="$ctrl.client.name"] input',
|
||||
contactInput: 'vn-textfield[field="$ctrl.client.contact"] input',
|
||||
phoneInput: 'vn-textfield[field="$ctrl.client.phone"] input',
|
||||
mobileInput: 'vn-textfield[field="$ctrl.client.mobile"] input',
|
||||
emailInput: 'vn-textfield[field="$ctrl.client.email"] input',
|
||||
salesPersonAutocomplete: 'vn-autocomplete[field="$ctrl.client.salesPersonFk"]',
|
||||
channelAutocomplete: 'vn-autocomplete[field="$ctrl.client.contactChannelFk"]',
|
||||
saveButton: `${components.vnSubmit}`
|
||||
|
@ -473,7 +472,7 @@ export default {
|
|||
claimStateAutocomplete: 'vn-claim-basic-data vn-autocomplete[field="$ctrl.claim.claimStateFk"]',
|
||||
isPaidWithManaCheckbox: 'vn-check[field="$ctrl.claim.isChargedToMana"] md-checkbox',
|
||||
responsabilityInputRange: 'vn-input-range',
|
||||
observationInput: 'vn-textarea[label="Observation"] textarea',
|
||||
observationInput: 'vn-textarea[field="$ctrl.claim.observation"] textarea',
|
||||
saveButton: `${components.vnSubmit}`
|
||||
},
|
||||
claimDetail: {
|
||||
|
|
|
@ -30,7 +30,6 @@ describe('Item index path', () => {
|
|||
.waitToClick(selectors.itemsIndex.originCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.buyerCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.destinyCheckbox)
|
||||
// .waitToClick(selectors.itemsIndex.taxClassCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.saveFieldsButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
|
@ -68,7 +67,6 @@ describe('Item index path', () => {
|
|||
.waitToClick(selectors.itemsIndex.originCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.buyerCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.destinyCheckbox)
|
||||
// .waitToClick(selectors.itemsIndex.taxClassCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.saveFieldsButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ describe('Claim edit basic data path', () => {
|
|||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Gestionado')
|
||||
.waitToClick(selectors.claimBasicData.isPaidWithManaCheckbox)
|
||||
.clearInput(selectors.claimBasicData.observationInput)
|
||||
.clearTextarea(selectors.claimBasicData.observationInput)
|
||||
.write(selectors.claimBasicData.observationInput, 'edited observation')
|
||||
.waitToClick(selectors.claimBasicData.saveButton)
|
||||
.waitForSnackbar();
|
||||
|
@ -58,7 +58,7 @@ describe('Claim edit basic data path', () => {
|
|||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.claimBasicData.claimStateAutocomplete, 'Pendiente')
|
||||
.waitToClick(selectors.claimBasicData.isPaidWithManaCheckbox)
|
||||
.clearInput(selectors.claimBasicData.observationInput)
|
||||
.clearTextarea(selectors.claimBasicData.observationInput)
|
||||
.write(selectors.claimBasicData.observationInput, 'Observation one')
|
||||
.waitToClick(selectors.claimBasicData.saveButton)
|
||||
.waitForSnackbar();
|
||||
|
|
|
@ -65,7 +65,7 @@ describe('Order edit basic data path', () => {
|
|||
.autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark')
|
||||
.autocompleteSearch(selectors.orderBasicData.addressAutocomplete, 'Tony Stark')
|
||||
.autocompleteSearch(selectors.orderBasicData.agencyAutocomplete, 'Silla247')
|
||||
.clearInput(selectors.orderBasicData.observationInput)
|
||||
.clearTextarea(selectors.orderBasicData.observationInput)
|
||||
.write(selectors.orderBasicData.observationInput, 'Observation modified')
|
||||
.waitToClick(selectors.orderBasicData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
|
|
Loading…
Reference in New Issue