e2e path for supplier address
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2021-05-03 13:31:43 +02:00
parent fcc8ab4236
commit d16a39b180
4 changed files with 111 additions and 12 deletions

View File

@ -1097,17 +1097,6 @@ export default {
clientButton: 'vn-supplier-descriptor vn-icon[icon="person"]',
entriesButton: 'vn-supplier-descriptor vn-icon[icon="icon-entry"]',
},
supplierContact: {
anyContact: 'vn-supplier-contact > form > vn-card > div',
addNewContact: 'vn-supplier-contact vn-icon[icon="add_circle"]',
thirdContactName: 'vn-supplier-contact div:nth-child(3) vn-textfield[ng-model="contact.name"]',
thirdContactPhone: 'vn-supplier-contact div:nth-child(3) vn-textfield[ng-model="contact.phone"]',
thirdContactMobile: 'vn-supplier-contact div:nth-child(3) vn-textfield[ng-model="contact.mobile"]',
thirdContactEmail: 'vn-supplier-contact div:nth-child(3) vn-textfield[ng-model="contact.email"]',
thirdContactNotes: 'vn-supplier-contact div:nth-child(3) vn-textfield[ng-model="contact.observation"]',
saveButton: 'vn-supplier-contact button[type="submit"]',
thirdContactDeleteButton: 'vn-supplier-contact div:nth-child(3) vn-icon-button[icon="delete"]'
},
supplierBasicData: {
alias: 'vn-supplier-basic-data vn-textfield[ng-model="$ctrl.supplier.nickname"]',
isSerious: 'vn-supplier-basic-data vn-check[ng-model="$ctrl.supplier.isSerious"]',
@ -1132,5 +1121,36 @@ export default {
payDem: 'vn-supplier-billing-data vn-autocomplete[ng-model="$ctrl.supplier.payDemFk"]',
payDay: 'vn-supplier-billing-data vn-input-number[ng-model="$ctrl.supplier.payDay"]',
saveButton: 'vn-supplier-billing-data button[type=submit]'
}
},
supplierAddress: {
anyAddress: 'vn-supplier-address-index a',
thirdAddress: 'vn-supplier-address-index vn-card > div:nth-child(3) > a',
newAddress: 'vn-supplier-address-index vn-float-button[icon="add"]',
newNickname: 'vn-supplier-address-create vn-textfield[ng-model="$ctrl.address.nickname"]',
newStreet: 'vn-supplier-address-create vn-textfield[ng-model="$ctrl.address.street"]',
newPostcode: 'vn-supplier-address-create vn-datalist[ng-model="$ctrl.address.postalCode"]',
newCity: 'vn-supplier-address-create vn-datalist[ng-model="$ctrl.address.city"]',
newProvince: 'vn-supplier-address-create vn-autocomplete[ng-model="$ctrl.address.provinceFk"]',
newPhone: 'vn-supplier-address-create vn-textfield[ng-model="$ctrl.address.phone"]',
newMobile: 'vn-supplier-address-create vn-textfield[ng-model="$ctrl.address.mobile"]',
editNickname: 'vn-supplier-address-edit vn-textfield[ng-model="$ctrl.address.nickname"]',
editStreet: 'vn-supplier-address-edit vn-textfield[ng-model="$ctrl.address.street"]',
editPostcode: 'vn-supplier-address-edit vn-datalist[ng-model="$ctrl.address.postalCode"]',
editCity: 'vn-supplier-address-edit vn-datalist[ng-model="$ctrl.address.city"]',
editProvince: 'vn-supplier-address-edit vn-autocomplete[ng-model="$ctrl.address.provinceFk"]',
editPhone: 'vn-supplier-address-edit vn-textfield[ng-model="$ctrl.address.phone"]',
editMobile: 'vn-supplier-address-edit vn-textfield[ng-model="$ctrl.address.mobile"]',
saveButton: 'button[type="submit"]'
},
supplierContact: {
anyContact: 'vn-supplier-contact > form > vn-card > div',
addNewContact: 'vn-supplier-contact vn-icon[icon="add_circle"]',
thirdContactName: 'vn-supplier-contact div:nth-child(3) vn-textfield[ng-model="contact.name"]',
thirdContactPhone: 'vn-supplier-contact div:nth-child(3) vn-textfield[ng-model="contact.phone"]',
thirdContactMobile: 'vn-supplier-contact div:nth-child(3) vn-textfield[ng-model="contact.mobile"]',
thirdContactEmail: 'vn-supplier-contact div:nth-child(3) vn-textfield[ng-model="contact.email"]',
thirdContactNotes: 'vn-supplier-contact div:nth-child(3) vn-textfield[ng-model="contact.observation"]',
saveButton: 'vn-supplier-contact button[type="submit"]',
thirdContactDeleteButton: 'vn-supplier-contact div:nth-child(3) vn-icon-button[icon="delete"]'
},
};

View File

@ -0,0 +1,79 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Supplier address path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'supplier');
await page.accessToSearchResult('1');
await page.accessToSection('supplier.card.address.index');
});
afterAll(async() => {
await browser.close();
});
it('should count the addresses before creating one', async() => {
const count = await page.countElement(selectors.supplierAddress.anyAddress);
expect(count).toEqual(2);
});
it('should open the new address form by clicking the add button', async() => {
await page.waitToClick(selectors.supplierAddress.newAddress);
await page.waitForState('supplier.card.address.create');
});
it('should create a new address', async() => {
await page.write(selectors.supplierAddress.newNickname, 'Darkest dungeon');
await page.write(selectors.supplierAddress.newStreet, 'Wayne manor');
await page.write(selectors.supplierAddress.newPostcode, '46000');
await page.write(selectors.supplierAddress.newCity, 'Valencia');
await page.autocompleteSearch(selectors.supplierAddress.newProvince, 'Province one');
await page.write(selectors.supplierAddress.newPhone, '888888888');
await page.write(selectors.supplierAddress.newMobile, '444444444');
await page.waitToClick(selectors.supplierAddress.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should have been redirected to the addresses index', async() => {
await page.waitForState('supplier.card.address.index');
});
it('should count the addresses and find one more now', async() => {
const count = await page.countElement(selectors.supplierAddress.anyAddress);
expect(count).toEqual(3);
});
it('should open the edit address form by clicking the new address', async() => {
await page.waitToClick(selectors.supplierAddress.thirdAddress);
await page.waitForState('supplier.card.address.edit');
});
it('should edit the address', async() => {
await page.overwrite(selectors.supplierAddress.editNickname, 'Wayne manor');
await page.overwrite(selectors.supplierAddress.editStreet, '1007 Mountain Drive');
await page.overwrite(selectors.supplierAddress.editPostcode, '46000');
await page.overwrite(selectors.supplierAddress.editCity, 'Valencia');
await page.autocompleteSearch(selectors.supplierAddress.editProvince, 'Province one');
await page.overwrite(selectors.supplierAddress.editPhone, '777777777');
await page.overwrite(selectors.supplierAddress.editMobile, '555555555');
await page.waitToClick(selectors.supplierAddress.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should check the address has now the expected data', async() => {
let thirdAddress = await page.waitToGetProperty(selectors.supplierAddress.thirdAddress, 'innerText');
expect(thirdAddress).toContain('Wayne manor');
});
});