added crud model to preload autocompletes on demand + e2e path done
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
2345a922c8
commit
dfa74221dd
|
@ -828,6 +828,12 @@ export default {
|
|||
},
|
||||
travelThermograph: {
|
||||
add: 'vn-travel-thermograph-index vn-float-button[icon="add"]',
|
||||
addThermographIcon: 'vn-travel-thermograph-create vn-autocomplete vn-icon[icon="add_circle"]',
|
||||
newThermographId: 'vn-textfield[ng-model="$ctrl.newThermograph.thermographId"]',
|
||||
newThermographModel: 'vn-autocomplete[ng-model="$ctrl.newThermograph.model"]',
|
||||
newThermographWarehouse: 'vn-autocomplete[ng-model="$ctrl.newThermograph.warehouseId"]',
|
||||
newThermographTemperature: 'vn-autocomplete[ng-model="$ctrl.newThermograph.temperature"]',
|
||||
createThermographButton: 'form button[response="accept"]',
|
||||
thermographID: 'vn-travel-thermograph-create vn-autocomplete[ng-model="$ctrl.dms.thermographId"]',
|
||||
uploadIcon: 'vn-travel-thermograph-create vn-icon[icon="icon-attach"]',
|
||||
createdThermograph: 'vn-travel-thermograph-index vn-tbody > vn-tr',
|
||||
|
|
|
@ -2,6 +2,7 @@ import selectors from '../../helpers/selectors.js';
|
|||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Travel thermograph path', () => {
|
||||
const thermographName = '7H3-37H3RN4L-FL4M3';
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
|
@ -26,10 +27,18 @@ describe('Travel thermograph path', () => {
|
|||
await page.waitForState('travel.card.thermograph.create');
|
||||
});
|
||||
|
||||
it('should select the thermograph and then the file to upload', async() => {
|
||||
it('should click on the add thermograph icon of the thermograph autocomplete', async() => {
|
||||
await page.waitToClick(selectors.travelThermograph.addThermographIcon);
|
||||
await page.write(selectors.travelThermograph.newThermographId, thermographName);
|
||||
await page.autocompleteSearch(selectors.travelThermograph.newThermographModel, 'TEMPMATE');
|
||||
await page.autocompleteSearch(selectors.travelThermograph.newThermographWarehouse, 'Warehouse Two');
|
||||
await page.autocompleteSearch(selectors.travelThermograph.newThermographTemperature, 'WARM');
|
||||
await page.waitToClick(selectors.travelThermograph.createThermographButton);
|
||||
});
|
||||
|
||||
it('should select the file to upload', async() => {
|
||||
let currentDir = process.cwd();
|
||||
let filePath = `${currentDir}/e2e/dms/ecc/3.jpeg`;
|
||||
await page.autocompleteSearch(selectors.travelThermograph.thermographID, '138350-0');
|
||||
|
||||
const [fileChooser] = await Promise.all([
|
||||
page.waitForFileChooser(),
|
||||
|
@ -38,11 +47,17 @@ describe('Travel thermograph path', () => {
|
|||
await fileChooser.accept([filePath]);
|
||||
|
||||
await page.waitToClick(selectors.travelThermograph.upload);
|
||||
|
||||
const message = await page.waitForSnackbar();
|
||||
const state = await page.getState();
|
||||
|
||||
expect(message.type).toBe('success');
|
||||
expect(state).toBe('travel.card.thermograph.index');
|
||||
});
|
||||
|
||||
it('should reload the section and check everything was saved', async() => {
|
||||
let createdThermograph = await page.waitToGetProperty(selectors.travelThermograph.createdThermograph, 'innerText');
|
||||
it('should check everything was saved correctly', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.travelThermograph.createdThermograph, 'innerText');
|
||||
|
||||
expect(createdThermograph).toContain('138350-0');
|
||||
expect(result).toContain(thermographName);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -97,6 +97,16 @@
|
|||
</div>
|
||||
</form>
|
||||
<!-- Create thermograph dialog -->
|
||||
<vn-crud-model
|
||||
vn-id="modelsModel"
|
||||
url="Thermographs/getThermographModels"
|
||||
data="thermographModels">
|
||||
</vn-crud-model>
|
||||
<vn-crud-model
|
||||
vn-id="temperaturesModel"
|
||||
url="TravelThermographs/getThermographTemperatures"
|
||||
data="thermographTemperatures">
|
||||
</vn-crud-model>
|
||||
<vn-dialog class="edit"
|
||||
vn-id="newThermographDialog"
|
||||
on-accept="$ctrl.onNewThermographAccept()"
|
||||
|
@ -115,7 +125,7 @@
|
|||
required="true"
|
||||
label="Model"
|
||||
ng-model="$ctrl.newThermograph.model"
|
||||
url="Thermographs/getThermographModels"
|
||||
data="thermographModels"
|
||||
show-field="value"
|
||||
value-field="value">
|
||||
</vn-autocomplete>
|
||||
|
@ -135,7 +145,7 @@
|
|||
required="true"
|
||||
label="Temperature"
|
||||
ng-model="$ctrl.newThermograph.temperature"
|
||||
url="TravelThermographs/getThermographTemperatures"
|
||||
data="thermographTemperatures"
|
||||
show-field="value"
|
||||
value-field="value">
|
||||
</vn-autocomplete>
|
||||
|
|
|
@ -56,15 +56,19 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
onAddThermographClick(event) {
|
||||
this.thermographModel = 'DISPOSABLE';
|
||||
this.temperature = 'COOL';
|
||||
const defaultTemperature = 'COOL';
|
||||
const defaultModel = 'DISPOSABLE';
|
||||
|
||||
event.preventDefault();
|
||||
this.newThermograph = {
|
||||
thermographId: this.thermographId,
|
||||
warehouseId: this.warehouseId,
|
||||
temperature: this.temperature,
|
||||
model: this.thermographModel
|
||||
temperature: defaultTemperature,
|
||||
model: defaultModel
|
||||
};
|
||||
|
||||
this.$.modelsModel.refresh();
|
||||
this.$.temperaturesModel.refresh();
|
||||
this.$.newThermographDialog.show();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue