2018-02-20 21:35:54 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-10-24 08:57:14 +00:00
|
|
|
import createNightmare from '../../helpers/nightmare';
|
2018-02-20 21:35:54 +00:00
|
|
|
|
2018-11-02 12:36:20 +00:00
|
|
|
describe('Item create niche path', () => {
|
|
|
|
const nightmare = createNightmare();
|
2018-02-20 21:35:54 +00:00
|
|
|
|
2018-11-02 12:36:20 +00:00
|
|
|
beforeAll(() => {
|
2018-11-20 13:22:00 +00:00
|
|
|
nightmare
|
2018-12-02 23:45:34 +00:00
|
|
|
.loginAndModule('buyer', 'item')
|
2019-01-10 06:26:10 +00:00
|
|
|
.accessToSearchResult('Object1 Gem1 5')
|
2018-12-02 23:45:34 +00:00
|
|
|
.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
|
2018-04-05 06:55:47 +00:00
|
|
|
.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-27 20:09:54 +00:00
|
|
|
.reloadSection('item.card.niche')
|
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
|
2018-11-22 14:44:33 +00:00
|
|
|
.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
|
2018-11-22 14:44:33 +00:00
|
|
|
.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
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.itemNiches.thirdCodeInput, 'value');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('A4');
|
2018-02-20 21:35:54 +00:00
|
|
|
});
|
|
|
|
});
|