Package net.mindengine.galen.suite.actions

Examples of net.mindengine.galen.suite.actions.GalenPageActionCheck


            test.setPageTests(asList(new GalenPageTest()
                .withTitle("Simple check")
                .withUrl(arguments.getUrl())
                .withSize(arguments.getScreenSize())
                .withBrowserFactory(new SeleniumBrowserFactory(SeleniumBrowserFactory.FIREFOX))
                .withActions(asList((GalenPageAction)new GalenPageActionCheck()
                    .withSpecs(asList(pageSpecPath))
                    .withIncludedTags(arguments.getIncludedTags())
                    .withExcludedTags(arguments.getExcludedTags())
                    .withOriginalCommand(arguments.getOriginal()))
                )));
View Full Code Here


     * @param includedTags
     * @param excludedTags
     * @throws IOException
     */
    public static void checkLayout(WebDriver driver, String fileName, String[]includedTags, String[]excludedTags) throws IOException {
        GalenPageActionCheck action = new GalenPageActionCheck();
        action.setSpecs(Arrays.asList(fileName));
        if (includedTags != null) {
            action.setIncludedTags(Arrays.asList(includedTags));
        }
        if (excludedTags != null) {
            action.setExcludedTags(Arrays.asList(excludedTags));
        }

        TestSession session = TestSession.current();
        if (session == null) {
            throw new UnregisteredTestSession("Cannot check layout as there was no TestSession created");
        }

        TestReport report = session.getReport();
        CompleteListener listener = session.getListener();
        action.execute(report, new SeleniumBrowser(driver), null, listener);
    }
View Full Code Here

    public static GalenPageActionInjectJavascript injectJavascript(String javascriptFilePath) {
        return new GalenPageActionInjectJavascript(javascriptFilePath);
    }

    public static GalenPageActionCheck check(List<String> specFilePaths) {
        return new GalenPageActionCheck().withSpecs(specFilePaths);
    }
