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: {
|
travelThermograph: {
|
||||||
add: 'vn-travel-thermograph-index vn-float-button[icon="add"]',
|
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"]',
|
thermographID: 'vn-travel-thermograph-create vn-autocomplete[ng-model="$ctrl.dms.thermographId"]',
|
||||||
uploadIcon: 'vn-travel-thermograph-create vn-icon[icon="icon-attach"]',
|
uploadIcon: 'vn-travel-thermograph-create vn-icon[icon="icon-attach"]',
|
||||||
createdThermograph: 'vn-travel-thermograph-index vn-tbody > vn-tr',
|
createdThermograph: 'vn-travel-thermograph-index vn-tbody > vn-tr',
|
||||||
|
|
|
@ -2,6 +2,7 @@ import selectors from '../../helpers/selectors.js';
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Travel thermograph path', () => {
|
describe('Travel thermograph path', () => {
|
||||||
|
const thermographName = '7H3-37H3RN4L-FL4M3';
|
||||||
let browser;
|
let browser;
|
||||||
let page;
|
let page;
|
||||||
|
|
||||||
|
@ -26,10 +27,18 @@ describe('Travel thermograph path', () => {
|
||||||
await page.waitForState('travel.card.thermograph.create');
|
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 currentDir = process.cwd();
|
||||||
let filePath = `${currentDir}/e2e/dms/ecc/3.jpeg`;
|
let filePath = `${currentDir}/e2e/dms/ecc/3.jpeg`;
|
||||||
await page.autocompleteSearch(selectors.travelThermograph.thermographID, '138350-0');
|
|
||||||
|
|
||||||
const [fileChooser] = await Promise.all([
|
const [fileChooser] = await Promise.all([
|
||||||
page.waitForFileChooser(),
|
page.waitForFileChooser(),
|
||||||
|
@ -38,11 +47,17 @@ describe('Travel thermograph path', () => {
|
||||||
await fileChooser.accept([filePath]);
|
await fileChooser.accept([filePath]);
|
||||||
|
|
||||||
await page.waitToClick(selectors.travelThermograph.upload);
|
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() => {
|
it('should check everything was saved correctly', async() => {
|
||||||
let createdThermograph = await page.waitToGetProperty(selectors.travelThermograph.createdThermograph, 'innerText');
|
const result = await page.waitToGetProperty(selectors.travelThermograph.createdThermograph, 'innerText');
|
||||||
|
|
||||||
expect(createdThermograph).toContain('138350-0');
|
expect(result).toContain(thermographName);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -97,6 +97,16 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<!-- Create thermograph dialog -->
|
<!-- 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-dialog class="edit"
|
||||||
vn-id="newThermographDialog"
|
vn-id="newThermographDialog"
|
||||||
on-accept="$ctrl.onNewThermographAccept()"
|
on-accept="$ctrl.onNewThermographAccept()"
|
||||||
|
@ -115,7 +125,7 @@
|
||||||
required="true"
|
required="true"
|
||||||
label="Model"
|
label="Model"
|
||||||
ng-model="$ctrl.newThermograph.model"
|
ng-model="$ctrl.newThermograph.model"
|
||||||
url="Thermographs/getThermographModels"
|
data="thermographModels"
|
||||||
show-field="value"
|
show-field="value"
|
||||||
value-field="value">
|
value-field="value">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
@ -135,7 +145,7 @@
|
||||||
required="true"
|
required="true"
|
||||||
label="Temperature"
|
label="Temperature"
|
||||||
ng-model="$ctrl.newThermograph.temperature"
|
ng-model="$ctrl.newThermograph.temperature"
|
||||||
url="TravelThermographs/getThermographTemperatures"
|
data="thermographTemperatures"
|
||||||
show-field="value"
|
show-field="value"
|
||||||
value-field="value">
|
value-field="value">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
|
|
@ -56,15 +56,19 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
onAddThermographClick(event) {
|
onAddThermographClick(event) {
|
||||||
this.thermographModel = 'DISPOSABLE';
|
const defaultTemperature = 'COOL';
|
||||||
this.temperature = 'COOL';
|
const defaultModel = 'DISPOSABLE';
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.newThermograph = {
|
this.newThermograph = {
|
||||||
thermographId: this.thermographId,
|
thermographId: this.thermographId,
|
||||||
warehouseId: this.warehouseId,
|
warehouseId: this.warehouseId,
|
||||||
temperature: this.temperature,
|
temperature: defaultTemperature,
|
||||||
model: this.thermographModel
|
model: defaultModel
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.$.modelsModel.refresh();
|
||||||
|
this.$.temperaturesModel.refresh();
|
||||||
this.$.newThermographDialog.show();
|
this.$.newThermographDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue