item create e2e fix
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
ab7e1c9f11
commit
62e03f4752
|
@ -313,7 +313,7 @@ export default {
|
|||
itemsIndex: {
|
||||
createItemButton: `vn-float-button`,
|
||||
firstSearchResult: 'vn-item-index a:nth-child(1)',
|
||||
searchResult: 'vn-item-index tbody tr',
|
||||
searchResult: 'vn-item-index tbody tr td: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"]',
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -160,7 +160,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);
|
||||
|
@ -174,6 +174,7 @@ export default class SmartTable extends Component {
|
|||
}
|
||||
|
||||
this.$.$on('$destroy', () => {
|
||||
styleElement = document.querySelector('style[id="smart-table"]');
|
||||
if (this.$.css && 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