Package net.mindengine.galen.specs.reader.page

Examples of net.mindengine.galen.specs.reader.page.PageSpec


    public static void dumpPage(Browser browser, String pageName, String specPath, String pageDumpPath, Integer maxWidth, Integer maxHeight) throws IOException {
        dumpPage(browser, pageName, specPath, pageDumpPath, maxWidth, maxHeight, new Properties());
    }
    public static void dumpPage(Browser browser, String pageName, String specPath, String pageDumpPath, Integer maxWidth, Integer maxHeight, Properties properties) throws IOException {
        PageSpecReader reader = new PageSpecReader(properties, browser);
        PageSpec pageSpec = reader.read(specPath);
        dumpPage(browser, pageName, pageSpec, new File(pageDumpPath), maxWidth, maxHeight);
    }
View Full Code Here


       
        ValidationListener validationListener = pageValidation.getValidationListener();

        PageSpecReader pageSpecReader = new PageSpecReader(spec.getProperties(), pageValidation.getBrowser());

        PageSpec componentPageSpec;
        try {
            componentPageSpec = pageSpecReader.read(spec.getSpecPath());
        } catch (IOException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
       
        SectionValidation sectionValidation = new SectionValidation(componentPageSpec.findSections(pageValidation.getSectionFilter()),
                new PageValidation(pageValidation.getBrowser(), objectContextPage, componentPageSpec, validationListener, pageValidation.getSectionFilter()),
                validationListener);
       
        List<ValidationError> errors = sectionValidation.check();
        if (errors != null && errors.size() > 0) {
View Full Code Here

    }

    @Test
    public void shouldAllowTo_useParameterizationIndex_insideJsExpression() throws IOException {
        PageSpecReader specReader = new PageSpecReader(new Properties(), null);
        PageSpec pageSpec = specReader.read(getClass().getResource("/specs/parameterization-index-in-js.spec").getFile());
        assertThat(pageSpec.getSections().get(0).getObjects().get(0).getSpecs().get(0).getOriginalText(), is("above: menu-item-3"));
        assertThat(pageSpec.getSections().get(0).getObjects().get(1).getSpecs().get(0).getOriginalText(), is("above: menu-item-5"));
        assertThat(pageSpec.getSections().get(0).getObjects().get(2).getSpecs().get(0).getOriginalText(), is("above: menu-item-7"));
    }
View Full Code Here

    }

    @Test
    public void shouldAllowTo_mixConditionalStatements_withParameterizations() throws IOException {
        PageSpecReader specReader = new PageSpecReader(new Properties(), null);
        PageSpec pageSpec = specReader.read(getClass().getResource("/specs/mix-conditions-with-parameterizations.spec").getFile());
        ConditionalBlock conditionalBlock = pageSpec.getSections().get(0).getConditionalBlocks().get(0);
        assertThat(conditionalBlock.getBodyObjects().size(), is(3));
        assertThat(conditionalBlock.getBodyObjects().get(0).getObjectName(), is("banner-1"));
        assertThat(conditionalBlock.getBodyObjects().get(1).getObjectName(), is("banner-2"));
        assertThat(conditionalBlock.getBodyObjects().get(2).getObjectName(), is("banner-3"));
    }
View Full Code Here


    @Test
    public void shouldImport_sameJsScript_andSameSpec_onlyOnes_withinDifferentLevels_ofSpecs() throws IOException {
        JsTestRegistry.get().clear();
        PageSpec pageSpec = readSpec("/specs/same-import/main.spec");
        assertThat("Amount of events should be", JsTestRegistry.get().getEvents().size(), is(1));
        assertThat("Events should be", JsTestRegistry.get().getEvents(), contains("script is loaded"));

        assertThat("Amout of sections should be", pageSpec.getSections().size(), is(3));

        assertThat(pageSpec.getSections().get(0).getObjects().get(0).getObjectName(), is("main-item"));
        assertThat(pageSpec.getSections().get(0).getObjects().get(0).getSpecs().get(0).getOriginalText(), is("text is: name from script"));

        assertThat(pageSpec.getSections().get(1).getObjects().get(0).getObjectName(), is("common-object"));
        assertThat(pageSpec.getSections().get(1).getObjects().get(0).getSpecs().get(0).getOriginalText(), is("width: 100px"));

        assertThat(pageSpec.getSections().get(2).getObjects().get(0).getObjectName(), is("sub-item"));
        assertThat(pageSpec.getSections().get(2).getObjects().get(0).getSpecs().get(0).getOriginalText(), is("text is: name from script"));

    }
View Full Code Here

    private static final Place EMPTY_PLACE = new Place("", 1);


    @Test(dataProvider = "provideGoodSamples")
    public void shouldParseCorrect_objectDefinition(String objectDefinitionText, String expectedName, Locator expectedLocator) {
        PageSpec pageSpec = new PageSpec();
        new StateObjectDefinition(pageSpec, new PageSpecReader(EMPTY_PROPERTIES, NO_BROWSER)).process(objectDefinitionText, EMPTY_PLACE);
        assertThat(pageSpec.getObjects(), hasKey(expectedName));
        assertThat(pageSpec.getObjectLocator(expectedName), is(expectedLocator));
    }
View Full Code Here

   
    @Test(dataProvider = "provideBadSamples")
    public void shouldGiveError_forIncorrect_objectDefinitions(String objectDefinitionText, String expectedErrorMessage) {
        SyntaxException exception = null;
        try {
            PageSpec pageSpec = new PageSpec();
            new StateObjectDefinition(pageSpec, new PageSpecReader(EMPTY_PROPERTIES, NO_BROWSER)).process(objectDefinitionText, EMPTY_PLACE);
        }
        catch (SyntaxException e) {
            exception = e;
        }
View Full Code Here

    private BufferedImage testImage = loadTestImage("/color-scheme-image-1.png");
    private BufferedImage imageComparisonTestScreenshot = loadTestImage("/imgs/page-screenshot.png");
   
    @Test(dataProvider="provideGoodSamples")
    public void shouldPassValidation(Spec spec, MockedPage page) {
        PageSpec pageSpec = createMockedPageSpec(page);
        PageValidation validation = new PageValidation(null, page, pageSpec, null, null);
        ValidationError error = validation.check("object", spec);
       
        assertThat(error, is(nullValue()));
    }
View Full Code Here

        }
    }

    @Test(dataProvider="provideBadSamples")
    public void shouldGiveError(ValidationError expectedError, Spec spec, MockedPage page) {
        PageSpec pageSpec = createMockedPageSpec(page);
        PageValidation validation = new PageValidation(null, page, pageSpec, null, null);
        ValidationError error = validation.check("object", spec);
       
        assertThat(error, is(notNullValue()));
        assertThat(error, is(expectedError));
View Full Code Here

        assertThat(error, is(expectedError));
    }
   
   
    private PageSpec createMockedPageSpec(MockedPage page) {
        PageSpec pageSpec = new PageSpec();
       
        for (String objectName : page.getElements().keySet()) {
            pageSpec.getObjects().put(objectName, new Locator("id", objectName));
        }
        return pageSpec;
    }
View Full Code Here

TOP

Related Classes of net.mindengine.galen.specs.reader.page.PageSpec

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.