salix/e2e/paths/04-item-module/02_basic_data.spec.js

106 lines
4.2 KiB
JavaScript
Raw Normal View History

2018-02-22 10:26:32 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2018-02-22 10:26:32 +00:00
2018-11-20 13:22:00 +00:00
describe('Item Edit basic data 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('Melee weapon combat fist 15cm');
await page.accessToSection('item.card.basicData');
});
2018-11-20 13:22:00 +00:00
2020-01-09 12:07:16 +00:00
afterAll(async() => {
await browser.close();
2018-11-20 13:22:00 +00:00
});
2019-02-04 13:47:55 +00:00
it(`should check the descritor edit button is visible for buyer`, async() => {
2020-01-09 12:07:16 +00:00
await page.waitFor(selectors.itemDescriptor.editButton, {visible: true});
2019-02-04 13:47:55 +00:00
});
2019-01-07 08:33:07 +00:00
it(`should edit the item basic data`, async() => {
2020-01-09 12:07:16 +00:00
await page.clearInput(selectors.itemBasicData.nameInput);
await page.write(selectors.itemBasicData.nameInput, 'Rose of Purity');
await page.autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Anthurium');
await page.autocompleteSearch(selectors.itemBasicData.intrastatAutocomplete, 'Coral y materiales similares');
await page.clearInput(selectors.itemBasicData.relevancyInput);
await page.write(selectors.itemBasicData.relevancyInput, '1');
await page.autocompleteSearch(selectors.itemBasicData.originAutocomplete, 'Spain');
await page.autocompleteSearch(selectors.itemBasicData.expenseAutocomplete, 'Alquiler VNH');
await page.clearInput(selectors.itemBasicData.longNameInput);
await page.write(selectors.itemBasicData.longNameInput, 'RS Rose of Purity');
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
await page.waitToClick(selectors.itemBasicData.priceInKgCheckbox);
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
const result = await page.waitForLastSnackbar();
2018-11-20 13:22:00 +00:00
expect(result).toEqual('Data saved!');
}, 20000);
2018-11-20 13:22:00 +00:00
2019-01-07 08:33:07 +00:00
it(`should confirm the item name was edited`, async() => {
2020-01-09 12:07:16 +00:00
await page.reloadSection('item.card.basicData');
await page.waitForContentLoaded();
2020-01-09 12:07:16 +00:00
const result = await page.waitToGetProperty(`${selectors.itemBasicData.nameInput} input`, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('Rose of Purity');
});
2019-01-07 08:33:07 +00:00
it(`should confirm the item type was edited`, async() => {
2020-01-09 12:07:16 +00:00
const result = await page
2019-01-07 08:33:07 +00:00
.waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('Anthurium');
2018-11-20 13:22:00 +00:00
});
2019-01-07 08:33:07 +00:00
it(`should confirm the item intrastad was edited`, async() => {
2020-01-09 12:07:16 +00:00
const result = await page
2019-01-07 08:33:07 +00:00
.waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('5080000 Coral y materiales similares');
});
2019-01-07 08:33:07 +00:00
it(`should confirm the item relevancy was edited`, async() => {
2020-01-09 12:07:16 +00:00
const result = await page
.waitToGetProperty(`${selectors.itemBasicData.relevancyInput} input`, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('1');
});
2019-01-07 08:33:07 +00:00
it(`should confirm the item origin was edited`, async() => {
2020-01-09 12:07:16 +00:00
const result = await page
2019-01-07 08:33:07 +00:00
.waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('Spain');
});
2019-01-07 08:33:07 +00:00
it(`should confirm the item expence was edited`, async() => {
2020-01-09 12:07:16 +00:00
const result = await page
2019-12-13 11:18:20 +00:00
.waitToGetProperty(`${selectors.itemBasicData.expenseAutocomplete} input`, 'value');
2018-11-20 13:22:00 +00:00
2019-01-07 08:33:07 +00:00
expect(result).toEqual('Alquiler VNH');
2018-11-20 13:22:00 +00:00
});
2019-01-07 08:33:07 +00:00
it(`should confirm the item long name was edited`, async() => {
2020-01-09 12:07:16 +00:00
const result = await page
.waitToGetProperty(`${selectors.itemBasicData.longNameInput} input`, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('RS Rose of Purity');
});
2019-01-07 08:33:07 +00:00
it('should confirm isActive checkbox is unchecked', async() => {
2020-01-09 12:07:16 +00:00
const result = await page
.checkboxState(selectors.itemBasicData.isActiveCheckbox);
2018-11-20 13:22:00 +00:00
expect(result).toBe('unchecked');
2018-02-22 10:26:32 +00:00
});
it('should confirm the priceInKg checkbox is checked', async() => {
2020-01-09 12:07:16 +00:00
const result = await page
.checkboxState(selectors.itemBasicData.priceInKgCheckbox);
expect(result).toBe('checked');
});
2018-02-22 10:26:32 +00:00
});