Package net.mindengine.galen.page

Examples of net.mindengine.galen.page.Rect


            validationListener.onObject(pageRunner, pageValidation, "objectA1"); {
                validationListener.onSpecError(pageRunner, pageValidation,
                        "objectA1",
                        new SpecInside("other-object", asList(new Location(exact(10), asList(LEFT)))).withOriginalText("inside: other-object 10px left")
                            .withPlace(new Place("specs.spec", 12)),
                        new ValidationError(asList(new ErrorArea(new Rect(10, 10, 100, 50), "objectA1")), asList("objectA1 is not inside other-object")));
               
                validationListener.onSpecSuccess(pageRunner, pageValidation, "objectA1", new SpecWidth(between(10, 20)).withOriginalText("width: 10 to 20px").withPlace(new Place("specs.spec", 12)));
            }
            validationListener.onAfterObject(pageRunner, pageValidation, "objectA1");
           
            validationListener.onObject(pageRunner, pageValidation, "objectA2"); {
                validationListener.onSpecSuccess(pageRunner, pageValidation, "objectA2", new SpecWidth(between(10, 20)).withOriginalText("width: 10 to 20px").withPlace(new Place("specs.spec", 12)));
                validationListener.onSpecError(pageRunner, pageValidation,
                        "objectA2",
                        new SpecWidth(exact(10)).withOriginalText("width: 10px")
                            .withPlace(new Place("specs.spec", 12)),
                        new ValidationError(asList(new ErrorArea(new Rect(200, 300, 50, 30), "objectA2")), asList("objectA2 width is 20px instead of 10px")));

                validationListener.onSpecError(pageRunner, pageValidation,
                        "objectA2",
                        new SpecText(SpecText.Type.IS, "Login").withOriginalText("text is: Login")
                                .withPlace(new Place("specs.spec", 12))
                                .withOnlyWarn(true),
                        new ValidationError(asList(new ErrorArea(new Rect(200, 300, 50, 30), "objectA2")), asList("objectA2 text is \"Logout\" instead of \"Login\"")));
            }
            validationListener.onAfterObject(pageRunner, pageValidation, "objectA2");
           
            validationListener.onAfterSection(pageRunner, pageValidation, section1);
           
            PageSection section2 = sectionWithName("some section 2");
            validationListener.onBeforeSection(pageRunner, pageValidation, section2);
           
            validationListener.onObject(pageRunner, pageValidation, "objectA1"); {
                validationListener.onSpecSuccess(pageRunner, pageValidation, "objectA1", new SpecHeight(between(10, 20)).withOriginalText("height: 10 to 20px").withPlace(new Place("specs.spec", 12)));
               
                //Doing sub-objects call
                {
                    validationListener.onObject(pageRunner, pageValidation, "sub-objectA1"); {
                        validationListener.onSpecSuccess(pageRunner, pageValidation, "sub-objectA1", new SpecHeight(between(10, 20)).withOriginalText("height: 10 to 20px").withPlace(new Place("specs.spec", 12)));
                        validationListener.onSpecError(pageRunner, pageValidation,
                                "sub-objectA1",
                                new SpecWidth(exact(10)).withOriginalText("width: 10px")
                                    .withPlace(new Place("specs.spec", 12)),
                                new ValidationError(asList(new ErrorArea(new Rect(200, 300, 50, 30), "sub-objectA1")), asList("sub-objectA1 width is 20px instead of 10px")));
                    }
                    validationListener.onAfterObject(pageRunner, pageValidation, "sub-objectA1");
                }
                validationListener.onSpecSuccess(pageRunner, pageValidation, "objectA1", new SpecHeight(between(10, 20)).withOriginalText("component: some-component.spec").withPlace(new Place("specs.spec", 12)));
            }
            validationListener.onAfterObject(pageRunner, pageValidation, "objectA1");
           
            validationListener.onAfterSection(pageRunner, pageValidation, section2);
       
        }
        validationListener.onAfterPageAction(pageRunner, action);
       
       
       
        validationListener.onBeforePageAction(pageRunner, action);
        {
            PageSection section1 = sectionWithName("some section 1");
            validationListener.onBeforeSection(pageRunner, pageValidation, section1);
           
            validationListener.onObject(pageRunner, pageValidation, "objectB1"); {
                validationListener.onSpecSuccess(pageRunner, pageValidation, "objectB1", new SpecWidth(between(10, 20)).withOriginalText("width: 10 to 20px").withPlace(new Place("specs.spec", 12)));
               
                validationListener.onSpecError(pageRunner, pageValidation,
                        "objectB1",
                        new SpecInside("other-object", asList(new Location(exact(10), asList(LEFT)))).withOriginalText("inside: other-object 10px left")
                            .withPlace(new Place("specs.spec", 12)),
                        new ValidationError(asList(new ErrorArea(new Rect(10, 10, 100, 50), "objectB1")), asList("objectB1 is not inside other-object", "second error message with <xml> &tags"))
                            .withImageComparisonSample(new Rect(20, 30, 100, 40), "imgs/button-sample-correct.png", Rainbow4J.loadImage(comparisonMapImagePath)));
            }
            validationListener.onAfterObject(pageRunner, pageValidation, "objectB1");
           
            validationListener.onObject(pageRunner, pageValidation, "objectB2"); {
                validationListener.onSpecSuccess(pageRunner, pageValidation, "objectB2", new SpecHeight(exact(100)).withOriginalText("height: 100px").withPlace(new Place("specs.spec", 12)));
View Full Code Here


    private Rect rect;
    private String innerText;
    private Map<String, String> cssProperties = new HashMap<String, String>();

    public MockedPageElement(int left, int top, int width, int height) {
        this.rect = new Rect(left, top, width, height);
    }
View Full Code Here

        LayoutReport layoutReport = Galen.checkLayout(driver, "/specs/galen4j/sample-spec-with-error.spec", asList("mobile"), null, new Properties(), null);

        assertThat(layoutReport.getValidationErrors(), contains(
                new ValidationError().withMessage("\"save-button\" is 10px left instead of 50px")
                        .withArea(new ErrorArea(new Rect(10, 10, 100, 50), "save-button"))
                        .withArea(new ErrorArea(new Rect(120, 10, 200, 50), "name-textfield")),
                new ValidationError().withMessage("\"save-button\" text is \"Save\" but should be \"Store\"")
                        .withArea(new ErrorArea(new Rect(10, 10, 100, 50), "save-button"))));
    }
View Full Code Here

          row(specImage(asList("/imgs/button-sample-correct.png"), 1, PIXEL_UNIT, 0, 5), page(new HashMap<String, PageElement>(){{
              put("object", element(100, 90, 100, 40));
          }}, imageComparisonTestScreenshot)),

          row(specImage(asList("/imgs/page-sample-correct.png"), 2, PIXEL_UNIT, 0, 5, new Rect(40, 40, 100, 40)), page(new HashMap<String, PageElement>() {{
              put("object", element(100, 90, 100, 40));
          }}, imageComparisonTestScreenshot)),

          row(specImage(asList("/imgs/button-sample-incorrect.png", "/imgs/button-sample-correct.png"), 1, PIXEL_UNIT, 0, 5), page(new HashMap<String, PageElement>(){{
              put("object", element(100, 90, 100, 40));
View Full Code Here

    @DataProvider
    public Object[][] provideBadSamples() {
        return new Object[][] {
          // Contains

          row(new ValidationError(areas(new ErrorArea(new Rect(9, 11, 10, 10), "menu"), new ErrorArea(new Rect(10, 10, 100, 100), "object")), messages("\"menu\" is outside \"object\"")),
              specContains(false, "menu", "button"), page(new HashMap<String, PageElement>(){{
                  put("object", element(10, 10, 100, 100));
                  put("menu", element(9, 11, 10, 10));
                  put("button", element(60, 50, 40, 40));
          }})),

          row(new ValidationError(areas(new ErrorArea(new Rect(50, 50, 110, 10), "menu"), new ErrorArea(new Rect(10, 10, 101, 40), "button"), new ErrorArea(new Rect(10, 10, 100, 100), "object")), messages("\"menu\" is outside \"object\"", "\"button\" is outside \"object\"")),
              specContains(false, "menu", "button"), page(new HashMap<String, PageElement>(){{
                  put("object", element(10, 10, 100, 100));
                  put("menu", element(50, 50, 110, 10));
                  put("button", element(10, 10, 101, 40));
          }})),

          row(new ValidationError(NO_AREA, messages("\"menu\" is not visible on page")),
              specContains(CONTAINS_FULLY, "menu", "button"), page(new HashMap<String, PageElement>(){{
                  put("object", element(10, 10, 100, 100));
                  put("menu", invisibleElement(11, 11, 10, 10));
                  put("button", element(60, 50, 40, 40));
          }})),

          row(new ValidationError(NO_AREA, messages("\"menu\" is absent on page")),
              specContains(CONTAINS_FULLY, "menu", "button"), page(new HashMap<String, PageElement>(){{
                  put("object", element(10, 10, 100, 100));
                  put("menu", absentElement(11, 11, 10, 10));
                  put("button", element(60, 50, 40, 40));
          }})),

          row(new ValidationError(areas(new ErrorArea(new Rect(350, 10, 10, 10), "menu-item-3"), new ErrorArea(new Rect(0, 0, 200, 100), "object")), messages("\"menu-item-3\" is outside \"object\"")),
                  specContains(CONTAINS_FULLY, "menu-item-*", "button"), page(new HashMap<String, PageElement>(){{
                      put("object", element(0, 0, 200, 100));
                      put("menu-item-1", element(10, 10, 10, 10));
                      put("menu-item-2", element(30, 10, 10, 10));
                      put("menu-item-3", element(350, 10, 10, 10));
                      put("button", element(70, 10, 10, 10));
          }})),
          row(new ValidationError(NO_AREA, messages("There are no objects matching: menu-item-*")),
                  specContains(CONTAINS_FULLY, "menu-item-*", "button"), page(new HashMap<String, PageElement>(){{
                      put("object", element(0, 0, 200, 100));
                      put("button", element(70, 10, 10, 10));
          }})),

          // Absent

          row(new ValidationError(singleArea(new Rect(10, 10, 100, 100), "object"), messages("\"object\" is not absent on page")),
              specAbsent(), page(new HashMap<String, PageElement>(){{
                  put("object", element(10, 10, 100, 100));
          }})),

          row(new ValidationError(NO_AREA, messages("Cannot find locator for \"object\" in page spec")),
              specAbsent(), page(new HashMap<String, PageElement>(){{
                  put("blabla", absentElement(10, 10, 100, 100));
          }})),

          // Visible

          row(new ValidationError(NO_AREA, messages("\"object\" is not visible on page")),
              specVisible(), page(new HashMap<String, PageElement>(){{
                  put("object", invisibleElement(10, 10, 100, 100));
          }})),

          row(new ValidationError(NO_AREA, messages("Cannot find locator for \"object\" in page spec")),
              specVisible(), page(new HashMap<String, PageElement>(){{
                  put("blabla", absentElement(10, 10, 100, 100));
          }})),

          row(new ValidationError(NO_AREA, messages("\"object\" is absent on page")),
                  specVisible(), page(new HashMap<String, PageElement>(){{
                  put("object", absentElement(10, 10, 100, 100));
              }})),



          // Inside
         
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 10, 500, 50), "object"), new ErrorArea(new Rect(0, 0, 130, 120), "container")),
                  messages("\"object\" is not completely inside")),
              specInside("container", location(exact(10), LEFT)), page(new HashMap<String, PageElement>(){{
                  put("object", element(10, 10, 500, 50));
                  put("container", element(0, 0, 130, 120));
          }})),
         
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 10, 500, 50), "object"), new ErrorArea(new Rect(0, 0, 130, 120), "container")),
                  messages("\"object\" is not completely inside")),
              specInside("container", location(exact(10), LEFT)), page(new HashMap<String, PageElement>(){{
                  put("object", element(10, 10, 500, 50));
                  put("container", element(0, 0, 130, 120));
          }})),
         
          row(new ValidationError(areas(new ErrorArea(new Rect(190, 110, 500, 500), "object"), new ErrorArea(new Rect(10, 10, 100, 100), "container")),
                  messages("\"object\" is 180px left instead of 10px")),
              specInsidePartly("container", location(exact(10), LEFT)), page(new HashMap<String, PageElement>(){{
                  put("object", element(190, 110, 500, 500));
                  put("container", element(10, 10, 100, 100));
          }})),
         
          row(new ValidationError(areas(new ErrorArea(new Rect(30, 10, 50, 50), "object"), new ErrorArea(new Rect(0, 0, 130, 120), "container")),
                  messages("\"object\" is 30px left instead of 10px")),
              specInside("container", location(exact(10), LEFT)), page(new HashMap<String, PageElement>(){{
                  put("object", element(30, 10, 50, 50));
                  put("container", element(0, 0, 130, 120));
          }})),
         
          row(new ValidationError(areas(new ErrorArea(new Rect(30, 20, 50, 50), "object"), new ErrorArea(new Rect(0, 0, 130, 120), "container")),
                  messages("\"object\" is 30px left and 20px top instead of 10px")),
                  specInside("container", location(exact(10), LEFT, TOP)), page(new HashMap<String, PageElement>(){{
                      put("object", element(30, 20, 50, 50));
                      put("container", element(0, 0, 130, 120));
              }})),
         
          row(new ValidationError(areas(new ErrorArea(new Rect(30, 10, 50, 50), "object"), new ErrorArea(new Rect(0, 0, 130, 120), "container")),
                  messages("\"object\" is 50px right instead of 10px")),
              specInside("container", location(exact(10), RIGHT)), page(new HashMap<String, PageElement>(){{
                  put("object", element(30, 10, 50, 50));
                  put("container", element(0, 0, 130, 120));
          }})),
         
          row(new ValidationError(areas(new ErrorArea(new Rect(30, 20, 50, 50), "object"), new ErrorArea(new Rect(0, 0, 130, 120), "container")),
                  messages("\"object\" is 20px top instead of 10px")),
              specInside("container", location(exact(10), TOP)), page(new HashMap<String, PageElement>(){{
                  put("object", element(30, 20, 50, 50));
                  put("container", element(0, 0, 130, 120));
          }})),
         
          row(new ValidationError(areas(new ErrorArea(new Rect(30, 10, 50, 50), "object"), new ErrorArea(new Rect(0, 0, 130, 120), "container")), messages("\"object\" is 60px bottom instead of 10px")),
              specInside("container", location(exact(10), BOTTOM)), page(new HashMap<String, PageElement>(){{
                  put("object", element(30, 10, 50, 50));
                  put("container", element(0, 0, 130, 120));
          }})),
         
          row(new ValidationError(areas(new ErrorArea(new Rect(30, 10, 50, 50), "object"), new ErrorArea(new Rect(0, 0, 130, 120), "container")), messages("\"object\" is 30px left which is not in range of 10 to 20px")),
              specInside("container", location(between(10, 20), LEFT)), page(new HashMap<String, PageElement>(){{
                  put("object", element(30, 10, 50, 50));
                  put("container", element(0, 0, 130, 120));
          }})),
         
          row(new ValidationError(NO_AREA, messages("Cannot find locator for \"container\" in page spec")),
              specInside("container", location(between(10, 20), LEFT)), page(new HashMap<String, PageElement>(){{
                  put("object", element(30, 10, 50, 50));
          }})),
         
          row(new ValidationError(areas(new ErrorArea(new Rect(30, 5, 50, 50), "object"), new ErrorArea(new Rect(0, 0, 130, 120), "container")),
                  messages("\"object\" is 30px left instead of 10px, is 5px top instead of 20px")),
              specInside("container", location(exact(10), LEFT), location(exact(20), TOP)), page(new HashMap<String, PageElement>(){{
                  put("object", element(30, 5, 50, 50));
                  put("container", element(0, 0, 130, 120));
          }})),
         
          row(new ValidationError(areas(new ErrorArea(new Rect(30, 5, 10, 50), "object"), new ErrorArea(new Rect(0, 0, 50, 120), "container")), messages("\"object\" is 30px left instead of 10px")),
                  specInside("container", location(exact(20).withPercentOf("container/width"), LEFT)), page(new HashMap<String, PageElement>(){{
                      put("object", element(30, 5, 10, 50));
                      put("container", element(0, 0, 50, 120));
          }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(30, 5, 10, 50), "object"), new ErrorArea(new Rect(0, 0, 50, 120), "container")), messages("\"object\" is 30px left which is not in range of 10 to 20px")),
                  specInside("container", location(between(20, 40).withPercentOf("container/width"), LEFT)), page(new HashMap<String, PageElement>(){{
                      put("object", element(30, 5, 10, 50));
                      put("container", element(0, 0, 50, 120));
          }})),
         
          row(new ValidationError(NO_AREA, messages("\"object\" is absent on page")),
              specInside("container", location(exact(10), LEFT), location(exact(20), TOP)), page(new HashMap<String, PageElement>(){{
                  put("object", absentElement(30, 5, 50, 50));
                  put("container", element(0, 0, 130, 120));
          }})),
         
          row(new ValidationError(NO_AREA, messages("\"object\" is not visible on page")),
              specInside("container", location(exact(10), LEFT), location(exact(20), TOP)), page(new HashMap<String, PageElement>(){{
                  put("object", invisibleElement(30, 5, 50, 50));
                  put("container", element(0, 0, 130, 120));
          }})),
         
          row(new ValidationError(NO_AREA, messages("\"container\" is absent on page")),
              specInside("container", location(exact(10), LEFT), location(exact(20), TOP)), page(new HashMap<String, PageElement>(){{
                  put("object", element(30, 5, 50, 50));
                  put("container", absentElement(0, 0, 130, 120));
          }})),
         
          row(new ValidationError(NO_AREA, messages("\"container\" is not visible on page")),
              specInside("container", location(exact(10), LEFT), location(exact(20), TOP)), page(new HashMap<String, PageElement>(){{
                  put("object", element(30, 5, 50, 50));
                  put("container", invisibleElement(0, 0, 130, 120));
          }})),
         
         
          // Near
          row(new ValidationError(areas(new ErrorArea(new Rect(90, 5, 100, 50), "object"), new ErrorArea(new Rect(200, 200, 100, 50), "button")),
                  messages("\"object\" is 10px left instead of 30px")),
                  specNear("button", location(exact(30), LEFT)), page(new HashMap<String, PageElement>(){{
                      put("object", element(90, 5, 100, 50));
                      put("button", element(200, 200, 100, 50));
          }})),
         
          row(new ValidationError(areas(new ErrorArea(new Rect(90, 5, 100, 50), "object"), new ErrorArea(new Rect(200, 200, 100, 50), "button")),
                  messages("\"object\" is 10px left which is not in range of 20 to 30px")),
                  specNear("button", location(between(20, 30), LEFT)), page(new HashMap<String, PageElement>(){{
                      put("object", element(90, 5, 100, 50));
                      put("button", element(200, 200, 100, 50));
          }})),
             
          row(new ValidationError(areas(new ErrorArea(new Rect(90, 130, 100, 50), "object"), new ErrorArea(new Rect(200, 200, 100, 50), "button")),
                  messages("\"object\" is 10px left and 20px top instead of 30px")),
                  specNear("button", location(exact(30), LEFT, TOP)), page(new HashMap<String, PageElement>(){{
                      put("object", element(90, 130, 100, 50));
                      put("button", element(200, 200, 100, 50));
          }})),
         
          row(new ValidationError(areas(new ErrorArea(new Rect(310, 250, 100, 50), "object"), new ErrorArea(new Rect(200, 200, 100, 50), "button")),
                  messages("\"object\" is 10px right instead of 30px, is 0px bottom which is not in range of 10 to 20px")),
                  specNear("button", location(exact(30), RIGHT), location(between(10, 20), BOTTOM)), page(new HashMap<String, PageElement>(){{
                      put("object", element(310, 250, 100, 50));
                      put("button", element(200, 200, 100, 50));
          }})),
         
         
          row(new ValidationError(areas(new ErrorArea(new Rect(90, 130, 100, 50), "object"), new ErrorArea(new Rect(200, 200, 50, 50), "button")),
                  messages("\"object\" is 10px left instead of 20px")),
                  specNear("button", location(exact(40).withPercentOf("button/width"), LEFT)), page(new HashMap<String, PageElement>(){{
                      put("object", element(90, 130, 100, 50));
                      put("button", element(200, 200, 50, 50));
          }})),
         
          row(new ValidationError(areas(new ErrorArea(new Rect(90, 130, 100, 50), "object"), new ErrorArea(new Rect(200, 200, 50, 50), "button")),
                  messages("\"object\" is 10px left which is not in range of 20 to 25px")),
                  specNear("button", location(between(40, 50).withPercentOf("button/area/width"), LEFT)), page(new HashMap<String, PageElement>(){{
                      put("object", element(90, 130, 100, 50));
                      put("button", element(200, 200, 50, 50));
          }})),
         
          row(new ValidationError(NO_AREA, messages("\"object\" is absent on page")),
                  specNear("button", location(exact(30), RIGHT), location(between(10, 20), BOTTOM)), page(new HashMap<String, PageElement>(){{
                      put("object", absentElement(310, 250, 100, 50));
                      put("button", element(200, 200, 100, 50));
          }})),
         
          row(new ValidationError(NO_AREA, messages("\"object\" is not visible on page")),
                  specNear("button", location(exact(30), RIGHT), location(between(10, 20), BOTTOM)), page(new HashMap<String, PageElement>(){{
                      put("object", invisibleElement(310, 250, 100, 50));
                      put("button", element(200, 200, 100, 50));
          }})),
         
          row(new ValidationError(NO_AREA, messages("\"button\" is absent on page")),
                  specNear("button", location(exact(30), RIGHT), location(between(10, 20), BOTTOM)), page(new HashMap<String, PageElement>(){{
                      put("object", element(310, 250, 100, 50));
                      put("button", absentElement(200, 200, 100, 50));
          }})),
         
          row(new ValidationError(NO_AREA, messages("\"button\" is not visible on page")),
                  specNear("button", location(exact(30), RIGHT), location(between(10, 20), BOTTOM)), page(new HashMap<String, PageElement>(){{
                      put("object", element(310, 250, 100, 50));
                      put("button", invisibleElement(200, 200, 100, 50));
          }})),
         
          row(new ValidationError(NO_AREA, messages("Cannot find locator for \"button\" in page spec")),
                  specNear("button", location(exact(30), RIGHT), location(between(10, 20), BOTTOM)), page(new HashMap<String, PageElement>(){{
                      put("object", element(310, 250, 100, 50));
          }})),
         
          row(new ValidationError(NO_AREA, messages("Cannot find locator for \"object\" in page spec")),
                  specNear("button", location(exact(30), RIGHT), location(between(10, 20), BOTTOM)), page(new HashMap<String, PageElement>(){{
                      put("button", absentElement(200, 200, 100, 50));
          }})),
         
         
          // Width
         
          row(new ValidationError(NO_AREA, messages("Cannot find locator for \"object\" in page spec")),
                  specWidth(Range.exact(10)), page(new HashMap<String, PageElement>())),
                 
          row(new ValidationError(NO_AREA, messages("\"object\" is absent on page")),
                  specWidth(Range.exact(10)), page(new HashMap<String, PageElement>(){{
                      put("object", absentElement(310, 250, 100, 50));
          }})),
         
          row(new ValidationError(NO_AREA, messages("\"object\" is not visible on page")),
                  specWidth(Range.exact(10)), page(new HashMap<String, PageElement>(){{
                      put("object", invisibleElement(310, 250, 100, 50));
          }})),
         
          row(new ValidationError(singleArea(new Rect(100, 100, 100, 50), "object"), messages("\"object\" width is 100px instead of 10px")),
                  specWidth(Range.exact(10)), page(new HashMap<String, PageElement>(){{
                      put("object", element(100, 100, 100, 50));
          }})),
         
          row(new ValidationError(singleArea(new Rect(100, 100, 100, 50), "object"), messages("\"object\" width is 100px but it should be greater than 110px")),
                  specWidth(Range.greaterThan(110.0)), page(new HashMap<String, PageElement>(){{
                      put("object", element(100, 100, 100, 50));
          }})),
          row(new ValidationError(singleArea(new Rect(100, 100, 100, 50), "object"), messages("\"object\" width is 100px but it should be less than 90px")),
                  specWidth(Range.lessThan(90.0)), page(new HashMap<String, PageElement>(){{
                      put("object", element(100, 100, 100, 50));
          }})),
         
          row(new ValidationError(singleArea(new Rect(100, 100, 100, 50), "object"), messages("\"object\" width is 100px which is not in range of 10 to 40px")),
                  specWidth(Range.between(10, 40)), page(new HashMap<String, PageElement>(){{
                      put("object", element(100, 100, 100, 50));
          }})),
         
          row(new ValidationError(singleArea(new Rect(100, 100, 100, 50), "object"), messages("\"object\" width is 100px instead of 20px")),
                  specWidth(exact(10).withPercentOf("container/width")), page(new HashMap<String, PageElement>(){{
                      put("object", element(100, 100, 100, 50));
                      put("container", element(100, 100, 200, 50));
          }})),
         
          row(new ValidationError(singleArea(new Rect(100, 100, 100, 50), "object"), messages("\"object\" width is 100px which is not in range of 20 to 40px")),
                  specWidth(between(10, 20).withPercentOf("container/width")), page(new HashMap<String, PageElement>(){{
                      put("object", element(100, 100, 100, 50));
                      put("container", element(100, 100, 200, 50));
          }})),
         
         
          // Height
         
          row(new ValidationError(NO_AREA, messages("Cannot find locator for \"object\" in page spec")),
                  specHeight(Range.exact(10)), page(new HashMap<String, PageElement>())),
                 
          row(new ValidationError(NO_AREA, messages("\"object\" is absent on page")),
                  specHeight(Range.exact(10)), page(new HashMap<String, PageElement>(){{
                      put("object", absentElement(310, 250, 100, 50));
          }})),
         
          row(new ValidationError(NO_AREA, messages("\"object\" is not visible on page")),
                  specHeight(Range.exact(10)), page(new HashMap<String, PageElement>(){{
                      put("object", invisibleElement(310, 250, 100, 50));
          }})),
         
          row(new ValidationError(singleArea(new Rect(100, 100, 100, 50), "object"), messages("\"object\" height is 50px instead of 10px")),
                  specHeight(Range.exact(10)), page(new HashMap<String, PageElement>(){{
                      put("object", element(100, 100, 100, 50));
          }})),
         
          row(new ValidationError(singleArea(new Rect(100, 100, 100, 50), "object"), messages("\"object\" height is 50px which is not in range of 10 to 40px")),
                  specHeight(Range.between(10, 40)), page(new HashMap<String, PageElement>(){{
                      put("object", element(100, 100, 100, 50));
          }})),
         
          row(new ValidationError(singleArea(new Rect(100, 100, 100, 50), "object"), messages("\"object\" height is 50px instead of 20px")),
                  specHeight(exact(10).withPercentOf("container/height")), page(new HashMap<String, PageElement>(){{
                      put("object", element(100, 100, 100, 50));
                      put("container", element(100, 100, 100, 200));
          }})),
         
          row(new ValidationError(singleArea(new Rect(100, 100, 100, 50), "object"), messages("\"object\" height is 50px which is not in range of 20 to 30px")),
                  specHeight(between(10, 15).withPercentOf("container/height")), page(new HashMap<String, PageElement>(){{
                      put("object", element(100, 100, 100, 50));
                      put("container", element(100, 100, 100, 200));
          }})),
         
          // Horizontally
         
          row(new ValidationError(NO_AREA, messages("Cannot find locator for \"item\" in page spec")),
                  specHorizontally(Alignment.CENTERED, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 50, 10));
          }})),
          row(new ValidationError(NO_AREA, messages("\"item\" is not visible on page")),
                  specHorizontally(Alignment.CENTERED, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 50, 10));
                      put("item", invisibleElement(10, 10, 10, 20));
          }})),
          row(new ValidationError(NO_AREA, messages("\"item\" is absent on page")),
                  specHorizontally(Alignment.CENTERED, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 50, 10));
                      put("item", absentElement(10, 10, 10, 15));
          }})),
          row(new ValidationError(NO_AREA, messages("Cannot find locator for \"object\" in page spec")),
                  specHorizontally(Alignment.CENTERED, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("item", element(10, 10, 50, 10));
          }})),
          row(new ValidationError(NO_AREA, messages("\"object\" is not visible on page")),
                  specHorizontally(Alignment.CENTERED, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", invisibleElement(10, 10, 50, 10));
                      put("item", element(10, 10, 10, 15));
          }})),
          row(new ValidationError(NO_AREA, messages("\"object\" is absent on page")),
                  specHorizontally(Alignment.CENTERED, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", absentElement(10, 10, 50, 10));
                      put("item", element(10, 10, 10, 15));
          }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 10, 50, 10), "object"), new ErrorArea(new Rect(10, 10, 10, 15), "item")),
                  messages("\"item\" is not aligned horizontally centered with \"object\". Offset is 2px")),
                  specHorizontally(Alignment.CENTERED, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 50, 10));
                      put("item", element(10, 10, 10, 15));
          }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 10, 50, 10), "object"), new ErrorArea(new Rect(10, 10, 10, 20), "item")),
                  messages("\"item\" is not aligned horizontally centered with \"object\". Offset is 5px")),
                  specHorizontally(Alignment.CENTERED, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 50, 10));
                      put("item", element(10, 10, 10, 20));
          }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 15, 10, 10), "object"), new ErrorArea(new Rect(10, 10, 10, 20), "item")),
                  messages("\"item\" is not aligned horizontally top with \"object\". Offset is 5px")),
                  specHorizontally(Alignment.TOP, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 15, 10, 10));
                      put("item", element(10, 10, 10, 20));
          }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 10, 10, 10), "object"), new ErrorArea(new Rect(10, 10, 10, 5), "item")),
                  messages("\"item\" is not aligned horizontally bottom with \"object\". Offset is 5px")),
                  specHorizontally(Alignment.BOTTOM, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 10, 10));
                      put("item", element(10, 10, 10, 5));
          }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 10, 10, 10), "object"), new ErrorArea(new Rect(30, 10, 10, 5), "item")),
                  messages("\"item\" is not aligned horizontally all with \"object\". Offset is 5px")),
                  specHorizontally(Alignment.ALL, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 10, 10));
                      put("item", element(30, 10, 10, 5));
          }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 10, 10, 10), "object"), new ErrorArea(new Rect(30, 10, 15, 5), "item")),
                  messages("\"item\" is not aligned horizontally all with \"object\". Offset is 5px")),
                  specHorizontally(Alignment.ALL, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 10, 10));
                      put("item", element(30, 10, 15, 5));
          }})),
         
         
          // Vertically
         
          row(new ValidationError(NO_AREA, messages("Cannot find locator for \"item\" in page spec")),
                  specVertically(Alignment.CENTERED, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 50, 10));
          }})),
          row(new ValidationError(NO_AREA, messages("\"item\" is not visible on page")),
                  specVertically(Alignment.CENTERED, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 50, 10));
                      put("item", invisibleElement(10, 10, 10, 20));
          }})),
          row(new ValidationError(NO_AREA, messages("\"item\" is absent on page")),
                  specVertically(Alignment.CENTERED, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 50, 10));
                      put("item", absentElement(10, 10, 10, 15));
          }})),
          row(new ValidationError(NO_AREA, messages("Cannot find locator for \"object\" in page spec")),
                  specVertically(Alignment.CENTERED, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("item", element(10, 10, 50, 10));
          }})),
          row(new ValidationError(NO_AREA, messages("\"object\" is not visible on page")),
                  specVertically(Alignment.CENTERED, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", invisibleElement(10, 10, 50, 10));
                      put("item", element(10, 10, 10, 20));
          }})),
          row(new ValidationError(NO_AREA, messages("\"object\" is absent on page")),
                  specVertically(Alignment.CENTERED, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", absentElement(10, 10, 50, 10));
                      put("item", element(10, 10, 10, 20));
          }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 10, 20, 10), "object"), new ErrorArea(new Rect(10, 20, 10, 10), "item")),
                  messages("\"item\" is not aligned vertically centered with \"object\". Offset is 5px")),
                  specVertically(Alignment.CENTERED, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 20, 10));
                      put("item", element(10, 20, 10, 10));
          }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 10, 20, 10), "object"), new ErrorArea(new Rect(5, 20, 10, 10), "item")),
                  messages("\"item\" is not aligned vertically left with \"object\". Offset is 5px")),
                  specVertically(Alignment.LEFT, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 20, 10));
                      put("item", element(5, 20, 10, 10));
          }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 10, 20, 10), "object"), new ErrorArea(new Rect(10, 30, 10, 10), "item")),
                  messages("\"item\" is not aligned vertically right with \"object\". Offset is 10px")),
                  specVertically(Alignment.RIGHT, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 20, 10));
                      put("item", element(10, 30, 10, 10));
          }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 10, 10, 10), "object"), new ErrorArea(new Rect(10, 30, 5, 10), "item")),
                  messages("\"item\" is not aligned vertically all with \"object\". Offset is 5px")),
                  specVertically(Alignment.ALL, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 10, 10));
                      put("item", element(10, 30, 5, 10));
          }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 10, 10, 10), "object"), new ErrorArea(new Rect(15, 30, 5, 10), "item")),
                  messages("\"item\" is not aligned vertically all with \"object\". Offset is 5px")),
                  specVertically(Alignment.ALL, "item", 0), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 10, 10));
                      put("item", element(15, 30,   5, 10));
          }})),
         
         
          // Text validation
         
          row(new ValidationError(NO_AREA, messages("Cannot find locator for \"object\" in page spec")),
                  specTextIs("some wrong text"),
                  page(new HashMap<String, PageElement>())),
                 
          row(new ValidationError(NO_AREA, messages("\"object\" is not visible on page")),
                  specTextIs("some wrong text"),
                  page(new HashMap<String, PageElement>(){{
                      put("object", invisibleElement(10, 10, 10, 10));
          }})),
         
          row(new ValidationError(NO_AREA, messages("\"object\" is absent on page")),
                  specTextIs("some wrong text"),
                  page(new HashMap<String, PageElement>(){{
                      put("object", absentElement(10, 10, 10, 10));
          }})),
         
          row(new ValidationError(singleArea(new Rect(10, 10, 10, 10), "object"), messages("\"object\" text is \"Some text\" but should be \"some wrong text\"")),
                  specTextIs("some wrong text"),
                  page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 10, 10).withText("Some text"));
          }})),
         
          row(new ValidationError(singleArea(new Rect(10, 10, 10, 10), "object"), messages("\"object\" text is \"Some text\" but should contain \"good\"")),
                  specTextContains("good"),
                  page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 10, 10).withText("Some text"));
          }})),
         
          row(new ValidationError(singleArea(new Rect(10, 10, 10, 10), "object"), messages("\"object\" text is \"Some text\" but should start with \"text\"")),
                  specTextStarts("text"),
                  page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 10, 10).withText("Some text"));
          }})),
         
          row(new ValidationError(singleArea(new Rect(10, 10, 10, 10), "object"), messages("\"object\" text is \"Some text\" but should end with \"Some\"")),
                  specTextEnds("Some"),
                  page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 10, 10).withText("Some text"));
          }})),
         
          row(new ValidationError(singleArea(new Rect(10, 10, 10, 10), "object"), messages("\"object\" text is \"Some text\" but should match \"Some [0-9]+ text\"")),
                  specTextMatches("Some [0-9]+ text"),
                  page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 10, 10).withText("Some text"));
          }})),


          // Css
            row(new ValidationError(NO_AREA, messages("Cannot find locator for \"object\" in page spec")),
                    new SpecCss("font-size", SpecText.Type.IS, "some wrong text"),
                    page(new HashMap<String, PageElement>())),

            row(new ValidationError(NO_AREA, messages("\"object\" is not visible on page")),
                    new SpecCss("font-size", SpecText.Type.IS, "some wrong text"),
                    page(new HashMap<String, PageElement>(){{
                        put("object", invisibleElement(10, 10, 10, 10));
                    }})),

            row(new ValidationError(NO_AREA, messages("\"object\" is absent on page")),
                    new SpecCss("font-size", SpecText.Type.IS, "some wrong text"),
                    page(new HashMap<String, PageElement>(){{
                        put("object", absentElement(10, 10, 10, 10));
                    }})),

            row(new ValidationError(singleArea(new Rect(10, 10, 10, 10), "object"), messages("\"object\" css property \"font-size\" is \"18px\" but should be \"19px\"")),
                    new SpecCss("font-size", SpecText.Type.IS, "19px"),
                    page(new HashMap<String, PageElement>(){{
                        put("object", elementWithCss("font-size", "18px"));
                    }})),

            row(new ValidationError(singleArea(new Rect(10, 10, 10, 10), "object"), messages("\"object\" css property \"font-size\" is \"18px\" but should start with \"19\"")),
                    new SpecCss("font-size", SpecText.Type.STARTS, "19"),
                    page(new HashMap<String, PageElement>(){{
                        put("object", elementWithCss("font-size", "18px"));
                    }})),

            row(new ValidationError(singleArea(new Rect(10, 10, 10, 10), "object"), messages("\"object\" css property \"font-size\" is \"18px\" but should end with \"em\"")),
                    new SpecCss("font-size", SpecText.Type.ENDS, "em"),
                    page(new HashMap<String, PageElement>(){{
                        put("object", elementWithCss("font-size", "18px"));
                    }})),

            row(new ValidationError(singleArea(new Rect(10, 10, 10, 10), "object"), messages("\"object\" css property \"font-size\" is \"18px\" but should contain \"9\"")),
                    new SpecCss("font-size", SpecText.Type.CONTAINS, "9"),
                    page(new HashMap<String, PageElement>(){{
                        put("object", elementWithCss("font-size", "18px"));
                    }})),

            row(new ValidationError(singleArea(new Rect(10, 10, 10, 10), "object"), messages("\"object\" css property \"font-size\" is \"18px\" but should match \"[0-9]+em\"")),
                    new SpecCss("font-size", SpecText.Type.MATCHES, "[0-9]+em"),
                    page(new HashMap<String, PageElement>(){{
                        put("object", elementWithCss("font-size", "18px"));
                    }})),

          // Above
         
          row(new ValidationError(NO_AREA, messages("\"object\" is not visible on page")),
                  specAbove("button", exact(20)), page(new HashMap<String, PageElement>(){{
                      put("object", invisibleElement(10, 40, 10, 10));
                      put("button", element(10, 60, 10, 10));
              }})),
          row(new ValidationError(NO_AREA, messages("\"object\" is absent on page")),
                  specAbove("button", exact(20)), page(new HashMap<String, PageElement>(){{
                      put("object", absentElement(10, 40, 10, 10));
                      put("button", element(10, 60, 10, 10));
              }})),   
          row(new ValidationError(NO_AREA, messages("\"button\" is not visible on page")),
                  specAbove("button", exact(20)), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 40, 10, 10));
                      put("button", invisibleElement(10, 60, 10, 10));
              }})),
          row(new ValidationError(NO_AREA, messages("\"button\" is absent on page")),
                  specAbove("button", exact(20)), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 40, 10, 10));
                      put("button", absentElement(10, 60, 10, 10));
              }})),   
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 40, 10, 10), "object"), new ErrorArea(new Rect(10, 60, 10, 10), "button")),
                  messages("\"object\" is 10px above \"button\" instead of 20px")),
                  specAbove("button", exact(20)), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 40, 10, 10));
                      put("button", element(10, 60, 10, 10));
              }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 40, 10, 10), "object"), new ErrorArea(new Rect(10, 60, 10, 10), "button")),
                  messages("\"object\" is 10px above \"button\" which is not in range of 20 to 30px")),
                  specAbove("button", between(20, 30)), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 40, 10, 10));
                      put("button", element(10, 60, 10, 10));
              }})),
             
             
          // Below
             
          row(new ValidationError(NO_AREA, messages("\"object\" is not visible on page")),
                  specBelow("button", exact(20)), page(new HashMap<String, PageElement>(){{
                      put("object", invisibleElement(10, 40, 10, 10));
                      put("button", element(10, 60, 10, 10));
              }})),
          row(new ValidationError(NO_AREA, messages("\"object\" is absent on page")),
                  specBelow("button", exact(20)), page(new HashMap<String, PageElement>(){{
                      put("object", absentElement(10, 40, 10, 10));
                      put("button", element(10, 60, 10, 10));
              }})),   
          row(new ValidationError(NO_AREA, messages("\"button\" is not visible on page")),
                  specBelow("button", exact(20)), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 40, 10, 10));
                      put("button", invisibleElement(10, 60, 10, 10));
              }})),
          row(new ValidationError(NO_AREA, messages("\"button\" is absent on page")),
                  specBelow("button", exact(20)), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 40, 10, 10));
                      put("button", absentElement(10, 60, 10, 10));
              }})),   
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 60, 10, 10), "object"), new ErrorArea(new Rect(10, 40, 10, 10), "button")),
                  messages("\"object\" is 10px below \"button\" instead of 20px")),
                  specBelow("button", exact(20)), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 60, 10, 10));
                      put("button", element(10, 40, 10, 10));
              }})),
              row(new ValidationError(areas(new ErrorArea(new Rect(10, 60, 10, 10), "object"), new ErrorArea(new Rect(10, 40, 10, 10), "button")),
                  messages("\"object\" is 10px below \"button\" which is not in range of 20 to 30px")),
                  specBelow("button", between(20, 30)), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 60, 10, 10));
                      put("button", element(10, 40, 10, 10));
              }})),
             
     
          // Centered
     
          row(new ValidationError(NO_AREA, messages("\"object\" is not visible on page")),
                  specCenteredInside("container", SpecCentered.Alignment.ALL), page(new HashMap<String, PageElement>(){{
                      put("object", invisibleElement(10, 40, 10, 10));
                      put("container", element(10, 60, 10, 10));
              }})),
          row(new ValidationError(NO_AREA, messages("\"object\" is absent on page")),
                  specCenteredInside("container", SpecCentered.Alignment.ALL), page(new HashMap<String, PageElement>(){{
                      put("object", absentElement(10, 40, 10, 10));
                      put("container", element(10, 60, 10, 10));
              }})),
          row(new ValidationError(NO_AREA, messages("\"container\" is absent on page")),
                  specCenteredInside("container", SpecCentered.Alignment.ALL), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 40, 10, 10));
                      put("container", absentElement(10, 60, 10, 10));
              }})),
          row(new ValidationError(NO_AREA, messages("\"container\" is not visible on page")),
                  specCenteredInside("container", SpecCentered.Alignment.ALL), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 40, 10, 10));
                      put("container", invisibleElement(10, 60, 10, 10));
              }})),
                     
          row(new ValidationError(areas(new ErrorArea(new Rect(20, 20, 80, 60), "object"), new ErrorArea(new Rect(0, 0, 100, 100), "container")),
                  messages("\"object\" is not centered horizontally inside \"container\". Offset is 20px")),
                  specCenteredInside("container", SpecCentered.Alignment.ALL), page(new HashMap<String, PageElement>(){{
                      put("object", element(20, 20, 80, 60));
                      put("container", element(0, 0, 100, 100));
              }})),
             
             
          row(new ValidationError(areas(new ErrorArea(new Rect(20, 20, 75, 60), "object"), new ErrorArea(new Rect(0, 0, 100, 100), "container")),
                  messages("\"object\" is not centered horizontally inside \"container\". Offset is 15px")),
                  specCenteredInside("container", SpecCentered.Alignment.HORIZONTALLY, 10), page(new HashMap<String, PageElement>(){{
                      put("object", element(20, 20, 75, 60));
                      put("container", element(0, 0, 100, 100));
              }})),   
       
          row(new ValidationError(areas(new ErrorArea(new Rect(0, 20, 120, 60), "object"), new ErrorArea(new Rect(10, 10, 100, 100), "container")),
                  messages("\"object\" is centered but not horizontally inside \"container\"")),
                  specCenteredInside("container", SpecCentered.Alignment.ALL), page(new HashMap<String, PageElement>(){{
                      put("object", element(0, 20, 120, 60));
                      put("container", element(10, 10, 100, 100));
                  }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(20, 10, 100, 60), "object"), new ErrorArea(new Rect(10, 10, 100, 100), "container")),
                  messages("\"object\" is not centered vertically inside \"container\". Offset is 40px")),
                  specCenteredInside("container", SpecCentered.Alignment.VERTICALLY), page(new HashMap<String, PageElement>(){{
                      put("object", element(20, 10, 100, 60));
                      put("container", element(10, 10, 100, 100));
                  }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(20, 10, 10, 60), "object"), new ErrorArea(new Rect(10, 10, 100, 100), "container")),
                  messages("\"object\" is not centered horizontally inside \"container\". Offset is 70px")),
                  specCenteredInside("container", SpecCentered.Alignment.HORIZONTALLY), page(new HashMap<String, PageElement>(){{
                      put("object", element(20, 10, 10, 60));
                      put("container", element(10, 10, 100, 100));
                  }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(20, 10, 10, 60), "object"), new ErrorArea(new Rect(10, 10, 100, 100), "container")),
                  messages("\"object\" is not centered vertically on \"container\". Offset is 40px")),
                  specCenteredOn("container", SpecCentered.Alignment.VERTICALLY), page(new HashMap<String, PageElement>(){{
                      put("object", element(20, 10, 10, 60));
                      put("container", element(10, 10, 100, 100));
                  }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(20, 10, 10, 60), "object"), new ErrorArea(new Rect(10, 10, 100, 100), "container")),
                  messages("\"object\" is not centered horizontally on \"container\". Offset is 70px")),
                  specCenteredOn("container", SpecCentered.Alignment.HORIZONTALLY), page(new HashMap<String, PageElement>(){{
                      put("object", element(20, 10, 10, 60));
                      put("container", element(10, 10, 100, 100));
                  }})),
         
                 
           // On
          row(new ValidationError(NO_AREA, messages("\"object\" is not visible on page")),
                  specOn(TOP, LEFT, "container", location(exact(10), LEFT, BOTTOM)), page(new HashMap<String, PageElement>(){{
                      put("object", invisibleElement(10, 40, 50, 50));
                      put("container", element(100, 100, 100, 100));
              }})),
          row(new ValidationError(NO_AREA, messages("\"object\" is absent on page")),
                  specOn(TOP, LEFT, "container", location(exact(10), LEFT, BOTTOM)), page(new HashMap<String, PageElement>(){{
                      put("object", absentElement(10, 40, 50, 50));
                      put("container", element(100, 100, 100, 100));
              }})),
          row(new ValidationError(NO_AREA, messages("\"container\" is not visible on page")),
                  specOn(TOP, LEFT, "container", location(exact(10), LEFT, BOTTOM)), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 40, 50, 50));
                      put("container", invisibleElement(100, 100, 100, 100));
              }})),
          row(new ValidationError(NO_AREA, messages("\"container\" is absent on page")),
                  specOn(TOP, LEFT, "container", location(exact(10), LEFT, BOTTOM)), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 40, 50, 50));
                      put("container", absentElement(100, 100, 100, 100));
              }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(95, 110, 50, 50), "object"), new ErrorArea(new Rect(100, 100, 100, 100), "container")),
                  messages("\"object\" is 5px left instead of 10px")),
                  specOn(TOP, LEFT, "container", location(exact(10), LEFT, BOTTOM)), page(new HashMap<String, PageElement>(){{
                      put("object", element(95, 110, 50, 50));
                      put("container", element(100, 100, 100, 100));
              }})),
          row(new ValidationError(areas(new ErrorArea(new Rect(105, 90, 50, 50), "object"), new ErrorArea(new Rect(100, 100, 100, 100), "container")),
                  messages("\"object\" is 5px right which is not in range of 10 to 15px, is 10px top instead of 5px")),
                  specOn(TOP, LEFT, "container", location(between(10, 15), RIGHT), location(exact(5), TOP)), page(new HashMap<String, PageElement>(){{
                      put("object", element(105, 90, 50, 50));
                      put("container", element(100, 100, 100, 100));
              }})),
             
             
          // Color Scheme
          row(new ValidationError(NO_AREA, messages("\"object\" is not visible on page")),
                  specColorScheme(new ColorRange(Color.black, between(30, 33))), page(new HashMap<String, PageElement>(){{
                      put("object", invisibleElement(10, 10, 400, 300));
              }}, testImage)),
          row(new ValidationError(NO_AREA, messages("\"object\" is absent on page")),
                  specColorScheme(new ColorRange(Color.black, between(30, 33))), page(new HashMap<String, PageElement>(){{
                      put("object", absentElement(10, 10, 400, 300));
              }}, testImage)),
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 10, 400, 300), "object")),
                  messages("color #000000 on \"object\" is 36% which is not in range of 10 to 20%")),
                  specColorScheme(new ColorRange(Color.black, between(10, 20))), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 400, 300));
              }}, testImage)),
             
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 10, 400, 300), "object")),
                  messages("color #ffffff on \"object\" is 48% instead of 30%")),
                  specColorScheme(new ColorRange(Color.white, exact(30))), page(new HashMap<String, PageElement>(){{
                      put("object", element(10, 10, 400, 300));
              }}, testImage)),
             
          row(new ValidationError(areas(new ErrorArea(new Rect(10, 10, 500, 300), "object")),
                      messages("color #3a70d0 on \"object\" is 12% instead of 30%")),
                      specColorScheme(new ColorRange(Color.decode("#3A70D0"), exact(30))), page(new HashMap<String, PageElement>(){{
                          put("object", element(10, 10, 500, 300));
                  }}, testImage)),




          // Image comparsion
            row(new ValidationError(NO_AREA, messages("\"object\" is absent on page")),
                  specImage(asList("/imgs/button-sample-incorrect.png"), 2.0, true, 0, 10), page(new HashMap<String, PageElement>(){{
                    put("object", absentElement(10, 10, 400, 300));
                }}, testImage)),

            row(new ValidationError(NO_AREA, messages("\"object\" is not visible on page")),
                specImage(asList("/imgs/button-sample-incorrect.png"), 2.0, true, 0, 10), page(new HashMap<String, PageElement>(){{
                    put("object", invisibleElement(10, 10, 400, 300));
                }}, testImage)),

            row(new ValidationError(areas(new ErrorArea(new Rect(100, 90, 100, 40), "object")),
                        messages("Element does not look like \"/imgs/button-sample-incorrect.png\". " +
                                "There are 3820 mismatching pixels but max allowed is 600"))
                            .withImageComparisonSample(null, "/imgs/button-sample-incorrect.png", null),
                specImage(asList("/imgs/button-sample-incorrect.png"), 600, PIXEL_UNIT, 0, 10), page(new HashMap<String, PageElement>(){{
                    put("object", element(100, 90, 100, 40));
                }}, imageComparisonTestScreenshot)),

            row(new ValidationError(areas(new ErrorArea(new Rect(100, 90, 100, 40), "object")),
                            messages("Element does not look like \"/imgs/button-sample-incorrect.png\". " +
                                    "There are 95.5% mismatching pixels but max allowed is 2.0%"))
                            .withImageComparisonSample(null, "/imgs/button-sample-incorrect.png", null),
                    specImage(asList("/imgs/button-sample-incorrect.png"), 2.0, PERCENTAGE_UNIT, 0, 10), page(new HashMap<String, PageElement>(){{
                        put("object", element(100, 90, 100, 40));
                    }}, imageComparisonTestScreenshot)),

            row(new ValidationError(null,
                        messages("Couldn't load image: /imgs/undefined-image.png"))
                    .withArea(new ErrorArea(new Rect(100, 90, 100, 40), "object")),
                specImage(asList("/imgs/undefined-image.png"), 1.452, PERCENTAGE_UNIT, 0, 10), page(new HashMap<String, PageElement>(){{
                    put("object", element(100, 90, 100, 40));
                }}, imageComparisonTestScreenshot)),

        };
View Full Code Here

TOP

Related Classes of net.mindengine.galen.page.Rect

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.