When i run my test i dont want to save any screenshots on the agent machine
i want to save these images to custom directory
when i try to do this i am getting this error RangeError: Maximum call stack size exceeded. this works fine if i give a folder path inside cypress directory like this cypress\my folder
Can we actually save screeenshot files to a different folder path than the cypress directory?
addMatchImageSnapshotCommand(
{
failureThreshold: 0.00, // threshold for entire image
failureThresholdType: 'percent', // percent of image or number of pixels
customDiffConfig: { threshold: 0.0 }, // threshold for each pixel
capture: 'viewport', // capture viewport in screenshot
customSnapshotsDir:'C:\foldername',
customDiffDir:'C:\foldername'
}
);
You can change the default path to the screenshot in the cypress.json file.
Just add the screenshotsFolder property.
{
"screenshotsFolder": "./my/custom/path"
}
Related
If I do compare the screen shot with the real time application then it's getting failed. What would be best approach and how to compare the screen shot in Cypress
Output: getting error log on cypress for
installed dependency for comparing the screen shot
npm install --save-dev cypress-image-snapshot #types/cypress-image-snapshot
// code on commond.js file.
const compareSnapshotCommand = require('cypress-image-diff-js/dist/command')
compareSnapshotCommand();
// code on cypress.config.json
const getCompareSnapshotsPlugin = require('cypress-image-diff-js/dist/plugin')
getCompareSnapshotsPlugin(on, config)
// .js test scenario on test file
describe('compare the homepage screen shot with the application homepage', () => {
it('should compare the homepage', () => {
cy.visit("/");
cy.compareSnapshot('fixtures/healthcaresuccess-page.png', 0.001);
}
You will need to alter your image difference threshold. Right now it is set to 0.001. You'll need to either set a new base reference image or change the option to allow for more difference before failing the test.
In your <rootDir>/cypress/support/commands.js, you can alter the option
addMatchImageSnapshotCommand({
// alter to your choosing
failureThreshold: 0.05, // threshold for entire image
});
I want to upload 2 scaled images and I do not want to upload the original image. To do this, I set sendOriginal to false. If I set hideScaled to true, no files show in the uploader. If set set hideScaled to false, both scaled images show up in the list. I realize that the documentation says not to use both options this way. Is there another way to achieve what I want? How do I make fineuploader show only 1 file on the file list no matter how many scaled images it has?
I ran into this exact same problem. I also wanted to rename the larger scale to match the original filename and to pass a custom parameter so the server script could sort the images into the db based on scale size.
I used this method as a hackish substitute for an onScaled event. If anyone is still interested.
// Must be onSubmitted, not onSubmit or the DOM element won't be rendered yet.
onSubmitted : function(id, name) {
// scaling.sizes.name = 'thumb'
if (name.toLowerCase().lastIndexOf(' (thumb).jpg') !== -1) {
// Hide the element displaying the thumbnail.
qq(this.getItemByFileId(id)).hide();
// Good place to include any custom parameters based on scale size.
this.setParams({gpsize : 'thumb'}, id);
}
// scaling.sizes.name = 'large'
else if (name.toLowerCase().lastIndexOf(' (large).jpg') !== -1) {
this.setParams({gpsize : 'large'}, id);
// If needed rename file in this event, not before, since filename
// is the hackish hook needed to connect scale size to file id.
var newName = name.slice(0, name.toLowerCase().lastIndexOf(' (large).jpg')) + '.jpg';
this.setName(id, newName);
}
return true;
}
It's not perfect, but it gets the job done without bushwhacking through the script files.
I am a novice user at ExtendScript, Basil.js & Javascript.
After seeing the project http://basiljs.ch/gallery/ending-the-depression-through-amazon/ I wondered if it is possible to simply get the Basil.js Script/ Extendscript/Indesign to grab images from a webpage and insert it directly into a indesign document.
I am a beginner so if someone had a complete script, from directory, functions... with example url, import, save, place.... ?
This is in the hope that I could simply put an address into the script and it would harvest all images on the webpage and put them into a indesign document?
I tried their example http://basiljs.ch/tutorials/getting-images-from-urls/
but when I copy that and run it in extend script it is just searching my computer...
UPDATE*
#includepath "~/Documents/;%USERPROFILE%Documents";
#include "basil/basil.js";
function draw() {
var url = "https://raw.github.com/basiljs/basil.js/master/lib/basil.png";
// download the url to a default location, filename according to url:
// -> "the project folder" + data/download/basil.png
//b.download(url);
// download url to a specific location in the project folder:
// -> "the project folder" + data/download_images_files/basil_logo.png
// b.download(url, "download_images_files/basil_logo.png");
// download url to a specific location e.g. to your desktop
// -> ~/Desktop/basil_logo.png
var newFile = new File("~/Desktop/basil_logo.png");
b.download(url, newFile);
}
b.go();
... It finds in Error in Basil's Core.js #
var runDrawOnce = function() {
app.doScript(function() {
if (typeof glob.draw === 'function') {
glob.draw();
}
}, ScriptLanguage.javascript, undef, UndoModes.ENTIRE_SCRIPT);
};
Console says...
Using basil.js 1.08 ...
sh ~/Documents/basiljs/bundle/lib/download.sh /Users/jamestk/Desktop (Address here, I don't have the sufficient reputation on stack overflow)
Basil.js Error -> b.shellExecute(): Error: sh: /Users/jamestk/Documents/basiljs/bundle/lib/download.sh: No such file or directory
The easiest way would probably be to us the b.shellExecute(cmd) command to run a shell script that downloads your images.
You could use wget from shell to download all images from an url, see this question: How do I use Wget to download all Images into a single Folder
You should make sure then to save the images in the documents data directory. After that, you could get all images by using the Folder object's getFiles() method:
var myImagesArray = Folder('~/path/to/my/folder').getFiles();
Finally you could use that array in a loop to place all the images into your document.
I'm trying to find out if the Fine Uploader can limit the total amount of images allowed. So lets say I'd like to limit the images to 5 and a user drag and drops or selects 6 images it will prompt the user saying that can't be done due to only allowing a maximum of 5 images.
I've been looking at the documentation but I might have missed it.
Change the validation.itemLimit option to match the max number of files you want to add, change the validation.acceptFiles and validation.allowedExtensions to match only image files (validation docs)
var uploader = new qq.FineUploader({
/* ... */
validation: {
itemLimit: 5,
acceptFiles: 'image/*',
allowedExtensions: ['.jpe', '.jpg', '.jpeg', '.gif', '.png', '.bmp', '.ico', '.svg', '.svgz', '.tif', '.tiff', '.ai', '.drw', '.pct', '.psp', '.xcf', '.psd', '.raw']
}
});
Note: If you want a custom error message, then change text of the messages.tooManyItemsError option to equal the specific error message you want (error handling docs).
You can also add code to the onError callback to customize how and when your message is shown (events docs) or do some other operation.
I am facing a problem regarding file uploading in Grails.
I would like to check the file size runtime after opening from the windows explorer and give me the error message if any condition fails.
I have a file uploading window where I have 3 file choose options. I would like to check each three files not to be more than 5MB. When I click on Browse button then my system explorer opens and I choose file.
Is there any way to check file size while selecting the file using javascript/ Ajax call? And if the file size is exceeds than the explorer show again to choose another file.
About this issue, there is a plug-in called file-uploader to the rescue.
With this plug-in you can define some restrictions in config.groovy. Here is an example:
fileuploader {
avatar {
maxSize = 1024 * 256 //256 kbytes
allowedExtensions = ["jpg","jpeg","gif","png"]
path = "/tmp/avatar/"
}
docs {
maxSize = 1000 * 1024 * 4 //4 mbytes
allowedExtensions = ["doc", "docx", "pdf", "rtf"]
path = "/tmp/docs/"
}
}