salix/e2e/paths/04-item-module/06_botanical.spec.js

86 lines
3.5 KiB
JavaScript
Raw Normal View History

2018-02-21 11:02:47 +00:00
import selectors from '../../helpers/selectors.js';
2020-01-09 12:07:16 +00:00
import openPage from '../../helpers/puppeteer';
2018-02-21 11:02:47 +00:00
2018-11-20 13:22:00 +00:00
describe('Item Create botanical path', () => {
2020-01-09 12:07:16 +00:00
let page;
beforeAll(async() => {
page = await openPage();
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Ranged weapon pistol 9mm');
await page.accessToSection('item.card.botanical');
});
2018-02-21 11:02:47 +00:00
2020-01-09 12:07:16 +00:00
afterAll(async() => {
page.close();
2018-11-20 13:22:00 +00:00
});
2019-01-10 06:26:10 +00:00
it(`should create a new botanical for the item`, async() => {
2020-01-09 12:07:16 +00:00
await page.write(selectors.itemBotanical.botanicalInput, 'Cicuta maculata');
await page.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abelia');
await page.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'dealbata');
await page.waitToClick(selectors.itemBotanical.submitBotanicalButton);
const result = await page.waitForLastSnackbar();
2018-11-20 13:22:00 +00:00
expect(result).toEqual('Data saved!');
});
2019-01-10 06:26:10 +00:00
it(`should confirm the botanical for the item was created`, async() => {
2020-01-09 12:07:16 +00:00
await page.reloadSection('item.card.botanical');
await page.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata');
const result = await page
.waitToGetProperty(`${selectors.itemBotanical.botanicalInput} input`, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('Cicuta maculata');
});
2019-01-10 06:26:10 +00:00
it(`should confirm the Genus for the item was created`, async() => {
2020-01-09 12:07:16 +00:00
await page.waitForTextInInput(selectors.itemBotanical.genusAutocomplete, 'Abelia');
const result = await page
2019-01-07 08:33:07 +00:00
.waitToGetProperty(`${selectors.itemBotanical.genusAutocomplete} input`, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('Abelia');
});
2019-01-10 06:26:10 +00:00
it(`should confirm the Species for the item was created`, async() => {
2020-01-09 12:07:16 +00:00
const result = await page
2019-01-07 08:33:07 +00:00
.waitToGetProperty(`${selectors.itemBotanical.speciesAutocomplete} input`, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('dealbata');
});
2019-01-10 06:26:10 +00:00
it(`should edit botanical for the item`, async() => {
2020-01-09 12:07:16 +00:00
await page.clearInput(selectors.itemBotanical.botanicalInput);
await page.write(selectors.itemBotanical.botanicalInput, 'Herp Derp');
await page.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abies');
await page.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'decurrens');
await page.waitToClick(selectors.itemBotanical.submitBotanicalButton);
const result = await page.waitForLastSnackbar();
2018-11-20 13:22:00 +00:00
expect(result).toEqual('Data saved!');
});
2019-01-10 06:26:10 +00:00
it(`should confirm the botanical for the item was edited`, async() => {
2020-01-09 12:07:16 +00:00
await page.reloadSection('item.card.botanical');
await page.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp');
const result = await page
.waitToGetProperty(`${selectors.itemBotanical.botanicalInput} input`, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('Herp Derp');
});
2019-01-10 06:26:10 +00:00
it(`should confirm the Genus for the item was edited`, async() => {
2020-01-09 12:07:16 +00:00
await page.waitForTextInInput(selectors.itemBotanical.genusAutocomplete, 'Abies');
const result = await page
2019-01-07 08:33:07 +00:00
.waitToGetProperty(`${selectors.itemBotanical.genusAutocomplete} input`, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('Abies');
});
2019-01-10 06:26:10 +00:00
it(`should confirm the Species for the item 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.itemBotanical.speciesAutocomplete} input`, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('decurrens');
2018-02-21 11:47:48 +00:00
});
2018-02-21 11:02:47 +00:00
});