salix/e2e/paths/item-module/05_create_item_niche.spec.js

64 lines
2.5 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
2018-11-02 12:36:20 +00:00
describe('Item create niche path', () => {
const nightmare = createNightmare();
2018-11-02 12:36:20 +00:00
beforeAll(() => {
2018-11-20 13:22:00 +00:00
nightmare
.loginAndModule('buyer', 'item')
2019-01-10 06:26:10 +00:00
.accessToSearchResult('Object1 Gem1 5')
.accessToSection('item.card.niche');
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() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
.waitToClick(selectors.itemNiches.addNicheButton)
.waitToClick(selectors.itemNiches.secondNicheRemoveButton)
2019-01-07 08:33:07 +00:00
.autocompleteSearch(selectors.itemNiches.thirdWarehouseAutocomplete, 'Warehouse Two')
2019-01-23 14:33:25 +00:00
.write(selectors.itemNiches.thirdCodeInput, 'A4')
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.itemNiches.submitNichesButton)
2018-11-02 12:36:20 +00:00
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
2019-01-07 08:33:07 +00:00
it(`should confirm the first niche is the expected one`, async() => {
2018-11-02 12:36:20 +00:00
let result = await nightmare
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.itemBasicData.basicDataButton)
.wait(selectors.itemBasicData.nameInput)
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.itemNiches.nicheButton)
2019-01-07 09:55:23 +00:00
.waitForTextInInput(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'Warehouse One')
.waitToGetProperty(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'value');
2018-11-02 12:36:20 +00:00
expect(result).toEqual('Warehouse One');
result = await nightmare
.waitToGetProperty(selectors.itemNiches.firstCodeInput, '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() => {
2018-11-02 12:36:20 +00:00
let result = await nightmare
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');
result = await nightmare
.waitToGetProperty(selectors.itemNiches.secondCodeInput, '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() => {
2018-11-02 12:36:20 +00:00
let result = await nightmare
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');
result = await nightmare
.waitToGetProperty(selectors.itemNiches.thirdCodeInput, 'value');
2018-11-02 12:36:20 +00:00
expect(result).toEqual('A4');
});
});