#1940 e2e client.phone

This commit is contained in:
Carlos Jimenez Ruiz 2020-02-10 12:12:49 +01:00
parent ba73dc1a8d
commit c0f3fea407
3 changed files with 45 additions and 1 deletions

View File

@ -185,6 +185,13 @@ export default {
firstDocWorkerDescriptor: '.vn-popover.shown vn-worker-descriptor',
acceptDeleteButton: '.vn-confirm.shown button[response="accept"]'
},
clientContacts: {
addContactButton: 'vn-client-contact vn-icon[icon="add_circle"]',
name: 'vn-client-contact vn-textfield[ng-model="contact.name"]',
phone: 'vn-client-contact vn-textfield[ng-model="contact.phone"]',
deleteFirstPhone: 'vn-client-contact vn-icon[icon="delete"]',
saveButton: 'button[type=submit]'
},
itemsIndex: {
searchIcon: 'vn-searchbar vn-icon[icon="search"]',
createItemButton: `vn-float-button`,

View File

@ -60,7 +60,7 @@ describe('Client Edit billing data path', () => {
});
it(`should save the form with all its new data`, async() => {
await page.waitFor(2000);
await page.waitFor(3000);
await page.waitForWatcherData(selectors.clientBillingData.watcher);
await page.waitToClick(selectors.clientBillingData.saveButton);
let snackbarMessage = await page.waitForLastSnackbar();

View File

@ -0,0 +1,37 @@
import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer';
describe('Client contacts', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'client');
await page.accessToSearchResult('Clark Kent');
await page.accessToSection('client.card.contact');
});
afterAll(async() => {
await browser.close();
});
it('should add a contact', async() => {
await page.waitToClick(selectors.clientContacts.addContactButton);
await page.clearInput(selectors.clientContacts.name);
await page.write(selectors.clientContacts.name, 'Ansible');
await page.write(selectors.clientContacts.phone, 'FTL comms');
await page.waitToClick(selectors.clientContacts.saveButton);
let result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should delete de contact', async() => {
await page.waitToClick(selectors.clientContacts.deleteFirstPhone);
await page.waitToClick(selectors.clientContacts.saveButton);
let result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
});