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;
|
|
|
|
await page.loginAndModule('deliveryBoss', 'zone'); // turns up the zone module name and route aint the same lol
|
|
|
|
await page.accessToSearchResult('10');
|
|
|
|
await page.accessToSection('zone.card.basicData');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should reach the basic data section', async() => {
|
|
|
|
let url = await page.expectURL('#!/zone/10/basic-data');
|
|
|
|
|
|
|
|
expect(url).toBe(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
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.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-03-23 22:57:11 +00:00
|
|
|
const result = await page.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('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');
|
|
|
|
});
|
|
|
|
});
|