Package net.mindengine.galen.specs.page

Examples of net.mindengine.galen.specs.page.PageSection


    public void startBody() {
        if (state != STATE.STATEMENT) {
            throw new SyntaxException("Wrong place for this statement");
        }
       
        PageSection currentSection = new PageSection();
        currentSectionState = new StateDoingSection(getProperties(), currentSection, getContextPath(), getPageSpecReader());
       
        conditionalBlock.setBodyObjects(currentSection.getObjects());
        state = STATE.BODY;
    }
View Full Code Here


    public void startOtherwise() {
        if (state != STATE.BODY) {
            throw new SyntaxException("Wrong place for this statement");
        }
       
        PageSection currentSection = new PageSection();
        currentSectionState = new StateDoingSection(getProperties(), currentSection, contextPath, getPageSpecReader());
        state = STATE.BODY;
       
        conditionalBlock.setOtherwiseObjects(currentSection.getObjects());
    }
View Full Code Here

    }

    public PageSpec buildPageSpec() {
        Iterator<PageSection> it = pageSpec.getSections().iterator();
        while(it.hasNext()) {
            PageSection section = it.next();
            if (section.getObjects().size() == 0 && !hasConditionalBlocks(section)) {
                it.remove();
            }
         }
        return this.pageSpec;
    }
View Full Code Here

        return containsOnly(line.trim(), '=');
    }

    private void startNewSection(String sectionDeclaration) {
       
        PageSection previousSection = currentSection;
        currentSection = new PageSection();
       
        sectionDeclaration = sectionDeclaration.trim();
       
        String name = sectionDeclaration;
        String tags = sectionDeclaration;
       
        int pipeIndex = sectionDeclaration.indexOf("|");
        if (pipeIndex > 0) {
            name = sectionDeclaration.substring(0, pipeIndex).trim();
            tags = sectionDeclaration.substring(pipeIndex + 1).trim();
        }
        else if (pipeIndex == 0) {
            name = "";
            tags = sectionDeclaration.substring(1);
        }
       
        if (name.equals("^") && previousSection != null) {
            name = previousSection.getName();
        }
       
        if (tags.equals("^")) {
            //taking tags from previous section
            if (previousSection != null) {
                currentSection.setTags(previousSection.getTags());
            }
        }
        else {
            currentSection.setTags(readTags(tags));
        }
View Full Code Here

        GalenPageActionCheck action = new GalenPageActionCheck();
        action.setOriginalCommand("check homepage.spec --include all,mobile");
        validationListener.onBeforePageAction(pageRunner, action);
        {
           
            PageSection section1 = sectionWithName("");
            validationListener.onBeforeSection(pageRunner, pageValidation, section1);
           
            validationListener.onObject(pageRunner, pageValidation, "objectA1"); {
                validationListener.onSpecError(pageRunner, pageValidation,
                        "objectA1",
                        new SpecInside("other-object", asList(new Location(exact(10), asList(LEFT)))).withOriginalText("inside: other-object 10px left")
                            .withPlace(new Place("specs.spec", 12)),
                        new ValidationError(asList(new ErrorArea(new Rect(10, 10, 100, 50), "objectA1")), asList("objectA1 is not inside other-object")));
               
                validationListener.onSpecSuccess(pageRunner, pageValidation, "objectA1", new SpecWidth(between(10, 20)).withOriginalText("width: 10 to 20px").withPlace(new Place("specs.spec", 12)));
            }
            validationListener.onAfterObject(pageRunner, pageValidation, "objectA1");
           
            validationListener.onObject(pageRunner, pageValidation, "objectA2"); {
                validationListener.onSpecSuccess(pageRunner, pageValidation, "objectA2", new SpecWidth(between(10, 20)).withOriginalText("width: 10 to 20px").withPlace(new Place("specs.spec", 12)));
                validationListener.onSpecError(pageRunner, pageValidation,
                        "objectA2",
                        new SpecWidth(exact(10)).withOriginalText("width: 10px")
                            .withPlace(new Place("specs.spec", 12)),
                        new ValidationError(asList(new ErrorArea(new Rect(200, 300, 50, 30), "objectA2")), asList("objectA2 width is 20px instead of 10px")));

                validationListener.onSpecError(pageRunner, pageValidation,
                        "objectA2",
                        new SpecText(SpecText.Type.IS, "Login").withOriginalText("text is: Login")
                                .withPlace(new Place("specs.spec", 12))
                                .withOnlyWarn(true),
                        new ValidationError(asList(new ErrorArea(new Rect(200, 300, 50, 30), "objectA2")), asList("objectA2 text is \"Logout\" instead of \"Login\"")));
            }
            validationListener.onAfterObject(pageRunner, pageValidation, "objectA2");
           
            validationListener.onAfterSection(pageRunner, pageValidation, section1);
           
            PageSection section2 = sectionWithName("some section 2");
            validationListener.onBeforeSection(pageRunner, pageValidation, section2);
           
            validationListener.onObject(pageRunner, pageValidation, "objectA1"); {
                validationListener.onSpecSuccess(pageRunner, pageValidation, "objectA1", new SpecHeight(between(10, 20)).withOriginalText("height: 10 to 20px").withPlace(new Place("specs.spec", 12)));
               
                //Doing sub-objects call
                {
                    validationListener.onObject(pageRunner, pageValidation, "sub-objectA1"); {
                        validationListener.onSpecSuccess(pageRunner, pageValidation, "sub-objectA1", new SpecHeight(between(10, 20)).withOriginalText("height: 10 to 20px").withPlace(new Place("specs.spec", 12)));
                        validationListener.onSpecError(pageRunner, pageValidation,
                                "sub-objectA1",
                                new SpecWidth(exact(10)).withOriginalText("width: 10px")
                                    .withPlace(new Place("specs.spec", 12)),
                                new ValidationError(asList(new ErrorArea(new Rect(200, 300, 50, 30), "sub-objectA1")), asList("sub-objectA1 width is 20px instead of 10px")));
                    }
                    validationListener.onAfterObject(pageRunner, pageValidation, "sub-objectA1");
                }
                validationListener.onSpecSuccess(pageRunner, pageValidation, "objectA1", new SpecHeight(between(10, 20)).withOriginalText("component: some-component.spec").withPlace(new Place("specs.spec", 12)));
            }
            validationListener.onAfterObject(pageRunner, pageValidation, "objectA1");
           
            validationListener.onAfterSection(pageRunner, pageValidation, section2);
       
        }
        validationListener.onAfterPageAction(pageRunner, action);
       
       
       
        validationListener.onBeforePageAction(pageRunner, action);
        {
            PageSection section1 = sectionWithName("some section 1");
            validationListener.onBeforeSection(pageRunner, pageValidation, section1);
           
            validationListener.onObject(pageRunner, pageValidation, "objectB1"); {
                validationListener.onSpecSuccess(pageRunner, pageValidation, "objectB1", new SpecWidth(between(10, 20)).withOriginalText("width: 10 to 20px").withPlace(new Place("specs.spec", 12)));
               
View Full Code Here

        test.setReport(report);
        suiteListener.afterTestSuite(asList(test));
    }

    private static PageSection sectionWithName(String name) {
        PageSection section = new PageSection();
        section.setName(name);
        return section;
    }
View Full Code Here

TOP

Related Classes of net.mindengine.galen.specs.page.PageSection

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.