67 lines
2.6 KiB
JavaScript
67 lines
2.6 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
describe('Item create niche path', () => {
|
|
let browser;
|
|
let page;
|
|
beforeAll(async() => {
|
|
browser = await getBrowser();
|
|
page = browser.page;
|
|
await page.loginAndModule('buyer', 'item');
|
|
await page.accessToSearchResult('Ranged weapon longbow 2m');
|
|
await page.accessToSection('item.card.niche');
|
|
});
|
|
|
|
afterAll(async() => {
|
|
browser.close();
|
|
});
|
|
|
|
it(`should click create a new niche and delete a former one`, async() => {
|
|
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();
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
});
|
|
|
|
it(`should confirm the first niche is the expected one`, async() => {
|
|
await page.reloadSection('item.card.niche');
|
|
await page.waitForTextInInput(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One');
|
|
let result = await page
|
|
.waitToGetProperty(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'value');
|
|
|
|
expect(result).toEqual('Warehouse One');
|
|
|
|
result = await page
|
|
.waitToGetProperty(`${selectors.itemNiches.firstCodeInput} input`, 'value');
|
|
|
|
expect(result).toEqual('A1');
|
|
});
|
|
|
|
it(`should confirm the second niche is the expected one`, async() => {
|
|
let result = await page
|
|
.waitToGetProperty(`${selectors.itemNiches.secondWarehouseAutocomplete} input`, 'value');
|
|
|
|
expect(result).toEqual('Warehouse Three');
|
|
result = await page
|
|
.waitToGetProperty(`${selectors.itemNiches.secondCodeInput} input`, 'value');
|
|
|
|
expect(result).toEqual('A3');
|
|
});
|
|
|
|
it(`should confirm the third niche is the expected one`, async() => {
|
|
let result = await page
|
|
.waitToGetProperty(`${selectors.itemNiches.thirdWarehouseAutocomplete} input`, 'value');
|
|
|
|
expect(result).toEqual('Warehouse Two');
|
|
result = await page
|
|
.waitToGetProperty(`${selectors.itemNiches.thirdCodeInput} input`, 'value');
|
|
|
|
expect(result).toEqual('A4');
|
|
});
|
|
});
|