#2030 e2e client.basicData
gitea/salix/2030-e2e-client-basicData This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2020-02-06 13:00:41 +01:00
parent d400e63aac
commit de12911f30
4 changed files with 41 additions and 17 deletions

View File

@ -191,7 +191,7 @@ let actions = {
waitToClick: async function(selector) {
await this.waitForSelector(selector, {});
await this.click(selector, {waitUntil: 'domcontentloaded'});
await this.click(selector);
},
focusElement: async function(selector) {
@ -393,15 +393,17 @@ let actions = {
autocompleteSearch: async function(selector, searchValue) {
let builtSelector = await this.selectorFormater(selector);
try {
await this.waitToClick(builtSelector);
await this.waitForSelector(selector => {
document
.querySelector(`${selector} vn-drop-down`).$ctrl.content
.querySelectorAll('li');
}, selector);
await this.type(`.vn-drop-down.shown`, searchValue);
await this.waitToClick(selector);
await this.waitForSelector(selector => {
document
.querySelector(`${selector} vn-drop-down`).$ctrl.content
.querySelectorAll('li');
}, selector);
await this.write('.vn-drop-down.vn-popover.vn-popup.shown vn-textfield', searchValue);
try {
await this.waitForFunction((selector, searchValue) => {
let element = document
.querySelector(`${selector} vn-drop-down`).$ctrl.content
@ -409,15 +411,18 @@ let actions = {
if (element)
return element.innerText.toLowerCase().includes(searchValue.toLowerCase());
}, {}, selector, searchValue);
await this.keyboard.press('Enter');
await this.waitForFunction((selector, searchValue) => {
return document.querySelector(selector).value.toLowerCase()
.includes(searchValue.toLowerCase());
}, {}, builtSelector, searchValue);
} catch (error) {
throw new Error(`${builtSelector} failed to autocomplete ${searchValue}! ${error}`);
let inputValue = await this.evaluate(() => {
return document.querySelector('.vn-drop-down.vn-popover.vn-popup.shown vn-textfield input').value;
});
throw new Error(`${builtSelector} value is ${inputValue}! ${error}`);
}
await this.keyboard.press('Enter');
await this.waitForFunction((selector, searchValue) => {
return document.querySelector(selector).value.toLowerCase()
.includes(searchValue.toLowerCase());
}, {}, builtSelector, searchValue);
await this.waitForMutation(`.vn-drop-down`, 'childList');
},

View File

@ -51,6 +51,8 @@ export default {
name: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.name"]',
contact: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.contact"]',
email: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.email"]',
phone: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.phone"]',
mobile: 'vn-client-basic-data vn-textfield[ng-model="$ctrl.client.mobile"]',
salesPerson: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]',
channel: 'vn-client-basic-data vn-autocomplete[ng-model="$ctrl.client.contactChannelFk"]',
saveButton: 'vn-client-basic-data button[type=submit]'

View File

@ -92,6 +92,10 @@ describe('Client Edit basicData path', () => {
await page.write(selectors.clientBasicData.contact, 'Black Panther');
await page.clearInput(selectors.clientBasicData.email);
await page.write(selectors.clientBasicData.email, 'Storm@verdnatura.es');
await page.clearInput(selectors.clientBasicData.phone);
await page.write(selectors.clientBasicData.phone, '333333333');
await page.clearInput(selectors.clientBasicData.mobile);
await page.write(selectors.clientBasicData.mobile, '444444444');
await page.autocompleteSearch(selectors.clientBasicData.salesPerson, 'replenisherNick');
await page.autocompleteSearch(selectors.clientBasicData.channel, 'Metropolis newspaper');
await page.waitToClick(selectors.clientBasicData.saveButton);
@ -121,6 +125,20 @@ describe('Client Edit basicData path', () => {
expect(result).toEqual('Storm@verdnatura.es');
});
it('should now confirm the phone have been edited', async() => {
const result = await page
.waitToGetProperty(selectors.clientBasicData.phone, 'value');
expect(result).toEqual('333333333');
});
it('should now confirm the mobile have been edited', async() => {
const result = await page
.waitToGetProperty(selectors.clientBasicData.mobile, 'value');
expect(result).toEqual('444444444');
});
it('should confirm the sales person have been selected', async() => {
const result = await page
.waitToGetProperty(selectors.clientBasicData.salesPerson, 'value');

View File

@ -49,7 +49,6 @@ describe('Client balance path', () => {
it('should create a new payment that clears the debt', async() => {
await page.waitToClick(selectors.clientBalance.newPaymentButton);
await page.waitForContentLoaded();
await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt');
await page.waitToClick(selectors.clientBalance.saveButton);
let result = await page.waitForLastSnackbar();