salix/e2e/paths/04-item-module/05_niche.spec.js

67 lines
2.6 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2018-11-02 12:36:20 +00:00
describe('Item create niche path', () => {
let browser;
2020-01-09 12:07:16 +00:00
let page;
beforeAll(async() => {
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');
});
2020-01-09 12:07:16 +00:00
afterAll(async() => {
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');
});
});