e2e path for add credit and gulp tasks for faster fixtures in progress
This commit is contained in:
parent
b3eac25e8a
commit
c1e798790f
|
@ -12,7 +12,7 @@ export default class App {
|
|||
this.$rootScope = $rootScope;
|
||||
}
|
||||
show(message) {
|
||||
if (this.snackbar) this.snackbar.show({message: message});
|
||||
if (this.snackbar) this.snackbar.show({message: message, timeout: 400});
|
||||
}
|
||||
showMessage(message) {
|
||||
this.show(message);
|
||||
|
|
|
@ -114,5 +114,12 @@ export default {
|
|||
noteInput: `${components.vnTextarea}[label="Note"]`,
|
||||
saveButton: `${components.vnSubmit}`,
|
||||
firstNoteText: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-notes > vn-card > div > vn-vertical > vn-one:nth-child(2) > vn-horizontal:nth-child(2) > b'
|
||||
},
|
||||
credit: {
|
||||
creditButton: `${components.vnMenuItem}[ui-sref="clientCard.credit.list"]`,
|
||||
addCreditFloatButton: `${components.vnFloatButton}`,
|
||||
creditInput: `${components.vnTextfield}[name="credit"]`,
|
||||
saveButton: `${components.vnSubmit}`,
|
||||
firstCreditText: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-credit-list > vn-card > div > vn-vertical > vn-one > vn-horizontal:nth-child(1) > vn-one'
|
||||
}
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@ const moduleAccessViewHashURL = '#!/';
|
|||
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
||||
|
||||
describe('Edit notes path', () => {
|
||||
describe('Add notes path', () => {
|
||||
describe('warm up', () => {
|
||||
it('should warm up login and fixtures', done => {
|
||||
nightmare
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
import config from '../helpers/config.js';
|
||||
import createNightmare from '../helpers/nightmare';
|
||||
import selectors from '../helpers/selectors.js';
|
||||
import {catchErrors} from '../../services/utils/jasmineHelpers';
|
||||
import { fail } from 'assert';
|
||||
const nightmare = createNightmare();
|
||||
const moduleAccessViewHashURL = '#!/';
|
||||
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
||||
|
||||
fdescribe('Add credit path', () => {
|
||||
describe('warm up', () => {
|
||||
it('should warm up login and fixtures', done => {
|
||||
nightmare
|
||||
.login()
|
||||
.waitForURL(moduleAccessViewHashURL)
|
||||
.waitToClick(selectors.globalItems.logOutButton)
|
||||
.then(() => {
|
||||
done();
|
||||
})
|
||||
.catch(catchErrors(done));
|
||||
});
|
||||
});
|
||||
|
||||
it('should log in', done => {
|
||||
nightmare
|
||||
.login()
|
||||
.waitForURL(moduleAccessViewHashURL)
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toEqual(config.url + moduleAccessViewHashURL);
|
||||
done();
|
||||
})
|
||||
.catch(catchErrors(done));
|
||||
});
|
||||
|
||||
it('should make sure the language is English', done => {
|
||||
nightmare
|
||||
.changeLanguageToEnglish()
|
||||
.then(() => {
|
||||
done();
|
||||
})
|
||||
.catch(catchErrors(done));
|
||||
});
|
||||
|
||||
it('should click on the Clients button of the top bar menu', done => {
|
||||
nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.clientsButton)
|
||||
.wait(selectors.clientsIndex.createClientButton)
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toEqual(config.url + '#!/clients');
|
||||
done();
|
||||
})
|
||||
.catch(catchErrors(done));
|
||||
});
|
||||
|
||||
it('should search for the user Petter Parker', done => {
|
||||
nightmare
|
||||
.wait(selectors.clientsIndex.searchResult)
|
||||
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
||||
.click(selectors.clientsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
||||
.countSearchResults(selectors.clientsIndex.searchResult)
|
||||
.then(result => {
|
||||
expect(result).toEqual(1);
|
||||
done();
|
||||
})
|
||||
.catch(catchErrors(done));
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the client's credit`, done => {
|
||||
nightmare
|
||||
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
||||
.waitToClick(selectors.clientsIndex.searchResult)
|
||||
.waitToClick(selectors.credit.creditButton)
|
||||
.waitForURL('credit/list')
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toContain('credit/list');
|
||||
done();
|
||||
})
|
||||
.catch(catchErrors(done));
|
||||
});
|
||||
|
||||
it(`should click on the add credit button`, done => {
|
||||
nightmare
|
||||
.waitToClick(selectors.credit.addCreditFloatButton)
|
||||
.waitForURL('/credit/create')
|
||||
.url()
|
||||
.then(url => {
|
||||
expect(url).toContain('/credit/create');
|
||||
done();
|
||||
})
|
||||
.catch(catchErrors(done));
|
||||
});
|
||||
|
||||
it(`should edit the credit`, done => {
|
||||
nightmare
|
||||
.type(selectors.credit.creditInput, 999)
|
||||
.click(selectors.credit.saveButton)
|
||||
.wait(selectors.globalItems.snackbarIsActive)
|
||||
.getInnerText(selectors.globalItems.snackbarIsActive)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Data saved!');
|
||||
done();
|
||||
})
|
||||
.catch(catchErrors(done));
|
||||
});
|
||||
|
||||
it('should confirm the credit was updated', done => {
|
||||
nightmare
|
||||
.waitForSnackbarReset()
|
||||
.wait(selectors.credit.firstCreditText)
|
||||
.getInnerText(selectors.credit.firstCreditText)
|
||||
.then(value => {
|
||||
expect(value).toContain(999);
|
||||
done();
|
||||
})
|
||||
.catch(catchErrors(done));
|
||||
});
|
||||
});
|
29
gulpfile.js
29
gulpfile.js
|
@ -152,6 +152,35 @@ gulp.task('test', callback => {
|
|||
return require('./services_tests').start();
|
||||
});
|
||||
|
||||
// e2e tests
|
||||
gulp.task('e2e', callback => {
|
||||
runSequence('docker', 'runDockerLogs', 'endToEndTests', callback);
|
||||
});
|
||||
|
||||
gulp.task('runDockerLogs', callback => {
|
||||
let timer = 0;
|
||||
let waitForLocaldb = setInterval(() => {
|
||||
if (timer < 15000) {
|
||||
timer += 1000;
|
||||
exec('docker logs dblocal', (err, stdout, stderr) => {
|
||||
if (stdout.includes('starting as process 1')) {
|
||||
console.log(stdout);
|
||||
clearInterval(waitForLocaldb);
|
||||
callback(err);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
clearInterval(waitForLocaldb);
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
gulp.task('endToEndTests', callback => {
|
||||
exec('node e2e_tests', err => {
|
||||
callback(err);
|
||||
});
|
||||
});
|
||||
|
||||
// docker dblocal
|
||||
gulp.task('docker', callback => {
|
||||
runSequence('deleteDockerDb', 'deleteDockerImageDb', 'buildDockerDb', 'runDockerDb', callback);
|
||||
|
|
|
@ -270,7 +270,7 @@ INSERT INTO `salix`.`Account`(`id`,`name`,`password`,`roleFk`,`active`,`email`)
|
|||
(8, 'CharlesXavier', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'CharlesXavier@verdnatura.es'),
|
||||
(9, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'BruceBanner@verdnatura.es'),
|
||||
(10, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 9, 1, 'JessicaJones@verdnatura.es'),
|
||||
(11, 'Cyborg', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'cyborg@verdnatura.es');
|
||||
(11, 'Cyborg', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'cyborg@verdnatura.es');
|
||||
|
||||
INSERT INTO `salix`.`Country`(`id`, `name`, `inCee`, `code`, `currencyFk`, `realCountryFk`)
|
||||
VALUES
|
||||
|
@ -412,7 +412,7 @@ INSERT INTO `salix`.`ClientCredit`(`id`, `clientFk`, `employeeFk`, `amount`, `cr
|
|||
|
||||
INSERT INTO `salix`.`ClientCreditLimit`(`id`, `maxAmount`, `roleFk`)
|
||||
VALUES
|
||||
(1, 1000, 5),
|
||||
(1, 1000, 5),
|
||||
(2, 600, 5),
|
||||
(3, 0, 5);
|
||||
|
||||
|
|
Loading…
Reference in New Issue