Automated visual testing uses software to automate the process of comparing visual elements across various screen combinations to uncover visual defects. Functional testing changes visual elements, so each step of a functional test creates a new UI state you can visually test.
Script to do visual testing with BackstopJS.
npm install
backstop reference
backstop test
Check here for more details here.
Framework link: https://github.com/rtCamp/visual-automation-backstop