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

67 lines
2.4 KiB
JavaScript
Raw Permalink 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.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-11-10 11:06:21 +00:00
expect(message.text).toContain('Data saved!');
2018-11-20 13:22:00 +00:00
});
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.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-11-10 11:06:21 +00:00
expect(message.text).toContain('Data saved!');
2018-11-20 13:22:00 +00:00
});
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
});