diff --git a/resident-ui/src/app/app-config.service.ts b/resident-ui/src/app/app-config.service.ts index 22e7242d..f99b008f 100644 --- a/resident-ui/src/app/app-config.service.ts +++ b/resident-ui/src/app/app-config.service.ts @@ -70,6 +70,8 @@ export class AppConfigService { this.appConfig["mosip.resident.zoom"] = responseData["mosip.resident.zoom"]; this.appConfig["mosip.resident.maxZoom"] = responseData["mosip.resident.maxZoom"]; this.appConfig["mosip.resident.minZoom"] = responseData["mosip.resident.minZoom"]; + this.appConfig["resident.update-uin.machine-zone-code"] = responseData["resident.update-uin.machine-zone-code"]; + this.appConfig["resident-multi-language-enable"] = responseData["resident-multi-language-enable"]; localStorage.setItem("isDataLoaded", 'true') }, (error) => { diff --git a/resident-ui/src/app/core/services/data-storage.service.ts b/resident-ui/src/app/core/services/data-storage.service.ts index 98bc1ee7..4eee8fa8 100644 --- a/resident-ui/src/app/core/services/data-storage.service.ts +++ b/resident-ui/src/app/core/services/data-storage.service.ts @@ -172,7 +172,7 @@ export class DataStorageService { } getProfileInfo(langCode) { - return this.httpClient.get(this.BASE_URL + '/profile?languageCode=' + langCode); + return this.httpClient.get(this.BASE_URL + '/profile'); } getServiceHistory(request: any, filters: any,pageSize1:any) { diff --git a/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.html b/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.html index 7f816aa4..5589ab9a 100644 --- a/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.html +++ b/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.html @@ -23,13 +23,12 @@

{{'person {{data.maskRequiredLabel[langCode]}} - + diff --git a/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.ts b/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.ts index 3b2e9fea..77618b88 100644 --- a/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.ts +++ b/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.ts @@ -47,7 +47,7 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy { formatLabels: any; formatCheckBoxClicked: boolean = false; isLoading: boolean = true; - selectedOprionsFormOptions: object = {}; + selectedOptionsFromOptions: object = {}; sitealignment:string = localStorage.getItem('direction'); constructor(private autoLogout: AutoLogoutService, private interactionService: InteractionService, @@ -151,6 +151,76 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy { }); } + createDefaultValue(data: any) { + let value = ""; + if (this.userInfo[data.attributeName]) { + this.userInfo[data.attributeName].forEach(eachItem => { + if (eachItem.language === this.langCode) { + value = eachItem.value + } + }); + } else { + value = this.createCheckedVal(data); + } + return value + } + + // Method to create preview data with formates + createCheckedVal(data:any){ + let finalvalue = ""; + + data.formatOption[this.langCode].forEach(item => { + if (item.value !== data.attributeName && item.checked) { + if (this.userInfo[item.value]) + if (typeof this.userInfo[item.value] === "string") { + finalvalue += this.userInfo[item.value] + } else { + this.userInfo[item.value].forEach(eachVal => { + if (eachVal.language === this.langCode) + data.attributeName === 'fullAddress' ? finalvalue += eachVal.value + ", " : finalvalue += eachVal.value + " "; + }); + } + } + }) + + return finalvalue.replace(/[, \s]+$/, ""); + } + + // Method to Uncheck default value checkbox + checkDefaultVal(data: any, $event:any) { + let unCheckedValues = 0; + let unCheckFullAddress = () => { + data.formatOption[this.langCode].forEach(item => { + if (item.value === data.attributeName) { + item['checked'] = false; + } + }) + } + + for (let item of data.formatOption[this.langCode]) { + if (!item.checked && item.value !== data.attributeName) { + unCheckFullAddress(); + break; + } else { + item.checked = true; + } + } + + for (let eachItem of data.formatOption[this.langCode]) { + if (!eachItem.checked) { + unCheckedValues += 1 + } + } + if (unCheckedValues === data.formatOption[this.langCode].length) { + data.checked = false; + delete this.dataDisplay[data.attributeName]; + data.formatOption[this.langCode].forEach(item => { + item.checked = true; + }) + $event.closeMenu(); + } + } + captureCheckboxValue($event: any, data: any, type: any) { this.buildHTML = ""; if (type === "datacheck") { @@ -166,39 +236,7 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy { } } else { if (data.formatRequired) { - if (data.attributeName === "fullAddress") { - this.fullAddress = "" - this.schema.forEach(item => { - if (item.attributeName === data.attributeName) { - this.formatLabels = item.formatOption[this.langCode] - } - }) - - this.formatLabels.forEach(item => { - if (this.userInfo[item.value] !== undefined) { - if (typeof this.userInfo[item.value] !== "string") { - this.userInfo[item.value].forEach(eachLang => { - if (eachLang.language === this.langCode) { - this.fullAddress = eachLang.value + ", " + this.fullAddress; - } - }) - } else { - this.fullAddress = this.fullAddress + this.userInfo[item.value]; - } - } - }) - - if (this.fullAddress.endsWith(', ')) { - this.fullAddress = this.fullAddress.replace(/^./, ""); - }; - value = this.fullAddress; - } else { - this.userInfo[data.attributeName].forEach(eachItem => { - if (eachItem.language === this.langCode) { - value = eachItem.value - } - }); - } + value = this.createDefaultValue(data) } else { this.userInfo[data.attributeName].forEach(eachItem => { if (eachItem.language === this.langCode) { @@ -219,7 +257,7 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy { if (item.attributeName === data.attributeName) { let newItem = { ...item, checked: !item.checked } if (!newItem.checked && newItem['formatOption']) { - newItem['formatOption'][this.langCode] = this.selectedOprionsFormOptions[data.attributeName] + newItem['formatOption'][this.langCode] = this.selectedOptionsFromOptions[data.attributeName] } return newItem } else { @@ -238,8 +276,6 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy { this.dataDisplay[data.attributeName] = { "label": data.label[this.langCode], "attributeName": data['attributeName'], "isMasked": $event.checked, "value": value }; } else { let value = ""; - let allValue = ""; - let self = this; if (typeof this.userInfo[data.attributeName] === "string") { data.formatOption[this.langCode].forEach(item => { item.checked = !item.checked @@ -247,7 +283,6 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy { value = moment(this.userInfo[data.attributeName]).format(item["value"]); } }) - } else { this.schema = this.schema.map(item => { if (data['attributeName'] === item['attributeName']) { @@ -262,77 +297,14 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy { return item }) - if (data.attributeName === "fullAddress") { - let selectedValuesCount = 0; - if (type["value"] !== 'fullAddress') { - this.schema.map(eachItem => { - if (data['attributeName'] === eachItem['attributeName']) { - eachItem['formatOption'][this.langCode].forEach((item) => { - if (item.checked) { - if (self.userInfo[item.value] !== undefined) { - if (item.value === "postalCode") { - allValue = allValue + self.userInfo[item.value]; - } else { - this.userInfo[item.value].forEach(eachLang => { - if (eachLang.language === this.langCode) { - allValue = allValue + eachLang.value + ", "; - } - }) - } - } - } - return ""; - }); - } - }); - - let unCheckFullAddress = () => { - data.formatOption[this.langCode].forEach(item => { - if (item.value === "fullAddress") { - item['checked'] = false; - } - }) - } - - for (let item of data.formatOption[this.langCode]) { - if (!item.checked && item.value !== "fullAddress") { - unCheckFullAddress(); - break; - } else { - item.checked = true; - } - } - - allValue = allValue.replace(/,(\s+)?$/, ""); - value = allValue; - } else { - value = this.fullAddress - data.formatOption[this.langCode].forEach(item => { - item.checked = true; - }) - } - - for (let eachItem of data.formatOption[this.langCode]) { - if (!eachItem.checked) { - selectedValuesCount += 1 - } - } - - if (selectedValuesCount === data.formatOption[this.langCode].length) { - data.checked = false; - delete this.dataDisplay[data.attributeName]; - data.formatOption[this.langCode].forEach(item => { - item.checked = true; - }) - $event.closeMenu(); - } - } else { - data.checked = false; - delete this.dataDisplay[data.attributeName]; + if (type.value === data.attributeName) { + value = this.createDefaultValue(data) data.formatOption[this.langCode].forEach(item => { - item.checked = true; + item.checked = true }) - $event.closeMenu(); + } else { + value = this.createCheckedVal(data); + this.checkDefaultVal(data, $event); } } if (data.checked) { @@ -354,7 +326,7 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy { let formatOptions = data['formatOption'][this.langCode].map(eachItem => { return { ...eachItem } }) - this.selectedOprionsFormOptions[data['attributeName']] = formatOptions; + this.selectedOptionsFromOptions[data['attributeName']] = formatOptions; } } } diff --git a/resident-ui/src/app/feature/uinservices/sharewithpartner/sharewithpartner.component.html b/resident-ui/src/app/feature/uinservices/sharewithpartner/sharewithpartner.component.html index 13774f6b..dad4e106 100644 --- a/resident-ui/src/app/feature/uinservices/sharewithpartner/sharewithpartner.component.html +++ b/resident-ui/src/app/feature/uinservices/sharewithpartner/sharewithpartner.component.html @@ -58,8 +58,8 @@

{{'sharew - -
{{sharableAttributes['name']['value']}} + +
{{sharableAttributes['fullName']['value']}}
logo diff --git a/resident-ui/src/app/feature/uinservices/sharewithpartner/sharewithpartner.component.ts b/resident-ui/src/app/feature/uinservices/sharewithpartner/sharewithpartner.component.ts index 6589ba2b..1cc84611 100644 --- a/resident-ui/src/app/feature/uinservices/sharewithpartner/sharewithpartner.component.ts +++ b/resident-ui/src/app/feature/uinservices/sharewithpartner/sharewithpartner.component.ts @@ -39,7 +39,6 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy { showAcknowledgement: boolean = false; aidStatus: any; clickEventSubscription: Subscription; - buildHTML: any; userInfo: any; message: any; formatData: any; @@ -61,6 +60,7 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy { isLoading: boolean = true; selectedOprionsFormOptions: object = {}; sitealignment:string = localStorage.getItem('direction'); + selectedFormats:string = ""; private keyboardRef: MatKeyboardRef; @ViewChildren('keyboardRef', { read: ElementRef }) @@ -213,8 +213,84 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy { }); } + // Method to create default format preview data + createDefaultValue(data: any) { + let value = ""; + if (this.userInfo[data.attributeName]) { + this.userInfo[data.attributeName].forEach(eachItem => { + if (eachItem.language === this.langCode) { + value = eachItem.value + } + }); + } else { + value = this.createCheckedVal(data); + } + return value + } + + // Method to create preview data with formates + createCheckedVal(data:any){ + let finalvalue = ""; + this.selectedFormats = ""; + data.formatOption[this.langCode].forEach(item => { + if (item.value !== data.attributeName && item.checked) { + if (this.userInfo[item.value]) + if (typeof this.userInfo[item.value] === "string") { + finalvalue += this.userInfo[item.value] + } else { + this.userInfo[item.value].forEach(eachVal => { + if (eachVal.language === this.langCode) + data.attributeName === 'fullAddress' ? finalvalue += eachVal.value + ", " : finalvalue += eachVal.value + " "; + }); + } + } + }) + + data.formatOption[this.langCode].forEach(item =>{ + if (item.checked && item.value !== 'fullAddress') { + this.selectedFormats += item.value + ","; + } + }) + this.selectedFormats = this.selectedFormats.replace(/.$/, ''); + return finalvalue.replace(/[, \s]+$/, ""); + } + + // Method to Uncheck default value checkbox + checkDefaultVal(data: any, $event:any) { + let unCheckedValues = 0; + let unCheckFullAddress = () => { + data.formatOption[this.langCode].forEach(item => { + if (item.value === data.attributeName) { + item['checked'] = false; + } + }) + } + + for (let item of data.formatOption[this.langCode]) { + if (!item.checked && item.value !== data.attributeName) { + unCheckFullAddress(); + break; + } else { + item.checked = true; + } + } + + for (let eachItem of data.formatOption[this.langCode]) { + if (!eachItem.checked) { + unCheckedValues += 1 + } + } + if (unCheckedValues === data.formatOption[this.langCode].length) { + data.checked = false; + delete this.sharableAttributes[data.attributeName]; + data.formatOption[this.langCode].forEach(item => { + item.checked = true; + }) + $event.closeMenu(); + } + } + captureCheckboxValue($event: any, data: any, type: string) { - this.buildHTML = ""; if (type === "datacheck") { if (data.attributeName.toString() in this.sharableAttributes) { delete this.sharableAttributes[data.attributeName]; @@ -227,49 +303,17 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy { value = this.userInfo[data.attributeName]; } } else { - if (data.formatRequired) { - if (data.attributeName === "fullAddress") { - this.fullAddress = "" - - this.schema.forEach(item => { - if (item.attributeName === data.attributeName) { - this.formatLabels = item.formatOption[this.langCode] - } - }) - - this.formatLabels.forEach(item => { - if (this.userInfo[item.value] !== undefined) { - if (typeof this.userInfo[item.value] !== "string") { - this.userInfo[item.value].forEach(eachLang => { - if (eachLang.language === this.langCode) { - this.fullAddress = this.fullAddress + ", " + eachLang.value - } - }) - } else { - this.fullAddress = this.fullAddress +", " + this.userInfo[item.value] - } - } - }) - - - this.fullAddress = this.fullAddress.replace(/^./, ""); - value = this.fullAddress - } else { - this.userInfo['fullName'].forEach(item =>{ - if(item.language === this.langCode){ - value = item.value - } - }); + if (data.formatRequired) { + value = this.createDefaultValue(data) + } else { + this.userInfo[data.attributeName].forEach(item =>{ + if(item.language === this.langCode){ + value = item.value } - } else { - this.userInfo[data.attributeName].forEach(item =>{ - if(item.language === this.langCode){ - value = item.value - } - }); - } + }); + } } - + if (data.formatRequired) { this.sharableAttributes[data.attributeName] = { "label": data.label[this.langCode], "attributeName": data['attributeName'], "isMasked": false, "format": data['defaultFormat'], "value": value }; } else { @@ -300,15 +344,13 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy { this.sharableAttributes[data.attributeName] = { "label": data.label[this.langCode], "attributeName": data['attributeName'], "isMasked": !this.sharableAttributes[data.attributeName]['isMasked'], "value": value }; } else { let value = ""; - let allValues = ""; - let self = this; - let selectedFormats = ""; + if (typeof this.userInfo[data.attributeName] === "string") { data.formatOption[this.langCode].forEach(eachItem => { eachItem.checked = !eachItem.checked if (eachItem.checked) { value = moment(this.userInfo[data.attributeName]).format(eachItem["value"]); - selectedFormats = type['label'] + this.selectedFormats = type['label'] } }) } else { @@ -325,90 +367,18 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy { return eachItem }) - if (data.attributeName === "fullAddress") { - let selectedValuesCount = 0; - if (type["value"] !== 'fullAddress') { - this.schema.map(eachItem => { - if (data['attributeName'] === eachItem['attributeName']) { - eachItem['formatOption'][this.langCode].forEach((item) => { - if (item.checked) { - if (self.userInfo[item.value] !== undefined) { - if (item.value === "postalCode") { - allValues = allValues + self.userInfo[item.value]; - } else { - this.userInfo[item.value].forEach(eachLang => { - if (eachLang.language === this.langCode) { - allValues = allValues + eachLang.value + ", "; - } - }) - } - } - } - return ""; - }); - } - }); - - let unCheckFullAddress = () =>{ - data.formatOption[this.langCode].forEach(eachItem =>{ - if(eachItem.value === "fullAddress"){ - eachItem['checked'] = false; - } - }) - } - - for(let item of data.formatOption[this.langCode]){ - if(!item.checked && item.value !== "fullAddress"){ - unCheckFullAddress(); - break; - }else{ - item.checked = true; - } - } - - data.formatOption[this.langCode].forEach(item =>{ - if (item.checked && item.value !== 'fullAddress') { - selectedFormats += item.value + ","; - } - }) - - selectedFormats = selectedFormats.replace(/.$/, ''); - allValues = allValues.replace(/,(\s+)?$/, ""); - value = allValues; - } else { - value = this.fullAddress - data.formatOption[this.langCode].forEach(item => { - item.checked = true; - }) - selectedFormats = data.defaultFormat; - } - - for (let eachItem of data.formatOption[this.langCode]) { - if (!eachItem.checked) { - selectedValuesCount += 1 - } - } - - if (selectedValuesCount === data.formatOption[this.langCode].length) { - data.checked = false; - delete this.sharableAttributes[data.attributeName]; - data.formatOption[this.langCode].forEach(item => { - item.checked = true; - }) - $event.closeMenu(); - } - - } else { - data.checked = false; - delete this.sharableAttributes[data.attributeName]; + if (type['value'] === data.attributeName) { + value = this.createDefaultValue(data) data.formatOption[this.langCode].forEach(item => { - item.checked = true; + item.checked = true }) - $event.closeMenu(); + } else { + value = this.createCheckedVal(data); + this.checkDefaultVal(data, $event); } } if (data.checked) { - this.sharableAttributes[data.attributeName] = { "label": data.label[this.langCode], "attributeName": data['attributeName'], "isMasked": false, "format": selectedFormats, "value": value }; + this.sharableAttributes[data.attributeName] = { "label": data.label[this.langCode], "attributeName": data['attributeName'], "isMasked": false, "format": this.selectedFormats, "value": value }; } } } @@ -428,17 +398,6 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy { } } - let row = ""; - let rowImage = "" - - for (const key in this.sharableAttributes) { - if (key === "photo") { - rowImage = ""; - } else { - row = row + "" + this.sharableAttributes[key].attributeName + ":" + this.sharableAttributes[key].value + ""; - } - } - this.buildHTML = `` + rowImage + row + `
`; } captureDropDownValue(event: any) { @@ -492,7 +451,7 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy { this.router.navigate(["uinservices/dashboard"]) } else { this.isLoading = false; - this.showErrorPopup(response["errors"]) + this.showErrorPopup(response.body["errors"]) } }, err => { @@ -555,7 +514,7 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy { return dialogRef; } - showErrorPopup(message: string) { + showErrorPopup(message: any) { let errorCode = message[0]['errorCode'] setTimeout(() => { this.dialog diff --git a/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.html b/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.html index c50dd067..a2bbfb90 100644 --- a/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.html +++ b/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.html @@ -663,16 +663,16 @@

{{'updatedem + *ngIf="dynamicDropDown[field.attributeName]"> - {{ data.name }} @@ -688,14 +688,14 @@

{{'updatedem + *ngIf="dynamicDropDown[field.attributeName]"> - + {{ data.name }} @@ -924,7 +924,7 @@

{{'updatedem
-
+
{{field.labelName[langCode][0]}} diff --git a/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.ts b/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.ts index f10cb520..4223f97d 100644 --- a/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.ts +++ b/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.ts @@ -164,7 +164,7 @@ export class UpdatedemographicComponent implements OnInit, OnDestroy { async ngOnInit() { this.defaultJsonValue = { ...defaultJson } - this.initialLocationCode = "MOR"; + this.initialLocationCode = this.appConfigService.getConfig()["resident.update-uin.machine-zone-code"]; this.locCode = 5; this.translateService.use(localStorage.getItem("langCode")); this.supportedLanguages = ["eng"]; @@ -493,7 +493,8 @@ export class UpdatedemographicComponent implements OnInit, OnDestroy { let filedNameForuserInput = (item.charAt(0).toLocaleLowerCase() + item.slice(1)).replace(" ", "") if (typeof this.userInputValues[filedNameForuserInput] !== 'string') { this.getUserPerfLang.forEach(lang => { - this.userInputValues[filedNameForuserInput][lang] = '' + if(this.userInputValues[filedNameForuserInput]) + this.userInputValues[filedNameForuserInput][lang] = '' }) } else { this.userInputValues[filedNameForuserInput] = '' @@ -690,10 +691,9 @@ export class UpdatedemographicComponent implements OnInit, OnDestroy { let genders = this.dropDownValues.gender let currentValueCode genders[language].forEach(item => { - if (item.value === currentValue) { - currentValueCode = item.code - } - }) + currentValueCode = item.value === currentValue ? item.code : currentValue + }); + let self = this; if (formControlName !== "proofOfIdentity") { if (event.value !== currentValueCode) { @@ -702,7 +702,7 @@ export class UpdatedemographicComponent implements OnInit, OnDestroy { this.getUserPerfLang.forEach(item => { let newData genders[item].forEach(eachGender => { - if (eachGender.code === event.value) { + if (eachGender.code.toLowerCase() === event.value.toLowerCase()) { newData = { "language": item, "value": eachGender.value } this.userInputValues[formControlName][item] = eachGender.code; } diff --git a/resident-ui/src/app/shared/header/header.component.html b/resident-ui/src/app/shared/header/header.component.html index c0e6484b..2875c4db 100644 --- a/resident-ui/src/app/shared/header/header.component.html +++ b/resident-ui/src/app/shared/header/header.component.html @@ -21,7 +21,7 @@ {{item.label}} - + diff --git a/resident-ui/src/app/shared/header/header.component.ts b/resident-ui/src/app/shared/header/header.component.ts index f690fd0c..cc9bb13a 100644 --- a/resident-ui/src/app/shared/header/header.component.ts +++ b/resident-ui/src/app/shared/header/header.component.ts @@ -48,6 +48,7 @@ export class HeaderComponent implements OnInit, OnDestroy { selectedfontsize:any = localStorage.getItem('selectedfontsize'); selectedLangData:any; isAuthorized:boolean = false; + showLangDropDown:any; constructor( private router: Router, @@ -79,6 +80,8 @@ export class HeaderComponent implements OnInit, OnDestroy { getConfigData(){ if(localStorage.getItem('isDataLoaded') === 'true'){ let supportedLanguages = this.appConfigService.getConfig()['supportedLanguages'].split(','); + this.showLangDropDown = this.appConfigService.getConfig()['resident-multi-language-enable']; + if(supportedLanguages.length > 1){ supportedLanguages.forEach((language) => { this.selectLanguagesArr.push({ diff --git a/resident-ui/src/assets/i18n/ara.json b/resident-ui/src/assets/i18n/ara.json index cfddb3c4..148e9135 100644 --- a/resident-ui/src/assets/i18n/ara.json +++ b/resident-ui/src/assets/i18n/ara.json @@ -713,6 +713,8 @@ "RES-SER-526": "تم تجاوز الحد الأقصى لعدد التحديثات للسمات:- %s", "RES-SER-470": "لا توجد سجلات", "RES-SER-401": "استثناء قاعدة", - "RES-SER-474": "لم يتم العثور على معرف فردي استثناء" + "RES-SER-474": "لم يتم العثور على معرف فردي استثناء", + "RES-SER-527": "الإدخال الذي أدخلته موجود بالفعل. الرجاء إدخال قيمة جديدة للمتابعة.", + "RES-SER-479": "حدث خطأ أثناء تنزيل البطاقة الشخصية." } } diff --git a/resident-ui/src/assets/i18n/eng.json b/resident-ui/src/assets/i18n/eng.json index ba10bd0e..9805d3ec 100644 --- a/resident-ui/src/assets/i18n/eng.json +++ b/resident-ui/src/assets/i18n/eng.json @@ -714,6 +714,8 @@ "RES-SER-526": "Update count limit for the attributes exceeded:- %s", "RES-SER-470": "No Record(s) found", "RES-SER-401": "Base exception.", - "RES-SER-474": "Individual ID not found exception" + "RES-SER-474": "Individual ID not found exception", + "RES-SER-527": "The input you have entered already exists. Please enter a new value to proceed.", + "RES-SER-479": "Error in downloading personalized card." } } diff --git a/resident-ui/src/assets/i18n/fra.json b/resident-ui/src/assets/i18n/fra.json index 6b8c5218..e3338156 100644 --- a/resident-ui/src/assets/i18n/fra.json +++ b/resident-ui/src/assets/i18n/fra.json @@ -714,6 +714,8 @@ "RES-SER-526": "Limite du nombre de mises à jour pour les attributs dépassée : - %s", "RES-SER-470": "Aucun enregistrement trouvé", "RES-SER-401": "Exception de base", - "RES-SER-474": "Exception d'identification individuelle introuvable" + "RES-SER-474": "Exception d'identification individuelle introuvable", + "RES-SER-527": "L'entrée que vous avez saisie existe déjà. Veuillez saisir une nouvelle valeur pour continuer.", + "RES-SER-479": "Erreur lors du téléchargement de la carte personnalisée." } } diff --git a/resident-ui/src/assets/i18n/hin.json b/resident-ui/src/assets/i18n/hin.json index 89ae1318..982365ab 100644 --- a/resident-ui/src/assets/i18n/hin.json +++ b/resident-ui/src/assets/i18n/hin.json @@ -714,6 +714,8 @@ "RES-SER-526": "विशेषताओं के लिए अद्यतन गणना सीमा पार हो गई:- %s", "RES-SER-470": "कोई रिकॉर्ड नहीं मिला", "RES-SER-401": "आधार अपवाद", - "RES-SER-474": "व्यक्तिगत आईडी को अपवाद नहीं मिला" + "RES-SER-474": "व्यक्तिगत आईडी को अपवाद नहीं मिला", + "RES-SER-527": "आपके द्वारा दर्ज किया गया इनपुट पहले से मौजूद है। आगे बढ़ने के लिए कृपया एक नया मान दर्ज करें।", + "RES-SER-479": "वैयक्तिकृत कार्ड डाउनलोड करने में त्रुटि." } } diff --git a/resident-ui/src/assets/i18n/kan.json b/resident-ui/src/assets/i18n/kan.json index d83fee30..8c6c2d9a 100644 --- a/resident-ui/src/assets/i18n/kan.json +++ b/resident-ui/src/assets/i18n/kan.json @@ -714,6 +714,8 @@ "RES-SER-526": "ಗುಣಲಕ್ಷಣಗಳ ನವೀಕರಣ ಎಣಿಕೆ ಮಿತಿ ಮೀರಿದೆ:- %s", "RES-SER-470": "ಯಾವುದೇ ದಾಖಲೆಗಳು ಕಂಡುಬಂದಿಲ್ಲ", "RES-SER-401": "ಮೂಲ ವಿನಾಯಿತಿ", - "RES-SER-474": "ವೈಯಕ್ತಿಕ ID ವಿನಾಯಿತಿ ಕಂಡುಬಂದಿಲ್ಲ" + "RES-SER-474": "ವೈಯಕ್ತಿಕ ID ವಿನಾಯಿತಿ ಕಂಡುಬಂದಿಲ್ಲ", + "RES-SER-527": "ನೀವು ನಮೂದಿಸಿದ ಇನ್‌ಪುಟ್ ಈಗಾಗಲೇ ಅಸ್ತಿತ್ವದಲ್ಲಿದೆ. ಮುಂದುವರಿಯಲು ದಯವಿಟ್ಟು ಹೊಸ ಮೌಲ್ಯವನ್ನು ನಮೂದಿಸಿ.", + "RES-SER-479": "ವೈಯಕ್ತೀಕರಿಸಿದ ಕಾರ್ಡ್ ಡೌನ್‌ಲೋಡ್ ಮಾಡುವಲ್ಲಿ ದೋಷ." } } diff --git a/resident-ui/src/assets/i18n/spa.json b/resident-ui/src/assets/i18n/spa.json index 962914e9..222c5be5 100644 --- a/resident-ui/src/assets/i18n/spa.json +++ b/resident-ui/src/assets/i18n/spa.json @@ -714,6 +714,8 @@ "RES-SER-526": "Límite de recuento de actualizaciones para los atributos excedidos: - %s", "RES-SER-470": "No se encontraron registros", "RES-SER-401": "Excepción básica", - "RES-SER-474": "Excepción de identificación individual no encontrada" + "RES-SER-474": "Excepción de identificación individual no encontrada", + "RES-SER-527": "La entrada que has ingresado ya existe. Ingrese un nuevo valor para continuar.", + "RES-SER-479": "Error al descargar tarjeta personalizada." } } \ No newline at end of file diff --git a/resident-ui/src/assets/i18n/tam.json b/resident-ui/src/assets/i18n/tam.json index c90f449f..724e456e 100644 --- a/resident-ui/src/assets/i18n/tam.json +++ b/resident-ui/src/assets/i18n/tam.json @@ -715,6 +715,8 @@ "RES-SER-526": "பண்புக்கூறுகளுக்கான புதுப்பிப்பு எண்ணிக்கை வரம்பு மீறப்பட்டது:- %s", "RES-SER-470": "எந்த பதிவுகளும் கண்டறியப்படவில்லை", "RES-SER-401": "அடிப்படை விதிவிலக்கு", - "RES-SER-474": "தனிப்பட்ட ஐடி விதிவிலக்கு இல்லை" + "RES-SER-474": "தனிப்பட்ட ஐடி விதிவிலக்கு இல்லை", + "RES-SER-527": "நீங்கள் உள்ளிட்ட உள்ளீடு ஏற்கனவே உள்ளது. தொடர புதிய மதிப்பை உள்ளிடவும்.", + "RES-SER-479": "தனிப்பயனாக்கப்பட்ட கார்டைப் பதிவிறக்குவதில் பிழை." } } \ No newline at end of file diff --git a/residenttest/src/main/java/io/mosip/testrig/residentui/service/BaseTestCase.java b/residenttest/src/main/java/io/mosip/testrig/residentui/service/BaseTestCase.java index e218c4fa..c5a77f5f 100644 --- a/residenttest/src/main/java/io/mosip/testrig/residentui/service/BaseTestCase.java +++ b/residenttest/src/main/java/io/mosip/testrig/residentui/service/BaseTestCase.java @@ -268,8 +268,6 @@ public static boolean isTargetEnvLTS() { String url = ApplnURI + "/v1/auditmanager/actuator/info"; try { response = RestClient.getRequest(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON); - // GlobalMethods.reportResponse(response.getHeaders().asList().toString(), url, response); - responseJson = new org.json.JSONObject(response.getBody().asString()); targetEnvVersion = responseJson.getJSONObject("build").getString("version"); @@ -278,9 +276,34 @@ public static boolean isTargetEnvLTS() { logger.error(GlobalConstants.EXCEPTION_STRING_2 + e); } } - return targetEnvVersion.contains("1.2"); + + // Compare the version numbers, ignoring any suffix like "-SNAPSHOT" + return isVersionGreaterOrEqual(targetEnvVersion, "1.2"); } + + private static boolean isVersionGreaterOrEqual(String version1, String version2) { + // Remove any suffixes like "-SNAPSHOT" from the versions + version1 = version1.split("-")[0]; + version2 = version2.split("-")[0]; + + String[] v1 = version1.split("\\."); + String[] v2 = version2.split("\\."); + + int length = Math.max(v1.length, v2.length); + + for (int i = 0; i < length; i++) { + int v1Part = i < v1.length ? Integer.parseInt(v1[i]) : 0; + int v2Part = i < v2.length ? Integer.parseInt(v2[i]) : 0; + if (v1Part < v2Part) { + return false; + } else if (v1Part > v2Part) { + return true; + } + } + return true; // versions are equal + } + private static Properties getLoggerPropertyConfig() { Properties logProp = new Properties(); logProp.setProperty("log4j.rootLogger", "INFO, Appender1,Appender2"); diff --git a/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/GetMyUIN.java b/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/GetMyUIN.java index b5a2c283..e61073d1 100644 --- a/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/GetMyUIN.java +++ b/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/GetMyUIN.java @@ -16,14 +16,14 @@ public class GetMyUIN extends BaseClass{ String vid =TestRunner.perpetualVid; @Test(priority=0) public void getMyUIN() throws Exception { - String tempemail = ConfigManager.gettempemail(); + String externalemail = ConfigManager.getexternalemail(); Commons.click( driver, By.id("getMyUIN")); Commons.enter( driver, By.id("aidValue"), vid);// Commons.click( driver, By.id("getUinSendOtpBtn")); - String otp = MockSMTPListener.getOtp(tempemail); + String otp = MockSMTPListener.getOtp(externalemail); Commons.enter( driver, By.id("otp-input"), otp); Commons.click( driver, By.xpath("//button[@id='getUinsubmitBtn']")); - Commons.assertCheck(By.id("dismissBtn"),"verify if Your UIN card has been successfully downloaded against the Event ID"); + Commons.assertCheck(By.id("messagePopup"),"verify if Your UIN card has been successfully downloaded against the Event ID"); Commons.click( driver, By.id("dismissBtn")); } @@ -35,11 +35,11 @@ public void getMyUINWithoutAID() throws InterruptedException, IOException { @Test(priority=2) public void getMyUINWithInvalidOtp() throws Exception { - String tempemail = ConfigManager.gettempemail(); + String externalemail = ConfigManager.getexternalemail(); Commons.click( driver, By.id("getMyUIN")); Commons.enter(driver, By.id("aidValue"), vid); Commons.click(driver, By.id("getUinSendOtpBtn")); - String otp = MockSMTPListener.getOtp(tempemail); + String otp = MockSMTPListener.getOtp(externalemail); Commons.enter(driver, By.id("otp-input"), otp+"56"); Commons.click(driver, By.xpath("//button[@id='getUinsubmitBtn']")); Commons.click(driver, By.id("dismissBtn")); diff --git a/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/GetPersonalisedCard.java b/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/GetPersonalisedCard.java index 18035f97..9d3a0fa9 100644 --- a/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/GetPersonalisedCard.java +++ b/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/GetPersonalisedCard.java @@ -16,7 +16,7 @@ public void getPersonalisedCard() throws Exception { Commons.clickWebelement( driver, By.id("dateOfBirth")); Commons.clickWebelement( driver, By.id("UIN")); Commons.click( driver, By.id("downloadFileBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if personalisedcard is downloaded"); + Commons.assertCheck(By.id("messagePopup"),"verify if personalisedcard is downloaded"); Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.id("uinservices/personalisedcard")); @@ -26,7 +26,7 @@ public void getPersonalisedCard() throws Exception { Commons.clickWebelement( driver, By.id("perpetualVID")); Commons.clickWebelement( driver, By.id("phone")); Commons.click( driver, By.id("downloadFileBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if personalisedcard is downloaded"); + Commons.assertCheck(By.id("messagePopup"),"verify if personalisedcard is downloaded"); Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.id("uinservices/personalisedcard")); @@ -40,7 +40,7 @@ public void getPersonalisedCard() throws Exception { Commons.clickWebelement( driver, By.id("gender")); Commons.clickWebelement( driver, By.id("photo")); Commons.click( driver, By.id("downloadFileBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if personalisedcard is downloaded"); + Commons.assertCheck(By.id("messagePopup"),"verify if personalisedcard is downloaded"); Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.id("uinservices/personalisedcard")); @@ -54,7 +54,7 @@ public void getPersonalisedCard() throws Exception { Commons.clickWebelement( driver, By.id("gender")); Commons.clickWebelement( driver, By.id("photo")); Commons.click( driver, By.id("downloadFileBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if personalisedcard is downloaded"); + Commons.assertCheck(By.id("messagePopup"),"verify if personalisedcard is downloaded"); Commons.click( driver, By.id("dismissBtn")); diff --git a/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/ManageMyVid.java b/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/ManageMyVid.java index 1ffaeced..365bf802 100644 --- a/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/ManageMyVid.java +++ b/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/ManageMyVid.java @@ -19,11 +19,11 @@ public void manageMyVid() throws Exception { Commons.click( driver, By.id("NoBtn")); Commons.click( driver, By.id("Temporary")); Commons.click( driver, By.id("vidWarningBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if Your VID has been successfully created against the Event ID"); + Commons.assertCheck(By.id("messagePopup"),"verify if Your VID has been successfully created against the Event ID"); Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.xpath("(//*[@id='download0'])[2]")); Commons.click( driver, By.id("vidDownloadBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if Your request to download the VID card has been successfully processed"); + Commons.assertCheck(By.id("messagePopup"),"verify if Your request to download the VID card has been successfully processed"); Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.xpath("(//*[@id='delete0'])[2]")); Commons.click( driver, By.id("vidDeleteBtn")); @@ -31,15 +31,15 @@ public void manageMyVid() throws Exception { Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.id("OneTimeUse")); Commons.click( driver, By.id("vidWarningBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if Your VID has been successfully created against the Event ID"); + Commons.assertCheck(By.id("messagePopup"),"verify if Your VID has been successfully created against the Event ID"); Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.xpath("(//*[@id='download0'])[2]")); Commons.click( driver, By.id("vidDownloadBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if Your request to download the VID card has been successfully processed"); + Commons.assertCheck(By.id("messagePopup"),"verify if Your request to download the VID card has been successfully processed"); Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.xpath("(//*[@id='delete0'])[2]")); Commons.click( driver, By.id("vidDeleteBtn")); - Commons.assertCheck(By.id("dismissBtn"),"Your VID has been successfully deleted against the Event ID"); + Commons.assertCheck(By.id("messagePopup"),"Your VID has been successfully deleted against the Event ID"); Commons.click( driver, By.id("dismissBtn")); } diff --git a/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/SecureMyId.java b/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/SecureMyId.java index 5709216b..60e76789 100644 --- a/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/SecureMyId.java +++ b/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/SecureMyId.java @@ -17,70 +17,70 @@ public void secureMyId() throws Exception { Commons.click( driver, By.id("setAuthlockStatus1")); Commons.click( driver, By.id("updateAuthlockStatusBtn")); Commons.click( driver, By.id("lockunlockauthBtn")); - Commons.assertCheck(By.id("dismissBtn"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); + Commons.assertCheck(By.id("messagePopup"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.id("uinservices/lockunlockauth")); Commons.click( driver, By.id("setAuthlockStatus1")); Commons.click( driver, By.id("updateAuthlockStatusBtn")); Commons.click( driver, By.id("lockunlockauthBtn")); - Commons.assertCheck(By.id("dismissBtn"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); + Commons.assertCheck(By.id("messagePopup"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.id("uinservices/lockunlockauth")); Commons.click( driver, By.id("setAuthlockStatus2")); Commons.click( driver, By.id("updateAuthlockStatusBtn")); Commons.click( driver, By.id("lockunlockauthBtn")); - Commons.assertCheck(By.id("dismissBtn"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); + Commons.assertCheck(By.id("messagePopup"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.id("uinservices/lockunlockauth")); Commons.click( driver, By.id("setAuthlockStatus2")); Commons.click( driver, By.id("updateAuthlockStatusBtn")); Commons.click( driver, By.id("lockunlockauthBtn")); - Commons.assertCheck(By.id("dismissBtn"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); + Commons.assertCheck(By.id("messagePopup"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.id("uinservices/lockunlockauth")); Commons.click( driver, By.id("setAuthlockStatus3")); Commons.click( driver, By.id("updateAuthlockStatusBtn")); Commons.click( driver, By.id("lockunlockauthBtn")); - Commons.assertCheck(By.id("dismissBtn"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); + Commons.assertCheck(By.id("messagePopup"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.id("uinservices/lockunlockauth")); Commons.click( driver, By.id("setAuthlockStatus3")); Commons.click( driver, By.id("updateAuthlockStatusBtn")); Commons.click( driver, By.id("lockunlockauthBtn")); - Commons.assertCheck(By.id("dismissBtn"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); + Commons.assertCheck(By.id("messagePopup"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.id("uinservices/lockunlockauth")); Commons.click( driver, By.id("setAuthlockStatus4")); Commons.click( driver, By.id("updateAuthlockStatusBtn")); Commons.click( driver, By.id("lockunlockauthBtn")); - Commons.assertCheck(By.id("dismissBtn"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); + Commons.assertCheck(By.id("messagePopup"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.id("uinservices/lockunlockauth")); Commons.click( driver, By.id("setAuthlockStatus4")); Commons.click( driver, By.id("updateAuthlockStatusBtn")); Commons.click( driver, By.id("lockunlockauthBtn")); - Commons.assertCheck(By.id("dismissBtn"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); + Commons.assertCheck(By.id("messagePopup"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.id("uinservices/lockunlockauth")); Commons.click( driver, By.id("setAuthlockStatus5")); Commons.click( driver, By.id("updateAuthlockStatusBtn")); Commons.click( driver, By.id("lockunlockauthBtn")); - Commons.assertCheck(By.id("dismissBtn"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); + Commons.assertCheck(By.id("messagePopup"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); Commons.click( driver, By.id("dismissBtn")); Commons.click( driver, By.id("uinservices/lockunlockauth")); Commons.click( driver, By.id("setAuthlockStatus5")); Commons.click( driver, By.id("updateAuthlockStatusBtn")); Commons.click( driver, By.id("lockunlockauthBtn")); - Commons.assertCheck(By.id("dismissBtn"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); + Commons.assertCheck(By.id("messagePopup"),"Your request to change the Authentication type(s) has been saved successfully against the Event ID"); Commons.click( driver, By.id("dismissBtn")); } diff --git a/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/ShareMyData.java b/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/ShareMyData.java index 7940fdf4..36c3bd6f 100644 --- a/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/ShareMyData.java +++ b/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/ShareMyData.java @@ -23,7 +23,7 @@ public void shareMyData() throws Exception { Commons.clickWebelement( driver, By.id("shareBtn")); Commons.clickWebelement( driver, By.id("confirmShareInfo")); Commons.clickWebelement( driver, By.id("shareInfoBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if The data chosen by you has been successfully shared with the chosen partner against the Event Id"); + Commons.assertCheck(By.id("messagePopup"),"verify if The data chosen by you has been successfully shared with the chosen partner against the Event Id"); Commons.clickWebelement( driver, By.id("dismissBtn")); Commons.clickWebelement( driver, By.id("uinservices/sharewithpartner")); @@ -55,7 +55,6 @@ public void shareMyData() throws Exception { Commons.clickWebelement( driver, By.id("shareBtn")); Commons.clickWebelement( driver, By.id("confirmShareInfo")); Commons.clickWebelement( driver, By.id("shareInfoBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if The data chosen by you has been successfully shared with the chosen partner against the Event Id"); Commons.clickWebelement( driver, By.id("dismissBtn")); Commons.clickWebelement( driver, By.id("uinservices/sharewithpartner")); @@ -69,18 +68,18 @@ public void shareMyData() throws Exception { Commons.clickWebelement( driver, By.id("gender")); Commons.clickWebelement( driver, By.id("photo")); Commons.clickWebelement( driver, By.id("shareBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if The data chosen by you has been successfully shared with the chosen partner against the Event Id"); + Commons.assertCheck(By.id("messagePopup"),"verify if The data chosen by you has been successfully shared with the chosen partner against the Event Id"); Commons.clickWebelement( driver, By.id("dismissBtn")); Commons.enter( driver, By.id("sharingReasonPlaceholder"), data); Commons.clickWebelement( driver, By.id("shareBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if The data chosen by you has been successfully shared with the chosen partner against the Event Id"); + Commons.assertCheck(By.id("messagePopup"),"verify if The data chosen by you has been successfully shared with the chosen partner against the Event Id"); Commons.clickWebelement( driver, By.id("dismissBtn")); driver.findElement(By.id("sharingReasonPlaceholder")).clear(); Commons.dropdown( driver, By.id("partnerDetails")); Commons.clickWebelement( driver, By.id("shareBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if The data chosen by you has been successfully shared with the chosen partner against the Event Id"); + Commons.assertCheck(By.id("messagePopup"),"verify if The data chosen by you has been successfully shared with the chosen partner against the Event Id"); Commons.clickWebelement( driver, By.id("dismissBtn")); } diff --git a/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/UpdateMyData.java b/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/UpdateMyData.java index 2e456000..e3fd955f 100644 --- a/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/UpdateMyData.java +++ b/residenttest/src/main/java/io/mosip/testrig/residentui/testcase/UpdateMyData.java @@ -28,7 +28,7 @@ public void updateMyDataName() throws Exception { Commons.clickWebelement( driver, By.id("submitBtn")); Commons.clickWebelement( driver, By.id("confirmUpdateData")); Commons.clickWebelement( driver, By.id("updateMyDataBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if Your update has been successfully updated against the Event"); + Commons.assertCheck(By.id("messagePopup"),"verify if Your update has been successfully updated against the Event"); Commons.clickWebelement( driver, By.id("dismissBtn")); } @@ -53,7 +53,7 @@ public void updateMyDataAddress() throws Exception { Commons.clickWebelement( driver, By.id("submitBtn")); Commons.clickWebelement( driver, By.id("confirmUpdateData")); Commons.clickWebelement( driver, By.id("updateMyDataBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if Your update has been successfully updated against the Event"); + Commons.assertCheck(By.id("messagePopup"),"verify if Your update has been successfully updated against the Event"); Commons.clickWebelement( driver, By.id("dismissBtn")); } @@ -70,7 +70,7 @@ public void UpdateDataWithEmail() throws Exception { System.out.println(otp); Commons.enter( driver, By.id("otp-input"), otp); Commons.clickWebelement( driver, By.id("submitOtpBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if Your Email ID has been successfully updated against the Event"); + Commons.assertCheck(By.id("messagePopup"),"verify if Your Email ID has been successfully updated against the Event"); Commons.clickWebelement( driver, By.id("dismissBtn")); } @@ -82,7 +82,7 @@ public void UpdateDataWithLanguage() throws Exception { Commons.clickWebelement( driver, By.xpath("//div[@id='mat-tab-label-0-3']")); Commons.dropdown( driver, By.id("preferredLang")); Commons.clickWebelement( driver, By.id("submit")); - Commons.assertCheck(By.id("dismissBtn"),"verify if Your Language has been successfully updated against the Event"); + Commons.assertCheck(By.id("messagePopup"),"verify if Your Language has been successfully updated against the Event"); } @@ -105,7 +105,7 @@ public void UpdateDataWithoutAddressLine() throws Exception { Commons.clickWebelement( driver, By.id("submitBtn")); Commons.clickWebelement( driver, By.id("confirmUpdateData")); Commons.clickWebelement( driver, By.id("updateMyDataBtn")); - Commons.assertCheck(By.id("dismissBtn"),"verify if Your update has been successfully updated against the Event"); + Commons.assertCheck(By.id("messagePopup"),"verify if Your update has been successfully updated against the Event"); Commons.clickWebelement( driver, By.id("dismissBtn")); } diff --git a/residenttest/src/main/java/io/mosip/testrig/residentui/utility/Commons.java b/residenttest/src/main/java/io/mosip/testrig/residentui/utility/Commons.java index fff7f092..9afee49b 100644 --- a/residenttest/src/main/java/io/mosip/testrig/residentui/utility/Commons.java +++ b/residenttest/src/main/java/io/mosip/testrig/residentui/utility/Commons.java @@ -30,7 +30,7 @@ public static String getDateTime(){ public static void click(WebDriver driver, By by) throws IOException, InterruptedException { logger.info("Clicking " + by ); - + wait(1000); try { WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30)); wait.until(ExpectedConditions.elementToBeClickable(by)); @@ -199,6 +199,8 @@ public static void wait(int wait) { public static void assertCheck(By by,String message) throws IOException { try { wait(2000); + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(20)); + wait.until(ExpectedConditions.presenceOfElementLocated(by)); boolean isDisplayed = Commons.isDisplayed(driver, by); Assert.assertTrue(isDisplayed,message); diff --git a/residenttest/src/main/java/io/mosip/testrig/residentui/utility/MockSMTPListener.java b/residenttest/src/main/java/io/mosip/testrig/residentui/utility/MockSMTPListener.java index c29d4677..125f55a8 100644 --- a/residenttest/src/main/java/io/mosip/testrig/residentui/utility/MockSMTPListener.java +++ b/residenttest/src/main/java/io/mosip/testrig/residentui/utility/MockSMTPListener.java @@ -84,17 +84,31 @@ public CompletionStage onText(WebSocket webSocket, CharSequence data, boolean } try { ObjectMapper om = new ObjectMapper(); + String message = ""; + String address = ""; root = om.readValue(data.toString(), Root.class); - if (!parseOtp(root.html).isEmpty() || !parseAdditionalReqId(root.html).isEmpty()) { - emailNotificationMapS.put(root.to.value.get(0).address, root.html); - logger.info(" After adding to emailNotificationMap key = " + root.to.value.get(0).address + " data " - + data + " root " + root); + if (root.type.equals("SMS")) { + message = root.subject; + address = root.to.text; + + } else if (root.type.equals("MAIL")) { + message = root.html; + address = root.to.value.get(0).address; + } + else { + logger.error("Unsupported notification type. type="+ root.type); + } + + if (!parseOtp(message).isEmpty() || !parseAdditionalReqId(message).isEmpty()) { + emailNotificationMapS.put(address, message); + logger.info(" After adding to emailNotificationMap key = " + address + " data " + data + " root " + + root); } else { - logger.info(" Skip adding to emailNotificationMap key = " + root.to.value.get(0).address + " data " - + data + " root " + root); + logger.info(" Skip adding to emailNotificationMap key = " + address + " data " + data + " root " + + root); } } catch (Exception e) { @@ -120,6 +134,8 @@ public static String getOtp(String emailId) { int counter = 0; String otp = ""; + + if (ConfigManager.getUsePreConfiguredOtp().equalsIgnoreCase(GlobalConstants.TRUE_STRING)) { return ConfigManager.getPreConfiguredOtp(); }