For a while I wrote test for our web application using the Page Object framework. But test after test, I notice, I always wrote the same kind of assert.
MyPage page = navigateToMyPage(); page.setField1("foo"); page.setField2("faa"); page = page.save(); assertThat(page.getField1(), is("foo)); assertThat(page.getField2(), is("aaa));
So I'm thinking about a PageObjectValidator.
MyPage page = navigateToMyPage(); page.setField1("foo"); page.setField2("faa"); page = page.save(); page.validate(); // or Validator.validate(page)
The idea is to centralize all the assert for a page, to not repeat them in each test (DRY) and to not forget one assert. Behind the scene, the setField1(String) function will put its parameter within a simple POJO, and the validate will iterate over all the properties of the POJO to do the assertion (to take an easy example).
What do you think about this idea? I'm not able to find any such example over web, If anyone have already implemented such a framework, provide your inputs here.