salix/e2e/paths/04-item/12_request.spec.js

46 lines
1.8 KiB
JavaScript
Raw Permalink Normal View History

2020-02-14 13:52:47 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2020-02-20 08:31:44 +00:00
describe('Item request path', () => {
2020-02-14 13:52:47 +00:00
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');
2020-02-14 13:52:47 +00:00
});
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 1x0.5m');
let filledConcept = await page.waitToGetProperty(selectors.itemRequest.firstRequestConcept, 'innerText');
expect(filledConcept).toContain('Melee weapon heavy shield 1x0.5m');
});
2020-11-11 15:54:27 +00:00
it('should check the status of the request should now be accepted', async() => {
2020-02-14 13:52:47 +00:00
let status = await page.waitToGetProperty(selectors.itemRequest.firstRequestStatus, 'innerText');
expect(status).toContain('Accepted');
2020-02-14 13:52:47 +00:00
});
2020-02-20 08:31:44 +00:00
it('should now click on the second declain request icon then type the reason', async() => {
await page.waitToClick(selectors.itemRequest.secondRequestDecline);
2020-03-24 16:27:21 +00:00
await page.write(selectors.itemRequest.declineReason, 'Not quite as expected');
await page.respondToDialog('accept');
2020-11-11 15:54:27 +00:00
let status = await page.waitToGetProperty(selectors.itemRequest.secondRequestStatus, 'innerText');
2020-02-14 13:52:47 +00:00
expect(status).toContain('Denied');
2020-02-14 13:52:47 +00:00
});
});