import selectors from '../../helpers/selectors.js'; import openPage from '../../helpers/puppeteer'; describe('Item Edit basic data path', () => { let page; beforeAll(async() => { page = await openPage(); await page.loginAndModule('buyer', 'item'); await page.accessToSearchResult('Melee weapon combat fist 15cm'); await page.accessToSection('item.card.basicData'); }); afterAll(async() => { page.close(); }); it(`should check the descritor edit button is visible for buyer`, async() => { await page.waitFor(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!'); }, 15000); it(`should confirm the item name was edited`, async() => { await page.reloadSection('item.card.basicData'); const result = await page.waitToGetProperty(`${selectors.itemBasicData.nameInput} input`, 'value'); expect(result).toEqual('Rose of Purity'); }); it(`should confirm the item type was edited`, async() => { const result = await page .waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value'); expect(result).toEqual('Anthurium'); }); it(`should confirm the item intrastad was edited`, async() => { const result = await page .waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, '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} input`, 'value'); expect(result).toEqual('1'); }); it(`should confirm the item origin was edited`, async() => { const result = await page .waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value'); expect(result).toEqual('Spain'); }); it(`should confirm the item expence was edited`, async() => { const result = await page .waitToGetProperty(`${selectors.itemBasicData.expenseAutocomplete} input`, 'value'); expect(result).toEqual('Alquiler VNH'); }); it(`should confirm the item long name was edited`, async() => { const result = await page .waitToGetProperty(`${selectors.itemBasicData.longNameInput} input`, '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'); }); });