import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; describe('Client web Payment', () => { const nightmare = createNightmare(); describe('as employee', () => { beforeAll(() => { nightmare .loginAndModule('employee', 'client') .accessToSearchResult('Tony Stark') .accessToSection('client.card.webPayment'); }); it('should not be able to confirm payments', async() => { let exists = await nightmare .exists(selectors.webPayment.confirmFirstPaymentButton); expect(exists).toBeFalsy(); }); }); describe('as administrative', () => { beforeAll(() => { nightmare .loginAndModule('administrative', 'client') .accessToSearchResult('Tony Stark') .accessToSection('client.card.webPayment'); }); it('should be able to confirm payments', async() => { let exists = await nightmare .waitToClick(selectors.webPayment.confirmFirstPaymentButton) .wait(selectors.webPayment.firstPaymentConfirmed) .exists(selectors.webPayment.firstPaymentConfirmed); expect(exists).toBeTruthy(); }); }); });