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

67 lines
2.4 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-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);
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');
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');
});
});