Serialized vs image snapshot testing with Cypress - cypress

I am looking at image snapshot testing to visual regressions in my app. My understanding is that serialized testing will make JSON representation of the DOM and compare a base version to a changed version. This will find copy and markup changes but will not be able to tell what actually changed in regards to how the markup was rendered. In other words, if you have a class on a div that set the font size and color, the test would only know the class existed, not what it was set too.
I was speaking to a friend who said you could get this data with serialized tests, but wasn't able to elaborate, only that he's "pretty sure you can do that". I did some research on this and haven't been able to find anything. As a last step, I figured I'd reach out and see if I'm missing something.
Is there way to make serialized snapshots compare the copy, markup and the styles associated with that markup?
Ultimately, I need to tests that can determine the changes I gave as an an example, but I want to make sure I'm not moving towards image snapshots naively.

Related

exist-db how to access a pdf

I am sure it is very simple ... I just cannot get my head around this...
the exist-db Documentation is a bit fuzzy on content extraction...
http://exist-db.org/exist/apps/doc/contentextraction.
I have a pdf-file, containing of about 162 high-res images (the pdf is quite big ...) and I do not know how to access any of the that are presumably created ...
please do not destroy me! I am just starting to build a database (for an Edition at Uni)I'd love to have a facsimile edition (so one Tab with the image-file and one tab with the transcribed texts)
I aim at doing something similar to what Heidelberg Universitdy did with the "Welsche Gast Digital" http://digi.ub.uni-heidelberg.de/diglit/cpg389/0190/image
(the choosen image is just an example! )
This pic
When clicking on faksimile the Scan opens and when clicking on Transkription the transcribed texts open!
I am quite new to Xquery, Xpath and most X-related stuff. I have a "working design" put together in exist-db and am looking at TEI for marking up the transcritpion etc, I fear I'll have to spend quite some time on this issue ...
(it is not about doing my job for me, it's just about pointing me in the right direction)
I m afraid the short answer is simply don't.
Storing a pdf in your db, and then trying to extract images from it, is kind of a recipe for disaster. Instead you should use the source images (not necessarily extracted from the pdf), and store these individually in a collection (e.g. resources/img). Those image files are then the binary resources that the documentation is actually talking about.
You might want to take a look at tei-publisher for creating digital edition in exist, especially this demo app for how to present high-res facsimiles with transcribed portions of text. I m afraid its all a bit more involved then just opening a pdf in a browser, but so is the Welsche Gast Digital

ESRI ArcGIS Runtime: AttributeLabelClass 10.2.7 ==> 100.0

The 10.2.7 runtime has the class 'AttributeLabelClass' that allows you to format the labels for graphics and add it to a GraphicsLayer such that all Graphics with a certain attribute will render the same way.
Does anyone know if anything like this survived into the 100.0+ timeframe? I've been looking all over for this with no luck (which usually means it's right in front of my nose).
I'm fairly sure something like this exists because I've seen prototype demos of their efforts to resolve label confliction rendering issues.
We're hoping to have this feature back in Update 1. The public API might not be fully complete by then, but you'll at least be able to set everything with the json definition, and a more full-blown API for all the properties by Update 2.

MvxImageViewLoader behaviour overriding (Caching, Images appearing etc.)

I use MvxImageViewLoader for MvvmCross Xamarin applications.
This component is really great and simplifies the images loading pretty much, but it (at least, out-of-the-box) is pretty basic and most of modern applications require some reacher functionality, for instance, loading/progress images or images nice appearing/transitions (possibly with custom animation).
I see there is DefaultImagePath property, but that's static image, which I can probably use by default, but that's not animated view or something.
So, is there any way to customize/extend the loader behaviour (for default image appearing, images transition (from default to loaded)) etc?
And also I've noticed that the loader caches the image and even if I trigger bound property changing (leaving the image url the same) it does not refresh the image. I guess, "caching" really means caching and so on, but what if I need to change the user icon or something... how can I forse the cache refreshing with the image loader?
Thank you!
So, is there any way to customize/extend the loader behaviour (for default image appearing, images transition (from default to loaded)) etc?
No - advanced features like fade-in/fade-out/animated-placeholder display aren't supported within the standard MvvmCross image view, and no-one that I know of has provided any samples or tutorials about how this can be done.
For adding such functionality, you can use normal software techniques - inheritance, aggregation and cut, copy, paste. e.g. you could simply create your own AgatImageView which had the behaviour your app requires based on MvxImageView.cs.
Some examples of creating your own data-bound controls is given in N=18 and N-19 of http://mvvmcross.wordpress.com/
As you already mentioned in upper comments you may use default iOS' UIActivityIndicatorView for showing progress and you should hide the progress in afterImageChangeAction, you can check if UIImageView.Image field is not null, to make sure that the image is loaded.
Regarding the caching, it's not that easy here. By default MvxImageViewLoader relies on MvvmCross framework's implementation of IMvxFileDownloadCache interface. This interface has only one public method RequestLocalFilePath(), so even if you get an instance from IoC container (Mvx.Resolve()) you won't be able to clean-up the existing cache (to do that you need to reset private _entriesByHttpUrl field of MvxFileDownloadCache class).
If you really need this, you have to copy-paste existing MvxFileDownloadCache class and make your tweaks. But I am not sure about your use-cases where you need this. If you download images from the web, the URL of the image is a sort of a key in the cache, so if you need to reload just change the URL.
Maybe you could use some old-school approach like adding GET parameters to the URL: http://mydomain.com/images/myimage.jpg?timestamp=123456. Usually this helps everywhere :-). Although I didn't test it with MvxImageViewLoader, it's just my best guess.

