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);
|
|
|
|
await page.wait(selectors.itemCreateView.createButton);
|
|
|
|
const url = await page.parsedUrl();
|
2018-11-21 13:09:22 +00:00
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/item/create');
|
|
|
|
});
|
|
|
|
|
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);
|
|
|
|
await page.wait(selectors.itemsIndex.createItemButton);
|
|
|
|
const url = await page.parsedUrl();
|
2018-11-21 13:09:22 +00:00
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/item/index');
|
|
|
|
});
|
|
|
|
|
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-23 15:01:29 +00:00
|
|
|
await page.waitForContentLoaded();
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
|
|
|
await page.wait(selectors.itemCreateView.createButton);
|
|
|
|
const url = await page.parsedUrl();
|
2018-11-21 13:09:22 +00:00
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/item/create');
|
|
|
|
});
|
|
|
|
|
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
|
|
|
});
|
|
|
|
|
2018-11-21 13:09:22 +00:00
|
|
|
describe('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);
|
|
|
|
await page.waitForURL('#!/item/index');
|
|
|
|
const url = await page.parsedUrl();
|
2018-11-21 13:09:22 +00:00
|
|
|
|
|
|
|
expect(url.hash).toContain('#!/item/index');
|
|
|
|
});
|
|
|
|
|
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);
|
|
|
|
await page.waitForURL('tags');
|
|
|
|
const url = await page.parsedUrl();
|
2018-11-21 13:09:22 +00:00
|
|
|
|
|
|
|
expect(url.hash).toContain('tags');
|
|
|
|
});
|
|
|
|
|
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
|
|
|
});
|
|
|
|
});
|