samsung smart TV IME initialization issue - samsung-smart-tv

While initializing the IME object in samsung tv I am getting the following error:
TypeError: 'undefined' is not a function (evaluating 'widgetAPI.registIMEKey()')
The widgetAPI is properly initialized and accessible.
Any kind of help is appreciated.
Code I tried:
var textBoxController = {
createInputbox: function (elId){
var Elmement = $("#"+elId);
var imeReady = function(imeObject)
{
alert("----------R E A D Y-----------");
var ready = true;
if (ready)
{
$("#"+elId).focus();
}
};
var ime = new IMEShell(elId, imeReady, 'en');
widgetAPI.registIMEKey();
},
test:function(){
this.createInputbox("txtName");
}
}

Where does widgetAPI come from ?
Your code should be:
var ime = new IMEShell(elId, imeReady, 'en');
ime.registIMEKey();

Related

Protractor upload stuck when filesearch pops up

I'm trying to figure out what's wrong with the code below:
it('should upload a photo', function(){
var photo = './photos/et-test.jpeg',
exactPhoto = path.resolve(__dirname, photo);
var form = element(by.id('fileupload'));
var upload = element(by.css('input[type = "file"]'));
var addFiles = element(by.cssContainingText('.btn.btn-success.fileinput-button.mb-10','Add files...'));
var uploadBtn = element(by.css('.btn.btn-primary.start.mt-20'));
element(by.cssContainingText('.inline_link','Upload more album photos now')).click();
element(by.id('secondary_upload_link')).click();
browser.wait(EC.visibilityOf(addFiles), 5000);
addFiles.click();
upload.sendKeys(exactPhoto);
browser.wait(EC.visibilityOf(uploadBtn), 5000);
uploadBtn.click();
expect(element(by.css('.table')).getText()).toBe('Upload Finised');
});
I keep getting stuck on the filesearch popup and receive this error:
Message:
Failed: Wait timed out after 5006ms
Is there anything lacking or should've been done based on the flow of my code?
If I'm understanding your issue correctly you are seeing a popup window when uploading a file. Can you try the following capability in your conf (assuming you are using Chrome)
capabilities: {
browserName: 'chrome',
chromeOptions: {
prefs: {
download: {
'prompt_for_download': false,
'directory_upgrade': true,
'default_directory': 'src/test/javascript/e2e/downloads'(or where ever you prefer)
}
}
}
}
Yes, you don't need to click on it, just sendKeys() for this input element
Sometimes it needs to make this input visible. Just try like that (it works in my case for await/async protractor):
private addAttachment = element(by.css('input[type="file"]'))
await browser.executeScript("arguments[0].style.visibility = 'visible'; arguments[0].style.height = '1px'; arguments[0].style.width = '1px'; arguments[0].style.opacity = 1; arguments[0].style.display = 'inline'; arguments[0].style.overflow = 'visible'", this.addAttachment)
await browser.executeScript("arguments[0].focus();", await this.addAttachment.getWebElement())
await this.addAttachment.sendKeys(path)
Try this:
var photo = './photos/et-test.jpg',
exactPhoto = path.resolve(__dirname, photo);
var form = element(by.id('fileupload')); ///Users/leochardc/ET/photos/et-test.jpg
var upload = element(by.css('.fileupload_section input[type = "file"]'));
var addFiles = element(by.cssContainingText('.btn.btn-success.fileinput-button.mb-10','Add files...'));
var uploadBtn = element(by.css('.btn.btn-primary.start.mt-20'));
var uploadFinished = element(by.css('.fileupload_section .text-center p'));
browser.get(url);
element(by.cssContainingText('.inline_link','Upload more album photos now')).click();
element(by.id('secondary_upload_link')).click();
browser.wait(EC.visibilityOf(addFiles), 5000);
// addFiles.click();
upload.sendKeys(exactPhoto);
var previewPic = element(by.css('.fileupload_section.fileupload_files'));
browser.wait(EC.visibilityOf(previewPic), 5000);
browser.wait(EC.visibilityOf(uploadBtn), 5000);
uploadBtn.click();
browser.wait(EC.visibilityOf(uploadFinished), 30000);
expect(uploadFinished.getText()).toBe('Upload Finished');

sapui5 how to read PDF file content in controller

