2018-02-20 21:35:54 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-14 08:24:09 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2018-02-20 21:35:54 +00:00
|
|
|
|
2018-11-02 12:36:20 +00:00
|
|
|
describe('Item create niche path', () => {
|
2020-01-14 08:24:09 +00:00
|
|
|
let browser;
|
2020-01-09 12:07:16 +00:00
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.loginAndModule('buyer', 'item');
|
|
|
|
await page.accessToSearchResult('Ranged weapon longbow 2m');
|
|
|
|
await page.accessToSection('item.card.niche');
|
|
|
|
});
|
2018-02-20 21:35:54 +00:00
|
|
|
|
2020-01-09 12:07:16 +00:00
|
|
|
afterAll(async() => {
|
2020-01-16 12:40:51 +00:00
|
|
|
await browser.close();
|
2018-11-02 12:36:20 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should click create a new niche and delete a former one`, async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.waitForTextInField(selectors.itemNiches.firstWarehouse, 'Warehouse One');
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemNiches.addNicheButton);
|
|
|
|
await page.waitToClick(selectors.itemNiches.secondNicheRemoveButton);
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.itemNiches.thirdWarehouse, 'Warehouse Two');
|
|
|
|
await page.write(selectors.itemNiches.thirdCode, 'A4');
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemNiches.submitNichesButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-11-02 12:36:20 +00:00
|
|
|
|
2020-04-08 09:24:40 +00:00
|
|
|
expect(message.type).toBe('success');
|
2018-11-02 12:36:20 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should confirm the first niche is the expected one`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.reloadSection('item.card.niche');
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.waitForTextInField(selectors.itemNiches.firstWarehouse, 'Warehouse One');
|
2020-01-09 12:07:16 +00:00
|
|
|
let result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.itemNiches.firstWarehouse, 'value');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Warehouse One');
|
2020-01-09 12:07:16 +00:00
|
|
|
|
|
|
|
result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.itemNiches.firstCode, 'value');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('A1');
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should confirm the second niche is the expected one`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
let result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.itemNiches.secondWarehouse, 'value');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Warehouse Three');
|
2020-01-09 12:07:16 +00:00
|
|
|
result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.itemNiches.secondCode, 'value');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('A3');
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should confirm the third niche is the expected one`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
let result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.itemNiches.thirdWarehouse, 'value');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Warehouse Two');
|
2020-01-09 12:07:16 +00:00
|
|
|
result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.itemNiches.thirdCode, 'value');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('A4');
|
2018-02-20 21:35:54 +00:00
|
|
|
});
|
|
|
|
});
|