Package net.mindengine.galen.reports.model

Examples of net.mindengine.galen.reports.model.LayoutReport


        Page page = browser.getPage();

        CombinedValidationListener listener = new CombinedValidationListener();
        listener.add(validationListener);

        LayoutReport layoutReport = new LayoutReport();
        try {
            layoutReport.setScreenshotFullPath(page.createScreenshot().getAbsolutePath());
        }
        catch (Exception ex) {
            ex.printStackTrace();
        }
        listener.add(new LayoutReportListener(layoutReport));


        List<ValidationError> allValidationErrors = new LinkedList<ValidationError>();

        for (PageSpec spec : specs) {

            SectionFilter sectionFilter = new SectionFilter(includedTags, excludedTags);
            List<PageSection> pageSections = spec.findSections(sectionFilter);
            SectionValidation sectionValidation = new SectionValidation(pageSections, new PageValidation(browser, page, spec, listener, sectionFilter), listener);

            List<ValidationError> errors = sectionValidation.check();
            if (errors != null && errors.size() > 0) {
                allValidationErrors.addAll(errors);
            }
        }

        layoutReport.setValidationErrors(allValidationErrors);

        return layoutReport;
    }
View Full Code Here


    private List<String> excludedTags;

   
    @Override
    public void execute(TestReport report, Browser browser, GalenPageTest pageTest, ValidationListener validationListener) throws IOException {
        LayoutReport layoutReport = Galen.checkLayout(browser, getSpecs(), getIncludedTags(), getExcludedTags(), getCurrentProperties(), validationListener);

        if (report != null) {
            String reportTitle = "Check layout: " + toCommaSeparated(getSpecs()) + " included tags: " + toCommaSeparated(includedTags);
            TestReportNode layoutReportNode = new LayoutReportNode(layoutReport, reportTitle);
            if (layoutReport.errors() > 0) {
                layoutReportNode.setStatus(TestReportNode.Status.ERROR);
            }
            report.addNode(layoutReportNode);
        }
    }
View Full Code Here

        List<GalenTestInfo> testInfos = new LinkedList<GalenTestInfo>();
       
        GalenTestInfo testInfo = new GalenTestInfo("Home page test", null);

        TestReport report = new TestReport();
        LayoutReport layoutReport = new LayoutReport();
        layoutReport.setScreenshotFullPath(File.createTempFile("screenshot", ".png").getAbsolutePath());
        ReportingListenerTestUtils.performSampleReporting("Home page test", null, new LayoutReportListener(layoutReport), null);



        report.addNode(new LayoutReportNode(layoutReport, "check layout"));
View Full Code Here

    @Test
    public void checkLayout_shouldTestLayout_andReturnLayoutReport() throws IOException {
        WebDriver driver = new MockedDriver();
        driver.get("/mocks/pages/galen4j-sample-page.json");

        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

public class LayoutReportNodeTest {

    @Test
    public void should_fetchStatistics_properly() {
        LayoutReport report = createSampleLayoutReport();
        TestStatistic statistics = new TestStatistic();
        new LayoutReportNode(report, "Layout check").fetchStatistic(statistics);

        assertThat(statistics.getPassed(), is(1));
        assertThat(statistics.getErrors(), is(3));
View Full Code Here

        assertThat(statistics.getWarnings(), is(2));
    }

    @Test
    public void shouldReturn_errorsAndWarnings_properly() {
        LayoutReport report = createSampleLayoutReport();

        assertThat(report.errors(), is(3));
        assertThat(report.warnings(), is(2));
    }
View Full Code Here

        assertThat(report.errors(), is(3));
        assertThat(report.warnings(), is(2));
    }

    private LayoutReport createSampleLayoutReport() {
        LayoutReport report = new LayoutReport();
        List<ValidationError> list = new LinkedList<ValidationError>();
        report.setValidationErrors(list);

        list.add(new ValidationError().withOnlyWarn(true));
        list.add(new ValidationError());
        list.add(new ValidationError());
        list.add(new ValidationError().withOnlyWarn(true));
        list.add(new ValidationError());


        List<LayoutSection> sections = new LinkedList<LayoutSection>();
        LayoutSection section = new LayoutSection();
        sections.add(section);
        report.setSections(sections);


        List<LayoutObject> objects = new LinkedList<LayoutObject>();
        section.setObjects(objects);
        LayoutObject object = new LayoutObject();
View Full Code Here

TOP

Related Classes of net.mindengine.galen.reports.model.LayoutReport

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.