import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Item Create botanical path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('buyer', 'item'); await page.accessToSearchResult('Ranged weapon pistol 9mm'); await page.accessToSection('item.card.botanical'); }); afterAll(async() => { await browser.close(); }); it(`should create a new botanical for the item`, async() => { await page.write(selectors.itemBotanical.botanical, 'Cicuta maculata'); await page.autocompleteSearch(selectors.itemBotanical.genus, 'Abelia'); await page.autocompleteSearch(selectors.itemBotanical.species, 'dealbata'); await page.waitToClick(selectors.itemBotanical.submitBotanicalButton); const message = await page.waitForSnackbar(); expect(message.text).toBe('Data saved!'); }); it(`should confirm the botanical for the item was created`, async() => { await page.reloadSection('item.card.botanical'); await page.waitForTextInField(selectors.itemBotanical.botanical, 'Cicuta maculata'); const result = await page .waitToGetProperty(selectors.itemBotanical.botanical, 'value'); expect(result).toEqual('Cicuta maculata'); }); it(`should confirm the Genus for the item was created`, async() => { await page.waitForTextInField(selectors.itemBotanical.genus, 'Abelia'); const result = await page .waitToGetProperty(selectors.itemBotanical.genus, 'value'); expect(result).toEqual('Abelia'); }); it(`should confirm the Species for the item was created`, async() => { const result = await page .waitToGetProperty(selectors.itemBotanical.species, 'value'); expect(result).toEqual('dealbata'); }); it(`should edit botanical for the item`, async() => { 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'); await page.waitToClick(selectors.itemBotanical.submitBotanicalButton); const message = await page.waitForSnackbar(); expect(message.text).toBe('Data saved!'); }); it(`should confirm the botanical for the item was edited`, async() => { await page.reloadSection('item.card.botanical'); await page.waitForTextInField(selectors.itemBotanical.botanical, 'Herp Derp'); const result = await page .waitToGetProperty(selectors.itemBotanical.botanical, 'value'); expect(result).toEqual('Herp Derp'); }); it(`should confirm the Genus for the item was edited`, async() => { await page.waitForTextInField(selectors.itemBotanical.genus, 'Abies'); const result = await page .waitToGetProperty(selectors.itemBotanical.genus, 'value'); expect(result).toEqual('Abies'); }); it(`should confirm the Species for the item was edited`, async() => { const result = await page .waitToGetProperty(selectors.itemBotanical.species, 'value'); expect(result).toEqual('decurrens'); }); });