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

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


        }
    }

    @Test
    public void shouldAllowTo_importJavascriptFiles() throws IOException {
        PageSpecReader specReader = new PageSpecReader(new Properties(), null);
        PageSpec pageSpec = specReader.read(getClass().getResource("/specs/spec-with-javascript-import.spec").getFile());
        assertThat(pageSpec.getSections().get(0).getObjects().get(0).getSpecs().get(0).getOriginalText(), is("text is: some value from-javascript function"));
    }
View Full Code Here


    @Test
    public void shouldAllowTo_usePageObjectValues_inJsExpressions() throws IOException {
        WebDriver driver = new MockedDriver();
        driver.get("/mocks/pages/object-values-in-js.json");
        PageSpecReader specReader = new PageSpecReader(new Properties(), new SeleniumBrowser(driver));
        PageSpec pageSpec = specReader.read(getClass().getResource("/specs/spec-with-object-values-in-js.spec").getFile());
        assertThat(pageSpec.getSections().get(0).getObjects().get(0).getSpecs().get(0).getOriginalText(), is("near: menu-item-4 20px left"));
        assertThat(pageSpec.getSections().get(0).getObjects().get(0).getSpecs().get(1).getOriginalText(), is("above: menu-item-4 30px"));
    }
View Full Code Here

        assertThat(pageSpec.getSections().get(0).getObjects().get(0).getSpecs().get(1).getOriginalText(), is("above: menu-item-4 30px"));
    }

    @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

        assertThat(pageSpec.getSections().get(0).getObjects().get(2).getSpecs().get(0).getOriginalText(), is("above: menu-item-7"));
    }

    @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

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

    }

    private PageSpec readSpec(String path) throws IOException {
        PageSpecReader specReader = new PageSpecReader(new Properties(), null);
        return specReader.read(getClass().getResource(path).getFile());
    }
View Full Code Here


    @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

        driver.quit();
    }
   
    @Test
    public void performsValidation_forAll() throws Exception {
        PageSpec pageSpec = new PageSpecReader(EMPTY_PROPERTIES, new SeleniumBrowser(driver)).read(getClass().getResourceAsStream("/html/page.spec"));
       
        openDriverForNicePage();
       
        driver.manage().window().maximize();
       
View Full Code Here

   
    @Test
    public void performsValidation_forMobile_withTwoSections() throws Exception {
        openDriverForNicePage();
       
        PageSpec pageSpec = new PageSpecReader(EMPTY_PROPERTIES, new SeleniumBrowser(driver)).read(getClass().getResourceAsStream("/html/page.spec"));
       
        driver.manage().window().setSize(new Dimension(400, 1000));
       
        SeleniumPage page = new SeleniumPage(driver);
       
View Full Code Here

   
    @Test
    public void shouldCheck_relativeToScreen() throws Exception {
        openDriverForNicePage();
       
        PageSpec pageSpec = new PageSpecReader(EMPTY_PROPERTIES, new SeleniumBrowser(driver)).read(getClass().getResourceAsStream("/html/page.spec"));
       
        driver.manage().window().setSize(new Dimension(400, 1000));
       
        SeleniumPage page = new SeleniumPage(driver);
       
View Full Code Here

TOP

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

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.