Package net.mindengine.galen.tests

Examples of net.mindengine.galen.tests.GalenBasicTest


        verifyArgumentsForPageCheck(arguments);
       
        List<GalenTest> galenTests = new LinkedList<GalenTest>();
       
        for (String pageSpecPath : arguments.getPaths()) {
            GalenBasicTest test = new GalenBasicTest();
            test.setName(pageSpecPath);
            test.setPageTests(asList(new GalenPageTest()
                .withTitle("Simple check")
                .withUrl(arguments.getUrl())
                .withSize(arguments.getScreenSize())
                .withBrowserFactory(new SeleniumBrowserFactory(SeleniumBrowserFactory.FIREFOX))
                .withActions(asList((GalenPageAction)new GalenPageActionCheck()
View Full Code Here


        return pageNode;
    }

    @Override
    public GalenBasicTest build(VarsContext context) {
        GalenBasicTest suite = new GalenBasicTest();
        List<GalenPageTest> pageTests = new LinkedList<GalenPageTest>();
      
        suite.setName(context.process(getArguments()));
        suite.setPageTests(pageTests);
       
        for (Node<?> childNode : getChildNodes()) {
            if (childNode instanceof PageNode) {
                PageNode pageNode = (PageNode) childNode;
                pageTests.add(pageNode.build(context));
View Full Code Here

        List<GalenBasicTest> galenSuites = reader.read(new File(getClass().getResource("/suites/suite-simple.test").getFile()));
       
        assertThat("Amount of suites should be", galenSuites.size(), is(2));
        /* Checking suite 1*/
        {
            GalenBasicTest suite = galenSuites.get(0);
            assertThat(suite.getName(), is("This is a name of suite"));
            assertThat("Amount of pages for 1st suite should be", suite.getPageTests().size(), is(2));
            // Checking page 1
            {
                GalenPageTest page = suite.getPageTests().get(0);
                assertThat(page.getTitle(), is("This is title for page"));
                assertThat(page.getUrl(), is("http://example.com/page1"));
                assertThat(page.getScreenSize(), is(new Dimension(640, 480)));
               
                assertThat(page.getActions(), is(actions(GalenPageActions.injectJavascript("javascript.js"),
                        GalenPageActions.check(asList("page1.spec")).withIncludedTags(asList("mobile", "tablet")).withExcludedTags(asList("nomobile")),
                        GalenPageActions.injectJavascript("javascript2.js"),
                        GalenPageActions.runJavascript("selenium/loginToMyProfile.js").withArguments("{\"login\":\"user1\", \"password\": \"test123\"}"),
                        GalenPageActions.check(asList("page1_1.spec", "page1_2.spec", "page1_3.spec")).withIncludedTags(asList("sometag"))
                        )));
            }
           
            //Checking page 2
            {
                GalenPageTest page = suite.getPageTests().get(1);
                assertThat(page.getTitle(), is("http://example.com/page2    1024x768"));
                assertThat(page.getUrl(), is("http://example.com/page2"));
                assertThat(page.getScreenSize(), is(new Dimension(1024, 768)));
               
                assertThat(page.getActions(), is(actions(GalenPageActions.check(asList("page2.spec")),
                        (GalenPageAction)GalenPageActions.check(asList("page3.spec")))));
            }
        }
       
        // Checking suite 2
        {
            GalenBasicTest suite = galenSuites.get(1);
            assertThat(suite.getName(), is("This is another suite name"));
            assertThat("Amount of pages for 1st suite should be", suite.getPageTests().size(), is(1));
           
            GalenPageTest page = suite.getPageTests().get(0);
            assertThat(page.getUrl(), is("http://example.com/page3"));
            assertThat(page.getScreenSize(), is(new Dimension(320, 240)));
           
            assertThat(page.getActions(), is(actions(GalenPageActions.check(asList("page3.spec")))));
        }
View Full Code Here

       
        assertThat("Amount of suites should be", galenSuites.size(), is(2));
       
        /* Checking suite 1*/
        {
            GalenBasicTest suite = galenSuites.get(0);
            assertThat(suite.getName(), is("This is a name of suite"));
            assertThat("Amount of pages for 1st suite should be", suite.getPageTests().size(), is(1));
            // Checking page 1
           
            GalenPageTest page = suite.getPageTests().get(0);
            assertThat(page.getUrl(), is("http://example.com/some-page.html"));
            assertThat(page.getScreenSize(), is(new Dimension(640, 480)));
           
            assertThat(page.getActions(), is(actions(
                    GalenPageActions.runJavascript("selenium/loginToMyProfile.js").withArguments("{\"myvar\" : \"suite\", \"var_concat\" : \"some-page.html and 640x480\"}")
                    )));
      
        }
       
        // Checking suite 2
        {
            GalenBasicTest suite = galenSuites.get(1);
            assertThat(suite.getName(), is("This is a name of suite 2 and also custom property"));
            assertThat("Amount of pages for 1st suite should be", suite.getPageTests().size(), is(1));
           
            GalenPageTest page = suite.getPageTests().get(0);
            assertThat(page.getUrl(), is("http://example.com/some-page.html"));
            assertThat(page.getScreenSize(), is(new Dimension(640, 480)));
           
            assertThat(page.getActions(), is(actions(
                    GalenPageActions.runJavascript("selenium/loginToMyProfile.js").withArguments("{\"myvar\" : \"suite 2\"}")
View Full Code Here

            Object [][] table = new Object[][]{
                {new Dimension(320, 240), asList("mobile"), "Phone", asList("nomobile")},
                {new Dimension(640, 480), asList("tablet"), "Tablet", EMPTY_TAGS}
            };
            for (int i=0; i<2; i++) {
                GalenBasicTest suite = galenSuites.get(i);
                assertThat(suite.getName(), is("Test for " + table[i][2]));
                assertThat("Amount of pages for 1st suite should be", suite.getPageTests().size(), is(1));
                // Checking page 1
               
                GalenPageTest page = suite.getPageTests().get(0);
                assertThat(page.getUrl(), is("http://example.com/page1"));
                assertThat(page.getScreenSize(), is((Dimension)table[i][0]));
               
                assertThat(page.getActions(), is(actions(
                        GalenPageActions.check(asList("page1.spec")).withIncludedTags((List<String>) table[i][1]).withExcludedTags((List<String>) table[i][3])
                        )));
            }
        }
       
        /* Checking second group of suites */
        {
            Object [][] table = new Object[][]{
                {new Dimension(320, 240), asList("mobile"), "Phone", asList("nomobile")"page1"},
                {new Dimension(640, 480), asList("tablet"), "Tablet", EMPTY_TAGS,          "page2"},
                {new Dimension(1024, 768), asList("desktop"), "Desktop", asList("nodesktop"), "page3"}
            };
            for (int i=2; i<5; i++) {
                int j = i - 2;
                GalenBasicTest suite = galenSuites.get(i);
                assertThat(suite.getName(), is("Test combining 2 tables for " + table[j][2]));
                assertThat("Amount of pages for 1st suite should be", suite.getPageTests().size(), is(1));
                // Checking page 1
               
                GalenPageTest page = suite.getPageTests().get(0);
                assertThat(page.getUrl(), is("http://example.com/" + table[j][4]));
                assertThat(page.getScreenSize(), is((Dimension)table[j][0]));
               
                assertThat(page.getActions(), is(actions(
                        GalenPageActions.check(asList("page1.spec")).withIncludedTags((List<String>) table[j][1]).withExcludedTags((List<String>) table[j][3])
                        )));
            }
        }
       
        /* Checking 3rd group of suites */
        {
           
            Object[][] table = new Object[][]{
                {new Dimension(320, 240), asList("mobile"), "Phone", asList("nomobile")"page1", "firefox", "Firefox", "any"},
                {new Dimension(640, 480), asList("tablet"), "Tablet", EMPTY_TAGS,          "page2", "firefox", "Firefox", "any"},
               
                {new Dimension(320, 240), asList("mobile"), "Phone", asList("nomobile")"page1", "ie", "IE 8", "8"},
                {new Dimension(640, 480), asList("tablet"), "Tablet", EMPTY_TAGS,          "page2", "ie", "IE 8", "8"},
               
                {new Dimension(320, 240), asList("mobile"), "Phone", asList("nomobile")"page1", "ie", "IE 9", "9"},
                {new Dimension(640, 480), asList("tablet"), "Tablet", EMPTY_TAGS,          "page2", "ie", "IE 9", "9"},
            };
           
           
            for (int i=5; i<11; i++) {
                int j = i - 5;
                GalenBasicTest suite = galenSuites.get(i);
                assertThat(suite.getName(), is("Test using 2 layer tables in browser " + table[j][6] + " for type " + table[j][2]));
                assertThat("Amount of pages for 1st suite should be", suite.getPageTests().size(), is(1));
                // Checking page 1
               
                GalenPageTest page = suite.getPageTests().get(0);
                assertThat(page.getBrowserFactory(), is((BrowserFactory)new SeleniumGridBrowserFactory("http://mygrid:8080/wd/hub")
                                                          .withBrowser((String)table[j][5])
                                                          .withBrowserVersion((String)table[j][7])
                ));
                assertThat(page.getUrl(), is("http://example.com/" + table[j][4]));
View Full Code Here

    private static String comparisonMapImagePath = ReportingListenerTestUtils.class.getResource("/imgs/page-sample-correct.png").getFile();

    public static void performSampleReporting(String suiteName, TestListener testListener, ValidationListener validationListener, SuiteListener suiteListener) throws IOException {
       
        GalenBasicTest suite = new GalenBasicTest();
        suite.setName(suiteName);
       
        if (testListener != null) testListener.onTestStarted(suite);
       
        GalenPageRunner pageRunner = new GalenPageRunner(new TestReport());
       
View Full Code Here

TOP

Related Classes of net.mindengine.galen.tests.GalenBasicTest

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.