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

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


    PageSpecReader pageSpecReader = new PageSpecReader(EMPTY_PROPERTIES, NO_BROWSER);
    PageSpec pageSpec;
   
    @Test
    public void shouldBePossible_toReadSpec_fromInputStream() throws IOException {
        PageSpec pageSpec = new PageSpecReader(EMPTY_PROPERTIES, NO_BROWSER).read(getClass().getResourceAsStream("/specs.txt"));
        assertThat(pageSpec, is(notNullValue()));
    }
View Full Code Here


    }
   
    @Test
    public void shouldBePossible_toReadSpec_fromFile() throws IOException {

        PageSpec pageSpec = new PageSpecReader(EMPTY_PROPERTIES, NO_BROWSER).read(getClass().getResource("/specs.txt").getFile());
        assertThat(pageSpec, is(notNullValue()));
    }
View Full Code Here

        assertThat(place.getLineNumber(), is(24));
    }
   
    @Test
    public void shouldAlways_provideAsteriskTags_whenFiltering_byIncludedTags() throws IOException {
        PageSpec pageSpec = pageSpecReader.read(getClass().getResource("/specs/spec-asterisk-tags.spec").getFile());
       
        assertThat("Total amount of sections should be", pageSpec.getSections().size(), is(3));
       
        List<PageSection> filteredSections = pageSpec.findSections(asList("tag2"));
        assertThat("Amount of filtered sections should be", filteredSections.size(), is(2));
        assertThat("Tag for first filtered section should be", filteredSections.get(0).getTags(), contains("*"));
        assertThat("Tag for second filtered section should be", filteredSections.get(1).getTags(), contains("tag2"));
    }
View Full Code Here

    @Test
    public void shouldAllow_toCountObject_byIvoking_JavascriptFunction() throws IOException {
        WebDriver driver = new MockedDriver();
        driver.get("/mocks/pages/count-via-js-page.json");
        PageSpecReader pageSpecReader = new PageSpecReader(EMPTY_PROPERTIES, new SeleniumBrowser(driver));
        PageSpec pageSpec = pageSpecReader.read(getClass().getResource("/specs/count-via-js.spec").getFile());

        List<ObjectSpecs> objectSpecs = pageSpec.getSections().get(0).getObjects();

        assertThat(objectSpecs.size(), is(3));
        assertThat(objectSpecs.get(0).getObjectName(), is("menu-item-1"));
        assertThat(objectSpecs.get(1).getObjectName(), is("menu-item-2"));
        assertThat(objectSpecs.get(2).getObjectName(), is("menu-item-3"));
View Full Code Here

    @Test
    public void should_countObjects_evenWhenUsing_emptyImports() throws IOException {
        WebDriver driver = new MockedDriver();
        driver.get("/mocks/pages/count-via-js-page.json");
        PageSpecReader pageSpecReader = new PageSpecReader(EMPTY_PROPERTIES, new SeleniumBrowser(driver));
        PageSpec pageSpec = pageSpecReader.read(getClass().getResource("/specs/count-bug-134.spec").getFile());

        List<ObjectSpecs> objectSpecs = pageSpec.getSections().get(0).getObjects();
        assertThat(objectSpecs.get(0).getSpecs().get(0).getOriginalText(), is("text is: A count is 4"));
    }
View Full Code Here

    @Test
    public void should_countObject_insideSecondarySpec() throws IOException {
        WebDriver driver = new MockedDriver();
        driver.get("/mocks/pages/count-via-js-page.json");
        PageSpecReader pageSpecReader = new PageSpecReader(EMPTY_PROPERTIES, new SeleniumBrowser(driver));
        PageSpec pageSpec = pageSpecReader.read(getClass().getResource("/specs/count/main.spec").getFile());

        List<ObjectSpecs> objectSpecs = pageSpec.getSections().get(0).getObjects();
        assertThat(objectSpecs.get(0).getSpecs().get(0).getOriginalText(), is("text is: A count is 4"));
    }
View Full Code Here

    }


    @Test
    public void shouldNotParameterize_ifTemplateIsGiven_from_1_to_0_or_from_1_to_minus1() throws IOException {
        PageSpec pageSpec = pageSpecReader.read("/specs/incorrect-parameterization.spec");
        assertThat(pageSpec.getSections().size(), is(0));
    }
View Full Code Here

        assertThat((SpecAbsent) specs.get(0), is(new SpecAbsent()));
    }
   
    @Test
    public void shouldRead_andProcess_bashTemplateExpressions() throws IOException {
        PageSpec pageSpec = new PageSpecReader(EMPTY_PROPERTIES, NO_BROWSER).read(getClass().getResourceAsStream("/specs/spec-bash-template.spec"));
        assertThat(pageSpec, is(notNullValue()));
       
        List<PageSection> sections = pageSpec.getSections();
        assertThat(sections.size(), is(1));
       
        List<ObjectSpecs> objects = sections.get(0).getObjects();
        assertThat(objects.size(), is(3));
       
View Full Code Here

        assertThat(objects.get(2).getObjectName(), is("obj-3"));
    }
   
    @Test
    public void shouldRead_sectionsNames_withTags() throws IOException {
        PageSpec pageSpec = new PageSpecReader(EMPTY_PROPERTIES, NO_BROWSER).read(getClass().getResourceAsStream("/specs/spec-sections-advanced.spec"));
        assertThat(pageSpec, is(notNullValue()));
       
        List<PageSection> sections = pageSpec.getSections();
        assertThat(sections.size(), is(7));
       
        assertThat(sections.get(0).getName(), is("Section 1"));
        assertThat(sections.get(0).getTags(), contains("all", "mobile"));
       
View Full Code Here

        assertThat(exception.getLine(), is(9));
    }
   
    @Test
    public void shouldImport_otherSpecs_fromOtherFiles() throws Exception {
      PageSpec pageSpec = pageSpecReader.read("/spec-import-test/main.spec");
     
      assertThat(pageSpec.getObjects(), hasKey("content"));
      assertThat(pageSpec.getObjects(), hasKey("header"));
      assertThat(pageSpec.getObjects(), hasKey("header-text"));
     
     
      List<PageSection> sections = pageSpec.getSections();
     
      assertThat(sections.size(), is(2));
     
      assertThat(sections.get(0).getTags(), contains("all"));
     
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.