67 lines
2.4 KiB
JavaScript
67 lines
2.4 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() => {
|
|
await browser.close();
|
|
});
|
|
|
|
it(`should click create a new niche and delete a former one`, async() => {
|
|
await page.waitForTextInField(selectors.itemNiches.firstWarehouse, 'Warehouse One');
|
|
await page.waitToClick(selectors.itemNiches.addNicheButton);
|
|
await page.waitToClick(selectors.itemNiches.secondNicheRemoveButton);
|
|
await page.autocompleteSearch(selectors.itemNiches.thirdWarehouse, 'Warehouse Two');
|
|
await page.write(selectors.itemNiches.thirdCode, 'A44');
|
|
await page.waitToClick(selectors.itemNiches.submitNichesButton);
|
|
const message = await page.waitForSnackbar();
|
|
|
|
expect(message.text).toBe('Data saved!');
|
|
});
|
|
|
|
it(`should confirm the first niche is the expected one`, async() => {
|
|
await page.reloadSection('item.card.niche');
|
|
await page.waitForTextInField(selectors.itemNiches.firstWarehouse, 'Warehouse One');
|
|
let result = await page
|
|
.waitToGetProperty(selectors.itemNiches.firstWarehouse, 'value');
|
|
|
|
expect(result).toEqual('Warehouse One');
|
|
|
|
result = await page
|
|
.waitToGetProperty(selectors.itemNiches.firstCode, 'value');
|
|
|
|
expect(result).toEqual('A11');
|
|
});
|
|
|
|
it(`should confirm the second niche is the expected one`, async() => {
|
|
let result = await page
|
|
.waitToGetProperty(selectors.itemNiches.secondWarehouse, 'value');
|
|
|
|
expect(result).toEqual('Warehouse Three');
|
|
result = await page
|
|
.waitToGetProperty(selectors.itemNiches.secondCode, 'value');
|
|
|
|
expect(result).toEqual('A33');
|
|
});
|
|
|
|
it(`should confirm the third niche is the expected one`, async() => {
|
|
let result = await page
|
|
.waitToGetProperty(selectors.itemNiches.thirdWarehouse, 'value');
|
|
|
|
expect(result).toEqual('Warehouse Two');
|
|
result = await page
|
|
.waitToGetProperty(selectors.itemNiches.thirdCode, 'value');
|
|
|
|
expect(result).toEqual('A44');
|
|
});
|
|
});
|