diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js
index ecf0d37e3..2f36dc584 100644
--- a/e2e/helpers/selectors.js
+++ b/e2e/helpers/selectors.js
@@ -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',
diff --git a/e2e/paths/10-travel/01_thermograph.spec.js b/e2e/paths/10-travel/01_thermograph.spec.js
index 67a62381a..e7f1e234d 100644
--- a/e2e/paths/10-travel/01_thermograph.spec.js
+++ b/e2e/paths/10-travel/01_thermograph.spec.js
@@ -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);
});
});
diff --git a/modules/travel/front/thermograph/create/index.html b/modules/travel/front/thermograph/create/index.html
index 90327bdac..0232c1b12 100644
--- a/modules/travel/front/thermograph/create/index.html
+++ b/modules/travel/front/thermograph/create/index.html
@@ -97,6 +97,16 @@
+
+
+
+
@@ -135,7 +145,7 @@
required="true"
label="Temperature"
ng-model="$ctrl.newThermograph.temperature"
- url="TravelThermographs/getThermographTemperatures"
+ data="thermographTemperatures"
show-field="value"
value-field="value">
diff --git a/modules/travel/front/thermograph/create/index.js b/modules/travel/front/thermograph/create/index.js
index 19d9fec15..d398febf1 100644
--- a/modules/travel/front/thermograph/create/index.js
+++ b/modules/travel/front/thermograph/create/index.js
@@ -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();
}