3 Replies Latest reply on Oct 11, 2016 5:49 PM by vinoth selvaraj

    Graphene - Visual Validation

    vinoth selvaraj Newbie

      mjobanek, I was thinking if we could add an extn for visual validation in Graphene. For ex: the use case would be as shown here.



      @Image(Baseline = "/resources/login.png")
      public class LoginPage {
       private WebElement username;
       private WebElement password;
       private WebElement someDynamicContentElement;
       private ImageComparator imageComparator;
       @Image(Baseline = "/resources/login/mustmatch.png")
       private WebElement someElementWhichShouldMatchImge;
       //takes the screenshot of the current page
       //compares with baseline & returns the status
       //it can even highlight the difference in case of mismatch
       public boolean isPageAsExpected() {
        return imageComparator.compare();
       //we might want to exclude some elements
       //it might have dynamic content like current date/time etc
       public boolean isPageAsExpectedAfterExcludingElements() {
        return imageComparator.exclude(someDynamicContentElement)
       //in some case we might not want to do whole page compare
       //ex: it might have tons of adds
       //So we might want to just compare one or more elements - not whole page
       public boolean isSomeElementAsExpected() {
        //take current coordinates of the element and get the image
        //compare with baseline 
        return imageComparator.element(someElementWhichShouldMatchImge)
         .element(someOtherElement1) //or list of elements