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

65 lines
2.4 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')
.accessToSearchResult('Gem of Time')
.accessToSection('item.card.niche');
2018-11-02 12:36:20 +00:00
});
it(`should click create a new niche and delete a former one`, async () => {
const result = await nightmare
.waitToClick(selectors.itemNiches.addNicheButton)
.waitToClick(selectors.itemNiches.secondNicheRemoveButton)
.waitToClick(selectors.itemNiches.thirdWarehouseSelect)
.waitToClick(selectors.itemNiches.thirdWarehouseSelectFourthOption)
.type(selectors.itemNiches.thirdCodeInput, 'A4')
.click(selectors.itemNiches.submitNichesButton)
2018-11-02 12:36:20 +00:00
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it(`should confirm the first niche is the expected one`, async () => {
let result = await nightmare
.click(selectors.itemBasicData.basicDataButton)
.wait(selectors.itemBasicData.nameInput)
.click(selectors.itemNiches.nicheButton)
.waitForTextInInput(selectors.itemNiches.firstWarehouseSelect, 'Warehouse One')
.waitToGetProperty(selectors.itemNiches.firstWarehouseSelect, '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');
});
it(`should confirm the second niche is the expected one`, async () => {
let result = await nightmare
.waitToGetProperty(selectors.itemNiches.secondWarehouseSelect, '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');
});
it(`should confirm the third niche is the expected one`, async () => {
let result = await nightmare
.waitToGetProperty(selectors.itemNiches.thirdWarehouseSelect, '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');
});
});