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

88 lines
3.4 KiB
JavaScript
Raw Normal View History

2018-02-21 11:02:47 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2018-02-21 11:02:47 +00:00
2018-11-20 13:22:00 +00:00
describe('Item Create botanical 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('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() => {
await browser.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-02-03 14:55:11 +00:00
await page.write(selectors.itemBotanical.botanical, 'Cicuta maculata');
await page.autocompleteSearch(selectors.itemBotanical.genus, 'Abelia');
await page.autocompleteSearch(selectors.itemBotanical.species, 'dealbata');
2020-01-09 12:07:16 +00:00
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');
2020-02-03 14:55:11 +00:00
await page.waitForTextInField(selectors.itemBotanical.botanical, 'Cicuta maculata');
2020-01-09 12:07:16 +00:00
const result = await page
2020-02-03 14:55:11 +00:00
.waitToGetProperty(selectors.itemBotanical.botanical, '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-02-03 14:55:11 +00:00
await page.waitForTextInField(selectors.itemBotanical.genus, 'Abelia');
2020-01-09 12:07:16 +00:00
const result = await page
2020-02-03 14:55:11 +00:00
.waitToGetProperty(selectors.itemBotanical.genus, '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
2020-02-03 14:55:11 +00:00
.waitToGetProperty(selectors.itemBotanical.species, '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-02-03 14:55:11 +00:00
await page.clearInput(selectors.itemBotanical.botanical);
await page.write(selectors.itemBotanical.botanical, 'Herp Derp');
await page.autocompleteSearch(selectors.itemBotanical.genus, 'Abies');
await page.autocompleteSearch(selectors.itemBotanical.species, 'decurrens');
2020-01-09 12:07:16 +00:00
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');
2020-02-03 14:55:11 +00:00
await page.waitForTextInField(selectors.itemBotanical.botanical, 'Herp Derp');
2020-01-09 12:07:16 +00:00
const result = await page
2020-02-03 14:55:11 +00:00
.waitToGetProperty(selectors.itemBotanical.botanical, '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-02-03 14:55:11 +00:00
await page.waitForTextInField(selectors.itemBotanical.genus, 'Abies');
2020-01-09 12:07:16 +00:00
const result = await page
2020-02-03 14:55:11 +00:00
.waitToGetProperty(selectors.itemBotanical.genus, '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
2020-02-03 14:55:11 +00:00
.waitToGetProperty(selectors.itemBotanical.species, '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
});