supplier basicData + e2e #438
|
@ -925,7 +925,11 @@ export default {
|
|||
thirdContactDeleteButton: 'vn-supplier-contact div:nth-child(3) vn-icon-button[icon="delete"]'
|
||||
},
|
||||
supplierBasicData: {
|
||||
|
||||
alias: 'vn-supplier-basic-data vn-textfield[ng-model="$ctrl.supplier.nickname"]',
|
||||
isOfficial: 'vn-supplier-basic-data vn-check[ng-model="$ctrl.supplier.isOfficial"]',
|
||||
isActive: 'vn-supplier-basic-data vn-check[ng-model="$ctrl.supplier.isActive"]',
|
||||
notes: 'vn-supplier-basic-data vn-textarea[ng-model="$ctrl.supplier.note"]',
|
||||
saveButton: 'vn-supplier-basic-data button[type="submit"]',
|
||||
},
|
||||
supplierFiscalData: {
|
||||
socialName: 'vn-supplier-fiscal-data vn-textfield[ng-model="$ctrl.supplier.name"]',
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Supplier basic data path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('administrative', 'supplier');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('supplier.card.basicData');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should edit the basic data', async() => {
|
||||
await page.clearInput(selectors.supplierBasicData.alias);
|
||||
await page.write(selectors.supplierBasicData.alias, 'Plants Nick SL');
|
||||
await page.waitToClick(selectors.supplierBasicData.isOfficial);
|
||||
await page.waitToClick(selectors.supplierBasicData.isActive);
|
||||
await page.write(selectors.supplierBasicData.notes, 'Some notes');
|
||||
|
||||
await page.waitToClick(selectors.supplierBasicData.saveButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toBe('Data saved!');
|
||||
});
|
||||
|
||||
it('should reload the section', async() => {
|
||||
await page.reloadSection('supplier.card.basicData');
|
||||
});
|
||||
|
||||
it('should check the alias was edited', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.supplierBasicData.alias, 'value');
|
||||
|
||||
expect(result).toEqual('Plants Nick SL');
|
||||
});
|
||||
|
||||
it('should check the isOffical checkbox is now unchecked', async() => {
|
||||
const result = await page.checkboxState(selectors.supplierBasicData.isOfficial);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should check the isActive checkbox is now unchecked', async() => {
|
||||
const result = await page.checkboxState(selectors.supplierBasicData.isActive);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should check the notes were edited', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.supplierBasicData.notes, 'value');
|
||||
|
||||
expect(result).toEqual('Some notes');
|
||||
});
|
||||
|
||||
it('should navigate to the log section', async() => {
|
||||
await page.accessToSection('supplier.card.log');
|
||||
});
|
||||
|
||||
it('should check the changes have been recorded', async() => {
|
||||
const result = await page.waitToGetProperty('#newInstance:nth-child(3)', 'innerText');
|
||||
|
||||
expect(result).toEqual('note: Some notes');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,42 @@
|
|||
<mg-ajax path="Suppliers/{{patch.params.id}}" options="vnPatch"></mg-ajax>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="$ctrl.supplier"
|
||||
form="form"
|
||||
save="patch">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="watcher.submit()" class="vn-w-md">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Alias"
|
||||
ng-model="$ctrl.supplier.nickname"
|
||||
rule
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-check
|
||||
label="Official"
|
||||
ng-model="$ctrl.supplier.isOfficial">
|
||||
</vn-check>
|
||||
<vn-check
|
||||
label="Active"
|
||||
ng-model="$ctrl.supplier.isActive">
|
||||
</vn-check>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textarea
|
||||
vn-one
|
||||
label="Notes"
|
||||
ng-model="$ctrl.supplier.note"
|
||||
rule>
|
||||
</vn-textarea>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save"></vn-submit>
|
||||
<vn-button label="Undo changes" ng-if="watcher.dataChanged()" ng-click="watcher.loadOriginalData()"></vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
|
@ -0,0 +1,10 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
ngModule.vnComponent('vnSupplierBasicData', {
|
||||
template: require('./index.html'),
|
||||
controller: Section,
|
||||
bindings: {
|
||||
supplier: '<'
|
||||
}
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
Notes: Notas
|
||||
Active: Activo
|
||||
Official: Oficial
|
|
@ -6,6 +6,7 @@ import './descriptor';
|
|||
import './index/';
|
||||
import './search-panel';
|
||||
import './summary';
|
||||
import './basic-data';
|
||||
import './fiscal-data';
|
||||
import './contact';
|
||||
import './log';
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
"state": "supplier.card.basicData",
|
||||
"component": "vn-supplier-basic-data",
|
||||
"description": "Basic data",
|
||||
"acl": ["administrative"],
|
||||
"params": {
|
||||
"supplier": "$ctrl.supplier"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue