Package net.mindengine.galen.browser

Examples of net.mindengine.galen.browser.Browser


        }
    }

    private void performPageDump(GalenArguments arguments) throws Exception {
        SeleniumBrowserFactory browserFactory = new SeleniumBrowserFactory();
        Browser browser = browserFactory.openBrowser();

        try {

            if (arguments.getUrl() == null || arguments.getUrl().isEmpty()) {
                throw new SyntaxException("--url parameter is not defined");
            }
            if (arguments.getPaths() == null || arguments.getPaths().size() == 0) {
                throw new SyntaxException("You should specify a spec file with which you want to make a page dump");
            }
            if (arguments.getExport() == null || arguments.getExport().isEmpty()) {
                throw new SyntaxException("--export parameter is not defined");
            }


            if (arguments.getScreenSize() != null) {
                browser.changeWindowSize(arguments.getScreenSize());
            }

            browser.load(arguments.getUrl());

            Galen.dumpPage(browser, arguments.getUrl(), arguments.getPaths().get(0), arguments.getExport(), arguments.getMaxWidth(), arguments.getMaxHeight());
            System.out.println("Done!");
        }
        catch (Exception ex) {
            throw ex;
        }
        finally {
            browser.quit();
        }
    }
View Full Code Here


       
        for (GalenPageTest pageTest : pageTests) {
            report.gotoRoot();
            report.sectionStart(pageTest.getTitle());
           
            Browser browser = pageTest.getBrowserFactory().openBrowser();

            try {
                pageRunner.run(browser, pageTest);
            }
            catch (Exception ex) {
                ex.printStackTrace();
                report.error(ex);
            }
           
            browser.quit();
            report.sectionEnd();
        }
       
        return report;
    }
View Full Code Here

public class GalenPageActionRunJavascriptTest {
    private static final String TEST_URL = "file://" + GalenPageActionCheckTest.class.getResource("/html/page-for-js-check.html").getPath();
   
    @Test public void shouldRun_javascriptFile_andPerformActions_onBrowser() throws Exception {
        WebDriver driver = new FirefoxDriver();
        Browser browser = new SeleniumBrowser(driver);
        browser.load(TEST_URL);
       
        WebElement element = driver.findElement(By.id("search-query"));
        assertThat("Search input should not contain any text yet", element.getAttribute("value"), is(""));
       
        GalenPageActionRunJavascript action = new GalenPageActionRunJavascript(getClass().getResource("/scripts/to-run-1.js").getFile());
        action.setJsonArguments("{prefix: 'This was'}");
       
        action.execute(new TestReport(), browser, new GalenPageTest(), null);
       
        assertThat("Search input should contain text", element.getAttribute("value"), is("This was typed by a selenium from javascript text from imported script"));
        browser.quit();
    }
View Full Code Here

public class GalenPageActionInjectJavascriptTest {
    private static final String TEST_URL = "file://" + GalenPageActionCheckTest.class.getResource("/html/page1.html").getPath();
   
    @Test public void shouldInject_javascript() throws IOException {
        WebDriver driver = new FirefoxDriver();
        Browser browser = new SeleniumBrowser(driver);
        browser.load(TEST_URL);
       
        GalenPageActionInjectJavascript action = new GalenPageActionInjectJavascript("/scripts/to-inject-1.js");
        action.execute(new TestReport(), browser, new GalenPageTest(), null);
       
        WebElement element = driver.findElement(By.xpath("//body/injected-tag"));
       
        assertThat("Inject tags text should be", element.getText(), is("Some injected content"));
        browser.quit();
    }
View Full Code Here

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

        GalenPageActionCheck action = new GalenPageActionCheck()
            .withIncludedTags(asList("mobile"))
            .withExcludedTags(asList("debug"))
            .withSpecs(asList("/html/page-exclusion.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" +
View Full Code Here

TOP

Related Classes of net.mindengine.galen.browser.Browser

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.