salix/e2e/paths/04-item/13_fixedPrice.spec.js

47 lines
1.8 KiB
JavaScript
Raw Normal View History

2021-01-19 19:56:33 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2022-12-21 12:47:43 +00:00
describe('Item fixed prices path', () => {
2021-01-19 19:56:33 +00:00
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'item');
await page.accessToSection('item.fixedPrice');
});
afterAll(async() => {
await browser.close();
});
it('should click on the add new foxed price button', async() => {
await page.doSearch();
2021-01-19 19:56:33 +00:00
await page.waitToClick(selectors.itemFixedPrice.add);
await page.waitForSelector(selectors.itemFixedPrice.fourthFixedPrice);
});
it('should fill the fixed price data', async() => {
const now = new Date();
await page.autocompleteSearch(selectors.itemFixedPrice.fourthWarehouse, 'Warehouse one');
await page.writeOnEditableTD(selectors.itemFixedPrice.fourthGroupingPrice, '1');
await page.writeOnEditableTD(selectors.itemFixedPrice.fourthPackingPrice, '1');
await page.write(selectors.itemFixedPrice.fourthMinPrice, '1');
2021-01-19 19:56:33 +00:00
await page.pickDate(selectors.itemFixedPrice.fourthStarted, now);
await page.pickDate(selectors.itemFixedPrice.fourthEnded, now);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should reload the section and check the created price has the expected ID', async() => {
await page.accessToSection('item.index');
await page.accessToSection('item.fixedPrice');
await page.doSearch();
const result = await page.waitToGetProperty(selectors.itemFixedPrice.fourthItemID, 'value');
2021-01-19 19:56:33 +00:00
expect(result).toContain('13');
});
});