Im facing an issue in PDF File Uploading..
In the above Screenshot if you see, When im trying to upload a PDF file, Im not able to read the content in that pdf file.
My requirement is like, I need to get the content as String from that file and that content i need to send to back-end server..
Im getting below error if im trying to read the content
HTTP Status 405 - Bad Method
Below is my Code ..
Im using xmlns:u="sap.ui.unified" library
<u:FileUploader id="fileUploader" name="myFileUpload" tooltip="Upload Service Sheet"
uploadComplete="handleUploadComplete" change="handleValueChange" typeMissmatch="handleTypeMissmatch" style="Emphasized" fileType="pdf"
placeholder="Choose a file for Upload..." maximumFileSize="2000" mimeType="pdf" buttonText="Upload">
</u:FileUploader>
handleUploadComplete: function(oEvent) {
var fileName = oEvent.getSource().getProperty("value");
var sResponse = oEvent.getParameter("response");
if (sResponse) {
var sMsg = "";
var m = /^\[(\d\d\d)\]:(.*)$/.exec(sResponse);
if (m[0] == "200") {
sMsg = "Return Code: " + m[0] + "(Upload Success)";
oEvent.getSource().setValue("");
} else {
sMsg = "Return Code: " + m[0] + "(Upload Error)";
}
MessageToast.show(sMsg);
}
},
Can some one please help me how can i read the data in the PDF??
Thank you in advance
Take a look at this example. Hope this helps.
View
<u:FileUploader change="onChange" fileType="pdf" mimeType="pdf" buttonText="Upload" />
Controller
convertBinaryToHex: function(buffer) {
return Array.prototype.map.call(new Uint8Array(buffer), function(x) {
return ("00" + x.toString(16)).slice(-2);
}).join("");
},
onChange: function(oEvent){
var that = this;
var reader = new FileReader();
var file = oEvent.getParameter("files")[0];
reader.onload = function(e) {
var raw = e.target.result;
var hexString = that.convertBinaryToHex(raw).toUpperCase();
// DO YOUR THING HERE
};
reader.onerror = function() {
sap.m.MessageToast.show("Error occured when uploading file");
};
reader.readAsArrayBuffer(file);
},

Clickable But Not Visible?

I am fairly new to Protractor E2E testing and was wondering if it was possible for an element to be clickable (ExpectedConditions.elementToBeClickable) but not necessarily visible (ExpectedConditions.visibilityOf).
For example, I have the following code:
var EC = protractor.ExpectedConditions;
var tryItButtonClickable = EC.elementToBeClickable(tryItButton);
var tryItButtonVisible = EC.visibilityOf(tryItButton);
return browser.wait(EC.and(tryItButtonClickable, tryItButtonVisible), getWaitTime())
.then(function() {
var protocol = url.parse(myarray[0].url).protocol;
if (protocol === null) {
throw new Error('expected ' + protocol + ' not to be null');
}
})
Before adding the tryItButtonVisible piece, I would receive a time out error from Protractor, presumably because my tryItButton was clickable but hadn't been loaded into the DOM.
Is this true, or am I being redundant?
Thanks
This is offical clickable function of protractor
elementToBeClickable(elementFinder: ElementFinder): Function {
return this.and(this.visibilityOf(elementFinder), () => {
return elementFinder.isEnabled().then(passBoolean, falseIfMissing);
})
as you see, it checks element visibility first so answer is NO
resource:https://github.com/angular/protractor/blob/master/lib/expectedConditions.ts line:188

Cannot read property 'download' of undefined $cordovaFileTransfer in Ionic

I want to use $cordovaFileTransfer in my app to dowload image data, but after trying to implement the code, this error is showing up:
Cannot read property 'download' of undefined
here is my code:
var url = "blablabla.com/img.png";
var targetPath = "img/"+ imgpaths;
var trustHosts = true;
var options = {};
$cordovaFileTransfer.download(url, targetPath, options, trustHosts)
.then(function(result) {
// Success!
console.log('Download Success' + targetPath);
}, function(err) {
// Error
}, function (progress) {
$timeout(function () {
var downloadProgress = (progress.loaded / progress.total) * 100;
console.log('Progress : '+downloadProgress);
});
});
anybody can help me?
Check this issues list:
http://ngcordova.com/docs/common-issues/
For example have you wrapped the call to $cordovaFileTransfer.download() inside deviceready handler or better inside $ionicPlatform.ready() ?

Cannot read property 'addGraph' of undefined in meteorJS - nvd3

Using the official nvd3 package (https://atmospherejs.com/nvd3/nvd3)
I have the following code under the Template.rendered block:
var formattedEarnedData = formatEarnedData(userEarnedDataSet);
nv.addGraph(function() {
var earnedChart = nv.models.lineChart()
.margin({ left: 25 })
.useInteractiveGuideline(true)
.transition()
.duration(350)
.showLegend(true)
.showYAxis(true)
.showXAxis(true);
earnedChart.xAxis
.axisLabel('Date')
.tickFormat(d3.format('d'));
earnedChart.yAxis
.axisLabel('Earned')
.tickFormat(d3.format('d'));
d3.select('#earned-charts svg').datum(
[{
key: 'Earned',
values: formattedEarnedData
}]
).call(earnedChart);
nv.utils.windowResize(earnedChart.update);
return earnedChart;
});
The following lies at the bottom of the js file outside of the rendered block:
var formatEarnedData = function(dataSet) {
var earnedDataArray = new Array();
var groupedDates = _.groupBy(_.pluck(dataSet, 'progression'), function(date) {
return moment(date).format('MMM D');
});
_.each(_.values(groupedDates), function(dates) {
earnedDataArray.push({
date: dates[0],
total: dates.length
});
});
return earnedDataArray;
}
Even after following the documentation, I am still getting this error:
Cannot read property 'addGraph' of undefined
Can any nvd3 experts shed some light on why this error is happening?
Thanks in advance.