View Full Code Here

       
        MockedPageValidation pageValidation = new MockedPageValidation(pageElements);
       
       
       
        GalenPageActionCheck action = new GalenPageActionCheck();
        action.setOriginalCommand("check homepage.spec --include all,mobile");
        validationListener.onBeforePageAction(pageRunner, action);
        {
           
            PageSection section1 = sectionWithName("");
            validationListener.onBeforeSection(pageRunner, pageValidation, section1);
View Full Code Here

public class GalenPageActionCheckTest {
   
   
    @SuppressWarnings("serial")
    @Test public void shouldTest_conditionalBlocks_simple_whenConditionPasses() throws IOException {
        GalenPageActionCheck check = new GalenPageActionCheck();
        check.setSpecs(Arrays.asList(getClass().getResource("/specs/spec-conditional-simple.spec").getFile()));
       
        MockedBrowser mockedBrowser = new MockedBrowser("http://galenframework.com", new Dimension(640, 480));
        mockedBrowser.setMockedPage(new MockedPage(new HashMap<String, PageElement>(){{
            put("textfield", new MockedPageElement(0, 0, 100, 100));
            put("button-1", new MockedPageElement(0, 0, 200, 100));
            put("button-2", new MockedPageElement(0, 100, 200, 10));
        }}));
       
        TestValidationListener validationListener = new TestValidationListener();
       
        TestReport report = new TestReport();
        check.execute(report, mockedBrowser, new GalenPageTest(), validationListener);
       
        Assert.assertEquals(
                "<o textfield>\n" +
                "<SpecHeight textfield>\n" +
                "</o textfield>\n" +
View Full Code Here

        , validationListener.getInvokations());
    }
   
    @SuppressWarnings("serial")
    @Test public void shouldTest_conditionalBlocks_simple_whenConditionPasses_butStatementInverted() throws IOException {
        GalenPageActionCheck check = new GalenPageActionCheck();
        check.setSpecs(Arrays.asList(getClass().getResource("/specs/spec-conditional-simple-inverted.spec").getFile()));
       
        MockedBrowser mockedBrowser = new MockedBrowser("http://galenframework.com", new Dimension(640, 480));
        mockedBrowser.setMockedPage(new MockedPage(new HashMap<String, PageElement>(){{
            put("textfield", new MockedPageElement(0, 0, 100, 100));
            put("button-1", new MockedPageElement(0, 0, 200, 100));
            put("button-2", new MockedPageElement(0, 100, 200, 10));
        }}));
       
       
        TestValidationListener validationListener = new TestValidationListener();
        check.execute(new TestReport(), mockedBrowser, new GalenPageTest(), validationListener);
       
        Assert.assertEquals(
                "<o textfield>\n" +
                "<SpecHeight textfield>\n" +
                "</o textfield>\n" +
View Full Code Here

        , validationListener.getInvokations());
    }
   
    @SuppressWarnings("serial")
    @Test public void shouldTest_conditionalBlocks_simple_whenConditionFails_inverted() throws IOException {
        GalenPageActionCheck check = new GalenPageActionCheck();
        check.setSpecs(Arrays.asList(getClass().getResource("/specs/spec-conditional-simple-inverted.spec").getFile()));
       
        MockedBrowser mockedBrowser = new MockedBrowser("http://galenframework.com", new Dimension(640, 480));
        mockedBrowser.setMockedPage(new MockedPage(new HashMap<String, PageElement>(){{
            put("textfield", new MockedPageElement(0, 0, 100, 100));
            put("button-1", new MockedInvisiblePageElement(0, 0, 100, 100));
            put("button-2", new MockedInvisiblePageElement(0, 0, 100, 100));
        }}));

       
        TestValidationListener validationListener = new TestValidationListener();
        check.execute(new TestReport(), mockedBrowser, new GalenPageTest(), validationListener);
       
        Assert.assertEquals(
                "<o textfield>\n" +
                "<SpecHeight textfield>\n" +
                "</o textfield>\n" +
View Full Code Here

        , validationListener.getInvokations());
    }
   
    @SuppressWarnings("serial")
    @Test public void shouldTest_conditionalBlocks_simple_whenConditionFails() throws IOException {
        GalenPageActionCheck check = new GalenPageActionCheck();
        check.setSpecs(Arrays.asList(getClass().getResource("/specs/spec-conditional-simple.spec").getFile()));
       
        MockedBrowser mockedBrowser = new MockedBrowser("http://galenframework.com", new Dimension(640, 480));
        mockedBrowser.setMockedPage(new MockedPage(new HashMap<String, PageElement>(){{
            put("textfield", new MockedPageElement(0, 0, 100, 100));
            put("button-1", new MockedInvisiblePageElement(0, 0, 100, 100));
            put("button-2", new MockedInvisiblePageElement(0, 0, 100, 100));
        }}));

       
        TestValidationListener validationListener = new TestValidationListener();
        check.execute(new TestReport(), mockedBrowser, new GalenPageTest(), validationListener);
       
        Assert.assertEquals(
                "<o textfield>\n" +
                "<SpecHeight textfield>\n" +
                "</o textfield>\n" +
View Full Code Here

        , validationListener.getInvokations());
    }
   
    @SuppressWarnings("serial")
    @Test public void shouldTest_conditionalBlocks_simpleOtherwise_whenConditionFails() throws IOException {
        GalenPageActionCheck check = new GalenPageActionCheck();
        check.setSpecs(Arrays.asList(getClass().getResource("/specs/spec-conditional-simple-otherwise.spec").getFile()));
       
        MockedBrowser mockedBrowser = new MockedBrowser("http://galenframework.com", new Dimension(640, 480));
        mockedBrowser.setMockedPage(new MockedPage(new HashMap<String, PageElement>(){{
            put("textfield", new MockedPageElement(0, 0, 100, 100));
            put("button-1", new MockedInvisiblePageElement(0, 0, 100, 100));
            put("button-2", new MockedInvisiblePageElement(0, 0, 100, 100));
        }}));

       
        TestValidationListener validationListener = new TestValidationListener();
        check.execute(new TestReport(), mockedBrowser, new GalenPageTest(), validationListener);
       
        Assert.assertEquals(
                "<o textfield>\n" +
                "<SpecHeight textfield>\n" +
                "</o textfield>\n" +
View Full Code Here

    @Test public void runsTestSuccessfully_inPredefinedBrowser() throws IOException {
        TestValidationListener validationListener = new TestValidationListener();
       
        WebDriver driver = new FirefoxDriver();
       
        GalenPageActionCheck action = new GalenPageActionCheck()
            .withIncludedTags(asList("mobile"))
            .withSpecs(asList("/html/page.spec"));
       
        Browser browser = new SeleniumBrowser(driver);
        browser.load(TEST_URL);
        browser.changeWindowSize(new Dimension(400, 800));
       
        action.execute(new TestReport(), browser, new GalenPageTest(), validationListener);
       
        driver.quit();
       
        assertThat("Invokations should be", validationListener.getInvokations(), is("<o header>\n" +
                "<SpecHeight header>\n" +
View Full Code Here

TOP

Related Classes of net.mindengine.galen.suite.actions.GalenPageActionCheck

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.