Package net.mindengine.galen.components

Examples of net.mindengine.galen.components.MockedBrowser


    @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));
        }}));
       
View Full Code Here


    @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));
        }}));
       
View Full Code Here

    @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));
        }}));
View Full Code Here

    @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));
        }}));
View Full Code Here

    @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));
        }}));
View Full Code Here

import org.testng.annotations.Test;

public class GalenPageActionCookieTest {

    @Test public void shouldSetCookie_andRefreshPage() throws Exception {
        MockedBrowser browser = new MockedBrowser("", new Dimension(1024, 768));
       
        GalenPageActionCookie action = new GalenPageActionCookie();
       
        action.setCookies(Arrays.asList("cookieName1=cookieValue1; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/", "cookieName2=cookieValue2; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/"));
        action.execute(new TestReport(), browser, new GalenPageTest(), null);
       
        List<String> recordedActions = browser.getRecordedActions();
       
        assertThat(recordedActions, contains("executeJavascript\ndocument.cookie=\"cookieName1=cookieValue1; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/\";" +
                                                            "document.cookie=\"cookieName2=cookieValue2; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/\";",
                                          "refresh"));
    }
View Full Code Here

   
    @Test
    public void shouldProvide_browser_withJsFactory() {
        JsBrowserFactory browserFactory = new JsBrowserFactory(getClass().getResource("/browser/js-browser-init.js").getFile(), new String[]{"http://example2.com"});
       
        MockedBrowser browser = (MockedBrowser)browserFactory.openBrowser();
        Assert.assertEquals("http://example2.com", browser.getUrl());
        Assert.assertEquals(new Dimension(320, 240), browser.getScreenSize());
    }
View Full Code Here

                until(UntilType.VISIBLE, css("div.list")),
                until(UntilType.HIDDEN, id("qwe")),
                until(UntilType.EXIST, xpath("//div[@id='wqe']")),
                until(UntilType.GONE, css("qweqwewqee"))
                ));
        MockedBrowser browser = new MockedBrowser(null, null);
        browser.setMockedPage(mockedPage);
        wait.execute(new TestReport(), browser, null, null);
    }
View Full Code Here

                until(UntilType.HIDDEN, css("div.list")),
                until(UntilType.VISIBLE, id("qwe")),
                until(UntilType.GONE, xpath("//div[@id='wqe']")),
                until(UntilType.EXIST, css("qweqwewqee"))
                ));
        MockedBrowser browser = new MockedBrowser(null, null);
        browser.setMockedPage(mockedPage);
       
       
        TimeoutException exception = null;
        try {
            wait.execute(new TestReport(), browser, null, null);
View Full Code Here

TOP

Related Classes of net.mindengine.galen.components.MockedBrowser

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.