salix/e2e/paths/11-zone/01_basic-data.spec.js

105 lines
4.0 KiB
JavaScript
Raw Permalink Normal View History

2020-02-25 07:24:54 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2020-03-17 10:00:16 +00:00
describe('Zone basic data path', () => {
2020-02-25 07:24:54 +00:00
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
2023-06-16 07:28:56 +00:00
2023-06-21 11:34:27 +00:00
await page.loginAndModule('deliveryAssistant',
2023-06-16 07:28:56 +00:00
'zone'); // turns up the zone module name and route aint the same lol
2020-02-25 07:24:54 +00:00
await page.accessToSearchResult('10');
await page.accessToSection('zone.card.basicData');
});
afterAll(async() => {
await browser.close();
});
it('should reach the basic data section', async() => {
await page.waitForState('zone.card.basicData');
2020-02-25 07:24:54 +00:00
});
it('should edit de form and then save', async() => {
await page.clearInput(selectors.zoneBasicData.name);
await page.write(selectors.zoneBasicData.name, 'Brimstone teleportation');
await page.autocompleteSearch(selectors.zoneBasicData.agency, 'Quantum break device');
await page.clearInput(selectors.zoneBasicData.maxVolume);
2020-02-25 07:24:54 +00:00
await page.write(selectors.zoneBasicData.maxVolume, '10');
await page.clearInput(selectors.zoneBasicData.travelingDays);
await page.write(selectors.zoneBasicData.travelingDays, '1');
await page.clearInput(selectors.zoneBasicData.closing);
2020-03-24 09:48:16 +00:00
await page.pickTime(selectors.zoneBasicData.closing, '21:00');
2020-02-25 07:24:54 +00:00
await page.clearInput(selectors.zoneBasicData.price);
await page.write(selectors.zoneBasicData.price, '999');
await page.clearInput(selectors.zoneBasicData.bonus);
await page.write(selectors.zoneBasicData.bonus, '100');
await page.clearInput(selectors.zoneBasicData.inflation);
await page.write(selectors.zoneBasicData.inflation, '200');
await page.waitToClick(selectors.zoneBasicData.volumetric);
await page.waitToClick(selectors.zoneBasicData.saveButton);
2020-04-08 09:24:40 +00:00
const message = await page.waitForSnackbar();
2020-11-10 11:06:21 +00:00
expect(message.text).toContain('Data saved!');
2020-02-25 07:24:54 +00:00
});
2020-03-17 10:00:16 +00:00
it('should now reload the section', async() => {
2020-02-25 07:24:54 +00:00
await page.reloadSection('zone.card.basicData');
});
it('should confirm the name was updated', async() => {
const result = await page.waitToGetProperty(selectors.zoneBasicData.name, 'value');
expect(result).toEqual('Brimstone teleportation');
});
it('should confirm the agency was updated', async() => {
const result = await page.waitToGetProperty(selectors.zoneBasicData.agency, 'value');
expect(result).toEqual('Quantum break device');
});
it('should confirm the max volume was updated', async() => {
const result = await page.waitToGetProperty(selectors.zoneBasicData.maxVolume, 'value');
expect(result).toEqual('10');
});
it('should confirm the traveling days were updated', async() => {
const result = await page.waitToGetProperty(selectors.zoneBasicData.travelingDays, 'value');
expect(result).toEqual('1');
});
2020-03-17 10:00:16 +00:00
it('should confirm the closing hour was updated', async() => {
2020-02-25 07:24:54 +00:00
const result = await page.waitToGetProperty(selectors.zoneBasicData.closing, 'value');
expect(result).toEqual('21:00');
});
it('should confirm the price was updated', async() => {
const result = await page.waitToGetProperty(selectors.zoneBasicData.price, 'value');
expect(result).toEqual('999');
});
it('should confirm the bonus was updated', async() => {
const result = await page.waitToGetProperty(selectors.zoneBasicData.bonus, 'value');
expect(result).toEqual('100');
});
it('should confirm the inflation was updated', async() => {
const result = await page.waitToGetProperty(selectors.zoneBasicData.inflation, 'value');
expect(result).toEqual('200');
});
it('should confirm the volumetric checkbox was checked', async() => {
await page.waitForClassPresent(selectors.zoneBasicData.volumetric, 'checked');
});
});