Merge branch '2970-smart-table' of https://gitea.verdnatura.es/verdnatura/salix into 2970-smart-table
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
f28401303e
|
@ -312,9 +312,9 @@ export default {
|
|||
},
|
||||
itemsIndex: {
|
||||
createItemButton: `vn-float-button`,
|
||||
firstSearchResult: 'vn-item-index a:nth-child(1)',
|
||||
searchResult: 'vn-item-index a.vn-tr',
|
||||
firstResultPreviewButton: 'vn-item-index vn-tbody > :nth-child(1) .buttons > [icon="preview"]',
|
||||
firstSearchResult: 'vn-item-index tr:nth-child(2)',
|
||||
searchResult: 'vn-item-index tbody tr:not(.empty-rows)',
|
||||
firstResultPreviewButton: 'vn-item-index tbody > :nth-child(1) .buttons > [icon="preview"]',
|
||||
searchResultCloneButton: 'vn-item-index .buttons > [icon="icon-clone"]',
|
||||
acceptClonationAlertButton: '.vn-confirm.shown [response="accept"]',
|
||||
closeItemSummaryPreview: '.vn-popup.shown',
|
||||
|
|
|
@ -16,13 +16,13 @@ describe('Item summary path', () => {
|
|||
|
||||
it('should search for an item', async() => {
|
||||
await page.doSearch('Ranged weapon');
|
||||
const nResults = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
const resultsCount = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon');
|
||||
await page.waitToClick(selectors.itemsIndex.firstResultPreviewButton);
|
||||
const isVisible = await page.isVisible(selectors.itemSummary.basicData);
|
||||
|
||||
expect(nResults).toBe(3);
|
||||
expect(resultsCount).toBe(3);
|
||||
expect(isVisible).toBeTruthy();
|
||||
});
|
||||
|
||||
|
@ -61,12 +61,12 @@ describe('Item summary path', () => {
|
|||
|
||||
it('should search for other item', async() => {
|
||||
await page.doSearch('Melee Reinforced');
|
||||
const nResults = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
const resultsCount = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
await page.waitToClick(selectors.itemsIndex.firstResultPreviewButton);
|
||||
await page.waitForSelector(selectors.itemSummary.basicData, {visible: true});
|
||||
|
||||
expect(nResults).toBe(2);
|
||||
expect(resultsCount).toBe(2);
|
||||
});
|
||||
|
||||
it(`should now check the item summary preview shows fields from basic data`, async() => {
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item Create', () => {
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, async() => {
|
||||
await page.doSearch('Infinity Gauntlet');
|
||||
const resultsCount = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(resultsCount).toEqual(0);
|
||||
});
|
||||
|
||||
it('should access to the create item view by clicking the create floating button', async() => {
|
||||
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
||||
await page.waitForState('item.create');
|
||||
});
|
||||
|
||||
it('should return to the item index by clickig the cancel button', async() => {
|
||||
await page.waitToClick(selectors.itemCreateView.cancelButton);
|
||||
await page.waitForState('item.index');
|
||||
});
|
||||
|
||||
it('should now access to the create item view by clicking the create floating button', async() => {
|
||||
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
||||
await page.waitForState('item.create');
|
||||
});
|
||||
|
||||
it('should create the Infinity Gauntlet item', async() => {
|
||||
await page.write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.type, 'Crisantemo');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.intrastat, 'Coral y materiales similares');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.origin, 'Holand');
|
||||
await page.waitToClick(selectors.itemCreateView.createButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm Infinity Gauntlet item was created', async() => {
|
||||
let result = await page
|
||||
.waitToGetProperty(selectors.itemBasicData.name, 'value');
|
||||
|
||||
expect(result).toEqual('Infinity Gauntlet');
|
||||
|
||||
result = await page
|
||||
.waitToGetProperty(selectors.itemBasicData.type, 'value');
|
||||
|
||||
expect(result).toEqual('Crisantemo');
|
||||
|
||||
result = await page
|
||||
.waitToGetProperty(selectors.itemBasicData.intrastat, 'value');
|
||||
|
||||
expect(result).toEqual('5080000 Coral y materiales similares');
|
||||
|
||||
result = await page
|
||||
.waitToGetProperty(selectors.itemBasicData.origin, 'value');
|
||||
|
||||
expect(result).toEqual('Holand');
|
||||
});
|
||||
});
|
|
@ -1,105 +0,0 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item Create/Clone path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('create', () => {
|
||||
it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, async() => {
|
||||
await page.doSearch('Infinity Gauntlet');
|
||||
const nResults = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(nResults).toEqual(0);
|
||||
});
|
||||
|
||||
it('should access to the create item view by clicking the create floating button', async() => {
|
||||
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
||||
await page.waitForState('item.create');
|
||||
});
|
||||
|
||||
it('should return to the item index by clickig the cancel button', async() => {
|
||||
await page.waitToClick(selectors.itemCreateView.cancelButton);
|
||||
await page.waitForState('item.index');
|
||||
});
|
||||
|
||||
it('should now access to the create item view by clicking the create floating button', async() => {
|
||||
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
||||
await page.waitForState('item.create');
|
||||
});
|
||||
|
||||
it('should create the Infinity Gauntlet item', async() => {
|
||||
await page.write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.type, 'Crisantemo');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.intrastat, 'Coral y materiales similares');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.origin, 'Holand');
|
||||
await page.waitToClick(selectors.itemCreateView.createButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm Infinity Gauntlet item was created', async() => {
|
||||
let result = await page
|
||||
.waitToGetProperty(selectors.itemBasicData.name, 'value');
|
||||
|
||||
expect(result).toEqual('Infinity Gauntlet');
|
||||
|
||||
result = await page
|
||||
.waitToGetProperty(selectors.itemBasicData.type, 'value');
|
||||
|
||||
expect(result).toEqual('Crisantemo');
|
||||
|
||||
result = await page
|
||||
.waitToGetProperty(selectors.itemBasicData.intrastat, 'value');
|
||||
|
||||
expect(result).toEqual('5080000 Coral y materiales similares');
|
||||
|
||||
result = await page
|
||||
.waitToGetProperty(selectors.itemBasicData.origin, 'value');
|
||||
|
||||
expect(result).toEqual('Holand');
|
||||
});
|
||||
});
|
||||
|
||||
// Issue #2201
|
||||
// When there is just one result you're redirected automatically to it, so
|
||||
// it's not possible to use the clone option.
|
||||
xdescribe('clone', () => {
|
||||
it('should return to the items index by clicking the return to items button', async() => {
|
||||
await page.waitToClick(selectors.itemBasicData.goToItemIndexButton);
|
||||
await page.waitForSelector(selectors.itemsIndex.createItemButton);
|
||||
await page.waitForState('item.index');
|
||||
});
|
||||
|
||||
it(`should search for the item Infinity Gauntlet`, async() => {
|
||||
await page.doSearch('Infinity Gauntlet');
|
||||
const nResults = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(nResults).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should clone the Infinity Gauntlet`, async() => {
|
||||
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet');
|
||||
await page.waitToClick(selectors.itemsIndex.searchResultCloneButton);
|
||||
await page.waitToClick(selectors.itemsIndex.acceptClonationAlertButton);
|
||||
await page.waitForState('item.tags');
|
||||
});
|
||||
|
||||
it('should search for the item Infinity Gauntlet and find two', async() => {
|
||||
await page.doSearch('Infinity Gauntlet');
|
||||
const nResults = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(nResults).toEqual(2);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -128,15 +128,15 @@ export default class SmartTable extends Component {
|
|||
const tbody = this.element.querySelector('tbody');
|
||||
if (tbody) {
|
||||
const noSearch = this.$compile(`
|
||||
<tr ng-if="!model.data">
|
||||
<td class="empty-rows" colspan="${columns.length}" translate>Enter a new search</td>
|
||||
<tr class="empty-rows" ng-if="!model.data">
|
||||
<td colspan="${columns.length}" translate>Enter a new search</td>
|
||||
</tr>
|
||||
`)($scope);
|
||||
tbody.appendChild(noSearch[0]);
|
||||
|
||||
const noRows = this.$compile(`
|
||||
<tr ng-if="model.data.length == 0">
|
||||
<td class="empty-rows" colspan="${columns.length}" translate>No data</td>
|
||||
<tr class="empty-rows" ng-if="model.data.length == 0">
|
||||
<td colspan="${columns.length}" translate>No data</td>
|
||||
</tr>
|
||||
`)($scope);
|
||||
tbody.appendChild(noRows[0]);
|
||||
|
@ -166,7 +166,7 @@ export default class SmartTable extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
const styleElement = document.querySelector('style[id="smart-table"]');
|
||||
let styleElement = document.querySelector('style[id="smart-table"]');
|
||||
|
||||
if (styleElement)
|
||||
styleElement.parentNode.removeChild(styleElement);
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
</vn-horizontal>
|
||||
</vn-card>
|
||||
|
||||
|
||||
<vn-data-viewer
|
||||
model="model"
|
||||
class="vn-mb-xl vn-w-xl vn-pa-md">
|
||||
|
|
Loading…
Reference in New Issue