2018-02-26 15:06:49 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-14 08:24:09 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2018-02-26 15:06:49 +00:00
|
|
|
|
2018-11-21 13:09:22 +00:00
|
|
|
describe('Item Create/Clone 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');
|
|
|
|
});
|
2018-11-21 13:09:22 +00:00
|
|
|
|
2020-01-09 12:07:16 +00:00
|
|
|
afterAll(async() => {
|
2020-01-16 12:40:51 +00:00
|
|
|
await browser.close();
|
2020-01-09 12:07:16 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('create', () => {
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.clearInput(selectors.itemsIndex.topbarSearch);
|
|
|
|
await page.write(selectors.itemsIndex.topbarSearch, 'Infinity Gauntlet');
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.searchButton);
|
|
|
|
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0);
|
|
|
|
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
2018-11-21 13:09:22 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(0);
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should access to the create item view by clicking the create floating button', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
2020-02-04 15:21:10 +00:00
|
|
|
let url = await page.expectURL('#!/item/create');
|
2018-11-21 13:09:22 +00:00
|
|
|
|
2020-02-04 15:21:10 +00:00
|
|
|
expect(url).toBe(true);
|
2018-11-21 13:09:22 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should return to the item index by clickig the cancel button', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemCreateView.cancelButton);
|
2020-02-04 15:21:10 +00:00
|
|
|
let url = await page.expectURL('#!/item/index');
|
2018-11-21 13:09:22 +00:00
|
|
|
|
2020-02-04 15:21:10 +00:00
|
|
|
expect(url).toBe(true);
|
2018-11-21 13:09:22 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should now access to the create item view by clicking the create floating button', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
2020-02-04 15:21:10 +00:00
|
|
|
let url = await page.expectURL('#!/item/create');
|
2018-11-21 13:09:22 +00:00
|
|
|
|
2020-02-04 15:21:10 +00:00
|
|
|
expect(url).toBe(true);
|
2018-11-21 13:09:22 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should create the Infinity Gauntlet item', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet');
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.itemCreateView.type, 'Crisantemo');
|
|
|
|
await page.autocompleteSearch(selectors.itemCreateView.intrastat, 'Coral y materiales similares');
|
|
|
|
await page.autocompleteSearch(selectors.itemCreateView.origin, 'Holand');
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemCreateView.createButton);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2018-11-21 13:09:22 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm Infinity Gauntlet item was created', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
let result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.name, 'value');
|
2018-11-21 13:09:22 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Infinity Gauntlet');
|
|
|
|
|
2020-01-09 12:07:16 +00:00
|
|
|
result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.type, 'value');
|
2018-11-21 13:09:22 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Crisantemo');
|
|
|
|
|
2020-01-09 12:07:16 +00:00
|
|
|
result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.intrastat, 'value');
|
2018-11-21 13:09:22 +00:00
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
expect(result).toEqual('5080000 Coral y materiales similares');
|
2018-11-21 13:09:22 +00:00
|
|
|
|
2020-01-09 12:07:16 +00:00
|
|
|
result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.origin, 'value');
|
2018-11-21 13:09:22 +00:00
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
expect(result).toEqual('Holand');
|
2018-11-21 13:09:22 +00:00
|
|
|
});
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
|
2020-03-18 12:54:05 +00:00
|
|
|
// Issue #2201
|
|
|
|
// When there is just one result you're redirected automatically to it, so
|
|
|
|
// it's not possible to use the clone option.
|
2020-03-17 13:01:25 +00:00
|
|
|
xdescribe('clone', () => {
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should return to the items index by clicking the return to items button', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemBasicData.goToItemIndexButton);
|
|
|
|
await page.wait(selectors.itemsIndex.createItemButton);
|
2020-02-04 15:21:10 +00:00
|
|
|
let url = await page.expectURL('#!/item/index');
|
2018-11-21 13:09:22 +00:00
|
|
|
|
2020-02-04 15:21:10 +00:00
|
|
|
expect(url).toBe(true);
|
2018-11-21 13:09:22 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should search for the item Infinity Gauntlet`, async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.clearInput(selectors.itemsIndex.topbarSearch);
|
|
|
|
await page.write(selectors.itemsIndex.topbarSearch, 'Infinity Gauntlet');
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.searchButton);
|
|
|
|
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
|
|
|
|
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
2018-11-21 13:09:22 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should clone the Infinity Gauntlet`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet');
|
|
|
|
await page.waitToClick(selectors.itemsIndex.searchResultCloneButton);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.acceptClonationAlertButton);
|
2020-02-04 15:21:10 +00:00
|
|
|
let url = await page.expectURL('tags');
|
2018-11-21 13:09:22 +00:00
|
|
|
|
2020-02-04 15:21:10 +00:00
|
|
|
expect(url).toBe(true);
|
2018-11-21 13:09:22 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should search for the item Infinity Gauntlet and find two', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemTags.goToItemIndexButton);
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.clearInput(selectors.itemsIndex.topbarSearch);
|
|
|
|
await page.write(selectors.itemsIndex.topbarSearch, 'Infinity Gauntlet');
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.searchButton);
|
|
|
|
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2);
|
|
|
|
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
2018-11-21 13:09:22 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(2);
|
|
|
|
});
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
});
|