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-01-09 12:07:16 +00:00
|
|
|
await page.waitForTextInInput(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One');
|
|
|
|
await page.waitToClick(selectors.itemNiches.addNicheButton);
|
|
|
|
await page.waitToClick(selectors.itemNiches.secondNicheRemoveButton);
|
|
|
|
await page.autocompleteSearch(selectors.itemNiches.thirdWarehouseAutocomplete, 'Warehouse Two');
|
|
|
|
await page.write(selectors.itemNiches.thirdCodeInput, 'A4');
|
|
|
|
await page.waitToClick(selectors.itemNiches.submitNichesButton);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
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');
|
|
|
|
await page.waitForTextInInput(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One');
|
|
|
|
let result = await page
|
2019-01-07 09:55:23 +00:00
|
|
|
.waitToGetProperty(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, '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
|
|
|
|
.waitToGetProperty(`${selectors.itemNiches.firstCodeInput} input`, '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
|
2019-01-07 09:55:23 +00:00
|
|
|
.waitToGetProperty(`${selectors.itemNiches.secondWarehouseAutocomplete} input`, '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
|
|
|
|
.waitToGetProperty(`${selectors.itemNiches.secondCodeInput} input`, '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
|
2019-01-07 08:33:07 +00:00
|
|
|
.waitToGetProperty(`${selectors.itemNiches.thirdWarehouseAutocomplete} input`, '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
|
|
|
|
.waitToGetProperty(`${selectors.itemNiches.thirdCodeInput} input`, 'value');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('A4');
|
2018-02-20 21:35:54 +00:00
|
|
|
});
|
|
|
|
});
|