The basic framework behind a simple web app, what to use where

okay so i have basic skills in html, css, javascript.
im still in the learning phases but just need a little help on where to go in regards to creating a web app.
i can figure out all the code, so thats fine, i just need some pointers as to what to use where.
So basically ill have a webpage with a few simple buttons, when clicked they'll send a message to the server and the server will hold a count for each button clicked using a php script.
1) - would it be best to hold that information in a JSON file?
then from there, there'll be another webpage which will have div tags stretching 100% across the page, with an element inside it which will move across the page according to the count held on the server.
2) - what should i use to animate it moving?. would i use javascript? or css3 or something?
the front end will need to continuously update on the count held by the server.
3) - would AJAX methods be best using javascript?
any advice would be great thanks.
And one last thing.
With Javascript animating, if i wanted to animate a div moving horizontal, is the best way to do it by animating the margin size? or am i stuck in the dark days..
1: i would store it in a database, if you store it in a file make sure that you are handling writes in a safe way(multiple writes to the same file)
2:you could use javascript to animate the css properties of a html element(preferable the width)
3: Ajax would work but then you need to continuously poll the server for changes alternativly use longpoling http://en.wikipedia.org/wiki/Push_technology#Long_polling
an alternative if you only support modern browsers and your hosting company allows it is to use websockets
If you're trying to save information server side (which you seem to be), I would recommend using a database (such as MySQL).
If your animation is dependent on the value from the server, I would use javascript to animate it. Note that you will have to poll the server in order to actually get this information (lets say, every second). When you get the information, simply update the div you want to animate with the new information. I don't quite understand what you want your display to look like, so I can't really give you anything more specific here.
Yes. I would recommend using jQuery to handle your AJAX calls as it makes it much easier and deals with cross-browser weird-ities.
To your update:
One option could definately be to adjust the (left) margin size, but you could also use the relative position. It will basically push the element however many pixels in whatever position from where it would typically be displayed. So if your box is by default right along the left border, you could relatively position it 100px to the right. You can read more about position here.

Manually upgrading Three.js JSON geometry files from r42 to r55

I have some JSON files that define geometries, as required by r42 of Three.js's JSONLoader class. The files are version 2 of the format.
Is it feasible to manually update these files between versions?
The first obvious difference is that the file is no longer JavaScript, but actual JSON. This was easy to correct for. However the new format has a metadata section, and thirty minutes of experimentation with is isn't getting me anywhere.
I'm seeing problems because the Geometry object's material properties has an empty materials array. The resulting geometry has multiple parts with different materials, as seen in r42.
Does anyone know how I might manually tweak these .json files to work with r55?
I have no complete knowledge how the internals of the format have changed, but here's a couple of hints:
If you have the source object, the best way would be to re-export/convert. There should now also be more converters and exporters to use if your source format is obscure. If the source is unknown, some Googling might be worth it.
metadata section doesn't matter, it isn't used for anything in the loader.
There is no more Geometry.materials. Instead, JSONLoader's callback returns the loaded materials as a separate parameter to the callback. See Migration Guide (r52->r53) for more on that. In fact, the loader interface has changed also in r46.
git log of some example model files (searching for changes there could be your way forward if you really need to manually migrate) suggests that there might be e.g. UV flipping which would be difficult to fix manually but could be worked around in code. But first you'd need to get something to display on screen.
Try dragging the file into the editor, then do File/Export Geometry.
Here is a fix for drag and drop into the editor. Add this code before the drop event in index.html. I tested this in Chrome ( 24.0.1312.56 ), Safari and Firefox in OSX.
document.addEventListener("dragover", function(e) {
e.preventDefault();
});
#mrdoob's answer worked after a few patches to the editor (here and here.)
However it's worth noting that upgrading the files by hand in a text editor is possible, especially if you don't have any UV coords.
Earlier versions did not use JSON -- they were JavaScript files. The conversion is straightforward.
You can either ignore the metadata section, or else port it from the comments into an object.
If you do have UV coords, then they must be mapped differently (I believe an axis is flipped)

Resources