#1888 nightmarejs extension

This commit is contained in:
Carlos Jimenez Ruiz 2019-11-19 14:33:25 +01:00
parent ed5458a264
commit 43c1c34cf3
3 changed files with 14 additions and 3 deletions

View File

@ -428,6 +428,16 @@ let actions = {
waitForSpinnerLoad: function() {
return this.waitUntilNotPresent('vn-topbar vn-spinner');
},
waitForWatcherData: function(selector) {
return this.wait(selector)
.wait(selector => {
const watcher = document.querySelector(selector);
let orgData = watcher.$ctrl.orgData;
return !angular.equals({}, orgData) && orgData != null;
}, selector)
.waitForSpinnerLoad();
}
};

View File

@ -118,7 +118,8 @@ export default {
addObservationButton: 'vn-client-address-edit div[name="observations"] vn-icon-button[icon="add_circle"]',
saveButton: `button[type=submit]`,
cancelCreateAddressButton: 'button[ui-sref="client.card.address.index"]',
cancelEditAddressButton: 'vn-client-address-edit > form > vn-button-bar > vn-button > button'
cancelEditAddressButton: 'vn-client-address-edit > form > vn-button-bar > vn-button > button',
watcher: 'vn-client-address-edit vn-watcher'
},
clientWebAccess: {
webAccessButton: 'vn-left-menu a[ui-sref="client.card.webAccess"]',

View File

@ -138,7 +138,7 @@ describe('Client Edit fiscalData path', () => {
it(`should click on the 1st edit icon to confirm EQtax is checked`, async() => {
const result = await nightmare
.waitToClick(selectors.clientAddresses.firstEditAddress)
.waitForSpinnerLoad()
.waitForWatcherData(selectors.clientAddresses.watcher)
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
expect(result).toBe('checked');
@ -149,7 +149,7 @@ describe('Client Edit fiscalData path', () => {
const result = await nightmare
.waitToClick(selectors.clientAddresses.addressesButton)
.waitToClick(selectors.clientAddresses.secondEditAddress)
.waitForSpinnerLoad()
.waitForWatcherData(selectors.clientAddresses.watcher)
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
expect(result).toBe('checked');