How to access Downloads folder in taiko automation - automation

I want to verify whether file is downloaded or not after clicking download link.
I am using taiko for automating this task.
I tried to open recent downloads in browser by using these taiko commands goto("chrome://downloads/")
and press(['Control','J']) but both did't work.
Is there any other method to do the same task.And i want know why above commands are not working

Check out this example
You need to first set the download path:
// client function is imported from taiko
await client().send('Page.setDownloadBehavior', {
behavior: 'allow',
downloadPath: downloadPath,
});
You then need to download your file (trigger the action that results in the file getting downloaded - the example uses a click action. And then, after a suitable time has elapsed, you will check the download path that you registered earlier for existence of the file:
expect(path.join(downloadPath, 'foo.txt')).to.exist;

Related

How to open a disk file with Capacitor?

I'm saving a file by running the following code with Capacitor:
Filesystem.writeFile({
path: fileName,
data: content,
directory: FilesystemDirectory.Documents,
//encoding: FilesystemEncoding.UTF8
});
Now, I would like to open it (it's a pdf). However, I don't see anything in FileSystem documentation about how to achieve that? I'm missing a FileOpener function.
The goal is that it gets opened with whichever pdf app the user has in the phone.
I'm using Vuejs.
I hope that this is helpful to you, a package for capacitor to read pdf. https://www.npmjs.com/package/capacitor-pdf-viewer-plugin

jQuery 3.3.1 file upload freeze in Safari 12.1.2 and higher

I'm trying to upload a file using jQuery 3.3.1 in Safari 12.1.2 and it allows me to browse and select the file that needs to be uploaded. But when I try to upload the selected file. It does nothing. No error message is displayed, at least in the browser console. This is working fine in Safari versions below 12.1.2, Chrome and Firefox. Can some one please let me know a clue to at least start troubleshooting this issue. (I also tried to debug the code but it ended up in jQuery-3.3.1.min.js and terminates.)
Found the change required to fix the issue. Option "forceIframeTransport" In the code snippet that refers to the fileupload function in jdeQuery-File-Upload has been set to "true" in my code. (As per the jQuery-File-Upload doc this value is set to false by default) How ever for a unknown reason file upload fails in Safari 12.1.2 and above when this value is set to true. So simple the fix in my case is setting "forceIframeTransport" to "false" as shown in below code snippet. (please note that it's not required to have cross cite file uploads which is affected by this option in my application)
$('.assetupload').fileupload({
**forceIframeTransport : false**,
add : function(e, data) {
.......
.......
});

Agile Central example cumulative flow diagram not rendering

After checking out the source from: https://github.com/RallyApps/app-catalog
I attempted to build the Portfolio Item cumulative flow diagram src/apps/charts/rpm/cfd locally using
rally-app-builder build which shows no errors
Launching App-debug.html allows me to input the relevant settings, but once I click 'save', nothing renders and there are no errors logged to the JS console either, making debugging challenging.
I attempted to copy the build output into a custom html app inside rally, which displayed the same behaviour.
Is this a bug with the example app? Or have I missed some crucial configuration step?
EDIT:
Extra info - I tried running via the rally-app-builder to no avail (think it's related to this issue: https://github.com/RallyApps/rally-app-builder/issues/45). I attempted to flatten the structure and the result of that was a cross-origin request error.
Running from file resulted in a 403 for the SDK
Sorry about that- that Rally App Builder issue is definitely the problem you're running into. Just as a test I downloaded the built html output for that app from the app catalog release: https://github.com/RallyApps/app-catalog/releases/download/2.1/2.1.zip
It worked when installed on a custom html app on my dashboard once I edited the app settings and configured a portfolio item.
If you're looking to tweak this app from source you'll probably have to copy all those files referenced in config.json that live in parent directories into the main app directory and fix the paths in config.json. Then you should be able to build and run the app normally using Rally App Builder.
It seems this app was really not designed to be run externally, so I added a little code to ease the issues I ran into:
In PortfolioChartAppBase.js, _loadSavedPortfolioItem function:
scope: this,
fetch: ['Name', 'ObjectID'] //this is new
And I added some default settings as a top level config object in CumulativeFlowChartApp.js (since the code to force into settings mode doesn't seem to work correctly when running externally):
config: {
defaultSettings: {
portfolioItemPicker: '/portfolioitem/feature/52725935318', //insert a valid oid here
startDate: 'actualstartdate',
endDate: 'actualenddate',
chartAggregationType: 'storycount'
}
},

Safari Push Notifications - Verifying hashes in manifest.json failed even though correct

I have created a push package with the appropriate files as per the Apple spec for APNS. This manifest file represents all of the files that are present:
{
"icon.iconset/icon_128x128.png": "78609fcff69688f969a38f957ac2f10fc79d6732",
"icon.iconset/icon_128x128#2x.png": "78609fcff69688f969a38f957ac2f10fc79d6732",
"icon.iconset/icon_16x16.png": "d348589e2cf37d8f23940f8545afe75a2e98b4ac",
"icon.iconset/icon_16x16#2x.png": "d348589e2cf37d8f23940f8545afe75a2e98b4ac",
"icon.iconset/icon_32x32.png": "e4418a1c5f2ecfbb702961515aaa65d5449b1c53",
"icon.iconset/icon_32x32#2x.png": "e4418a1c5f2ecfbb702961515aaa65d5449b1c53",
"website.json": "45be9c4a6f1bf96e27a9eecab219304b35c5ac24"
}
I have manually checked the sha1 values on the CLI and they are all correct, along with the file locations. And yet I still get this error back from Safari each time I try to get permission:
{ '{"logs":': { '"Verifying hashes in manifest.json failed"]': '' } }
Which is not valid JSON either. Any ideas why this would be failing?
I recently implemented push notifications through pushwoosh. They automatically created the package for me and I checked how they done it. The only difference between mine manifest file and your is a back slash before the normal slash. Maybe it could do the difference for you. Copy and paste this code in your manifest (I have already added your SHA1 values):
{"icon.iconset\/icon_16x16.png":"d348589e2cf37d8f23940f8545afe75a2e98b4ac","icon.iconset\/icon_16x16#2x.png":"d348589e2cf37d8f23940f8545afe75a2e98b4ac","icon.iconset\/icon_32x32.png":"e4418a1c5f2ecfbb702961515aaa65d5449b1c53","icon.iconset\/icon_32x32#2x.png":"e4418a1c5f2ecfbb702961515aaa65d5449b1c53","icon.iconset\/icon_128x128.png":"78609fcff69688f969a38f957ac2f10fc79d6732","icon.iconset\/icon_128x128#2x.png":"78609fcff69688f969a38f957ac2f10fc79d6732","website.json":"45be9c4a6f1bf96e27a9eecab219304b35c5ac24"}
I created a small ruby script for generating these manifests based on the code in https://github.com/SymmetricInfinity/push_package/blob/master/lib/push_package.rb.
Copy the script into a directory containing an icon.iconset directory and your website.json. Then you can run ruby gen_manifest.rb inside that directory and the script will write the manifest.json. At the very least it may be a sanity check to see that everything is correct. The script is here: https://gist.github.com/adamvduke/7934457
If you don't have any ruby experience, comment back and I can walk you through it.

Ploblem including a file- Titanium

I get an error while i try to include the js file which is in the same folder. I tried cleaning my project but was of no use.
The console says "error loading path".
Please help.
var db={}
Titanium.include('windows/gallery');
var displayButton= Ti.UI.createButton({
title:'Display',
onClick:function(){
db.gallery.open();
}
});
I have used open function which opens the file. The open file works has no problem.
usually, we use require('files/myFile'), where :
Resources/files/myFile.js is the path (note that require doesn't use the .js)
The js file is NOT at the same level that app.js, but included in Resource folder.
So here, you should do
Titanium.require('windows/gallery');
instead of
Titanium.include('windows/gallery');
By the way, the previous method was Titanium.include('windows/gallery.js');
Note the .js at the end of the include version.
Is it a mobile or desktop version ?