import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Item Edit basic data path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('buyer', 'item'); await page.accessToSearchResult('Melee weapon combat fist 15cm'); await page.accessToSection('item.card.basicData'); }); afterAll(async() => { await browser.close(); }); it(`should check the descritor edit button is visible for buyer`, async() => { await page.waitForSelector(selectors.itemDescriptor.editButton, {visible: true}); }); it(`should edit the item basic data`, async() => { await page.clearInput(selectors.itemBasicData.nameInput); await page.write(selectors.itemBasicData.nameInput, 'Rose of Purity'); await page.autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Anthurium'); await page.autocompleteSearch(selectors.itemBasicData.intrastatAutocomplete, 'Coral y materiales similares'); await page.clearInput(selectors.itemBasicData.relevancyInput); await page.write(selectors.itemBasicData.relevancyInput, '1'); await page.autocompleteSearch(selectors.itemBasicData.originAutocomplete, 'Spain'); await page.autocompleteSearch(selectors.itemBasicData.expenseAutocomplete, 'Alquiler VNH'); await page.clearInput(selectors.itemBasicData.longNameInput); await page.write(selectors.itemBasicData.longNameInput, 'RS Rose of Purity'); await page.waitToClick(selectors.itemBasicData.isActiveCheckbox); await page.waitToClick(selectors.itemBasicData.priceInKgCheckbox); await page.waitToClick(selectors.itemBasicData.submitBasicDataButton); const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }, 20000); it(`should confirm the item name was edited`, async() => { await page.reloadSection('item.card.basicData'); await page.waitForContentLoaded(); const result = await page.waitToGetProperty(selectors.itemBasicData.nameInput, 'value'); expect(result).toEqual('Rose of Purity'); }); it(`should confirm the item type was edited`, async() => { const result = await page .waitToGetProperty(selectors.itemBasicData.typeAutocomplete, 'value'); expect(result).toEqual('Anthurium'); }); it(`should confirm the item intrastad was edited`, async() => { const result = await page .waitToGetProperty(selectors.itemBasicData.intrastatAutocomplete, 'value'); expect(result).toEqual('5080000 Coral y materiales similares'); }); it(`should confirm the item relevancy was edited`, async() => { const result = await page .waitToGetProperty(selectors.itemBasicData.relevancyInput, 'value'); expect(result).toEqual('1'); }); it(`should confirm the item origin was edited`, async() => { const result = await page .waitToGetProperty(selectors.itemBasicData.originAutocomplete, 'value'); expect(result).toEqual('Spain'); }); it(`should confirm the item expence was edited`, async() => { const result = await page .waitToGetProperty(selectors.itemBasicData.expenseAutocomplete, 'value'); expect(result).toEqual('Alquiler VNH'); }); it(`should confirm the item long name was edited`, async() => { const result = await page .waitToGetProperty(selectors.itemBasicData.longNameInput, 'value'); expect(result).toEqual('RS Rose of Purity'); }); it('should confirm isActive checkbox is unchecked', async() => { const result = await page .checkboxState(selectors.itemBasicData.isActiveCheckbox); expect(result).toBe('unchecked'); }); it('should confirm the priceInKg checkbox is checked', async() => { const result = await page .checkboxState(selectors.itemBasicData.priceInKgCheckbox); expect(result).toBe('checked'); }); });