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"); {