import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Item request path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('buyer', 'item'); await page.accessToSection('item.request'); }); afterAll(async() => { await browser.close(); }); it('should reach the item request section', async() => { await page.waitForState('item.request'); }); it('should fill the id and quantity then check the concept was updated', async() => { await page.writeOnEditableTD(selectors.itemRequest.firstRequestItemID, '4'); await page.writeOnEditableTD(selectors.itemRequest.firstRequestQuantity, '10'); await page.waitForTextInElement(selectors.itemRequest.firstRequestConcept, 'Melee weapon heavy shield 100cm'); let filledConcept = await page.waitToGetProperty(selectors.itemRequest.firstRequestConcept, 'innerText'); expect(filledConcept).toContain('Melee weapon heavy shield 100cm'); }); it('should check the status of the request should now be accepted', async() => { let status = await page.waitToGetProperty(selectors.itemRequest.firstRequestStatus, 'innerText'); expect(status).toContain('Accepted'); }); it('should now click on the second declain request icon then type the reason', async() => { await page.waitToClick(selectors.itemRequest.secondRequestDecline); await page.write(selectors.itemRequest.declineReason, 'Not quite as expected'); await page.respondToDialog('accept'); let status = await page.waitToGetProperty(selectors.itemRequest.secondRequestStatus, 'innerText'); expect(status).toContain('Denied'); }); });