2018-02-21 11:02:47 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-14 08:24:09 +00:00
|
|
|
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', () => {
|
2020-01-14 08:24:09 +00:00
|
|
|
let browser;
|
2020-01-09 12:07:16 +00:00
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
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() => {
|
2020-01-16 12:40:51 +00:00
|
|
|
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);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2020-10-30 16:09:11 +00:00
|
|
|
expect(message.text).toBe('Data saved!');
|
2018-11-20 13:22:00 +00:00
|
|
|
});
|
|
|
|
|
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);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2020-10-30 16:09:11 +00:00
|
|
|
expect(message.text).toBe('Data saved!');
|
2018-11-20 13:22:00 +00:00
|
|
|
});
|
|
|
|
|
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
|
|
|
});
|