54 lines
2.4 KiB
JavaScript
54 lines
2.4 KiB
JavaScript
import selectors from '../../helpers/selectors';
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
describe('Client add address notes path', () => {
|
|
let browser;
|
|
let page;
|
|
beforeAll(async() => {
|
|
browser = await getBrowser();
|
|
page = browser.page;
|
|
await page.loginAndModule('employee', 'client');
|
|
await page.accessToSearchResult('Petter Parker');
|
|
await page.accessToSection('client.card.address.index');
|
|
});
|
|
|
|
afterAll(async() => {
|
|
await browser.close();
|
|
});
|
|
|
|
it(`should click on the edit icon of the default address`, async() => {
|
|
await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street');
|
|
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
|
await page.waitForState('client.card.address.edit');
|
|
});
|
|
|
|
it('should not save a description without observation type', async() => {
|
|
await page.waitToClick(selectors.clientAddresses.addObservationButton);
|
|
await page.write(selectors.clientAddresses.firstObservationDescription, 'first description');
|
|
await page.waitToClick(selectors.clientAddresses.saveButton);
|
|
const message = await page.waitForSnackbar();
|
|
|
|
expect(message.text).toContain('Some fields are invalid');
|
|
});
|
|
|
|
it('should not save an observation type without description', async() => {
|
|
await page.clearInput(selectors.clientAddresses.firstObservationDescription);
|
|
await page.autocompleteSearch(selectors.clientAddresses.firstObservationType, 'comercial');
|
|
await page.waitToClick(selectors.clientAddresses.saveButton);
|
|
const message = await page.waitForSnackbar();
|
|
|
|
expect(message.text).toContain('Some fields are invalid');
|
|
});
|
|
|
|
it('should create two new observations', async() => {
|
|
await page.write(selectors.clientAddresses.firstObservationDescription, 'first description');
|
|
await page.waitToClick(selectors.clientAddresses.addObservationButton);
|
|
await page.autocompleteSearch(selectors.clientAddresses.secondObservationType, 'observation one');
|
|
await page.write(selectors.clientAddresses.secondObservationDescription, 'second description');
|
|
await page.waitToClick(selectors.clientAddresses.saveButton);
|
|
const message = await page.waitForSnackbar();
|
|
|
|
expect(message.text).toContain('Data saved!');
|
|
});
|
|
});
|