当前位置: 首页>>代码示例>>Java>>正文


Java Galen类代码示例

本文整理汇总了Java中com.galenframework.api.Galen的典型用法代码示例。如果您正苦于以下问题:Java Galen类的具体用法?Java Galen怎么用?Java Galen使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Galen类属于com.galenframework.api包,在下文中一共展示了Galen类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkLayout

import com.galenframework.api.Galen; //导入依赖的package包/类
protected void checkLayout(String specPath, GalenTestInfo test, String reportTitle,
                           SectionFilter sectionFilter, Properties properties, Map<String, Object> jsVariables)
        throws IOException {
    TestReport report = test.getReport();
    // ensure we reset test statistic before each call
    testStatistic = new TestStatistic();
    layoutReport = Galen.checkLayout(getDriver(), specPath, sectionFilter, properties, jsVariables);

    // Adding layout report to the test report
    report.layout(layoutReport, reportTitle);
    testStatistic = report.fetchStatistic();

    ALL_TESTS.add(test);
    // re-set name for next test
    setLayoutCheckName(null);
}
 
开发者ID:fhoeben,项目名称:hsac-fitnesse-fixtures,代码行数:17,代码来源:LayoutTest.java

示例2: importAllMajorClasses

import com.galenframework.api.Galen; //导入依赖的package包/类
private void importAllMajorClasses() {
    importClasses(new Class[]{
            Thread.class,
            By.class,
            WebElement.class,
            WebDriver.class,
            System.class,
            Actions.class,
            GalenTest.class,
            TestSession.class,
            GalenUtils.class,
            GalenJsApi.class,
            TestEvent.class,
            TestSuiteEvent.class,
            TestFilterEvent.class,
            TestRetryEvent.class,
            Galen.class,
            GalenPageDump.class
    });
}
 
开发者ID:galenframework,项目名称:galen,代码行数:21,代码来源:GalenJsExecutor.java

示例3: checkLayout_shouldTestLayout_andReturnLayoutReport

import com.galenframework.api.Galen; //导入依赖的package包/类
@Test
public void checkLayout_shouldTestLayout_andReturnLayoutReport() throws IOException {
    WebDriver driver = new MockedDriver();
    driver.get("/mocks/pages/galen4j-sample-page.json");

    LayoutReport layoutReport = Galen.checkLayout(driver, "/specs/galen4j/sample-spec-with-error.spec", new SectionFilter(asList("mobile"), null), new Properties(), null, null);

    assertThat(layoutReport.getValidationErrorResults(), contains(
            new ValidationResult(NO_SPEC,
                    asList(
                            new ValidationObject(new Rect(10, 10, 100, 50), "save-button"),
                            new ValidationObject(new Rect(120, 10, 200, 50), "name-textfield")),
                    new ValidationError().withMessage("\"save-button\" is 10px left instead of 50px")),
            new ValidationResult(NO_SPEC,
                    asList(
                            new ValidationObject(new Rect(10, 10, 100, 50), "save-button")),
                    new ValidationError().withMessage("\"save-button\" text is \"Save\" but should be \"Store\""))));
}
 
开发者ID:galenframework,项目名称:galen,代码行数:19,代码来源:GalenTest.java

示例4: checkLayout_shouldGiveErrors_ifCustomRules_areFailed

import com.galenframework.api.Galen; //导入依赖的package包/类
/**
 * comes from https://github.com/galenframework/galen/issues/324
 */
@Test
public void checkLayout_shouldGiveErrors_ifCustomRules_areFailed() throws IOException {
    WebDriver driver = new MockedDriver();
    driver.get("/mocks/pages/galen4j-sample-page.json");

    LayoutReport layoutReport = Galen.checkLayout(driver, "/specs/galen4j/custom-rules-failure.spec", new SectionFilter(null, null), new Properties(), null, null);

    assertThat(layoutReport.errors(), is(2));
    assertThat(layoutReport.getValidationErrorResults(), contains(
            new ValidationResult(NO_SPEC,
                    asList(
                            new ValidationObject(new Rect(10, 10, 100, 50), "save-button")),
                    new ValidationError().withMessage("\"save-button\" width is 100px instead of 140px")),
            new ValidationResult(NO_SPEC,
                    asList(
                            new ValidationObject(new Rect(10, 10, 100, 50), "save-button")),
                    new ValidationError().withMessage("\"save-button\" width is 200% [100px] instead of 100% [50px]"))));
}
 
开发者ID:galenframework,项目名称:galen,代码行数:22,代码来源:GalenTest.java

示例5: componentSpec_shouldAllowToExecute_2ndLevel_componentSpec

import com.galenframework.api.Galen; //导入依赖的package包/类
/**
 * Comes from bug https://github.com/galenframework/galen/issues/353
 * @throws IOException
 */
@Test
public void componentSpec_shouldAllowToExecute_2ndLevel_componentSpec() throws IOException {
    loadPage("/2nd-level-component/index.html");
    LayoutReport layoutReport = Galen.checkLayout(driver, findSpec("/2nd-level-component/quote-containers.gspec"), Collections.<String>emptyList());

    assertThat("Amount of failures should be", layoutReport.errors(), is(1));

    ValidationResult firstValidationError = layoutReport.getValidationErrorResults().get(0);
    assertThat(firstValidationError.getError().getMessages().get(0), is("Child component spec contains 1 errors"));

    ValidationResult secondValidationError = firstValidationError.getChildValidationResults().get(0);
    assertThat(secondValidationError.getError().getMessages().get(0), is("Child component spec contains 1 errors"));

    ValidationResult thirdValidationError = secondValidationError.getChildValidationResults().get(0);
    assertThat(thirdValidationError.getError().getMessages().get(0), is("\"name\" text is \"Buggy component\" but should start with \"Title\""));
}
 
开发者ID:galenframework,项目名称:galen,代码行数:21,代码来源:ComponentBasicIT.java

示例6: checkLayout

import com.galenframework.api.Galen; //导入依赖的package包/类
/**
 * Needed for Javascript based tests
 * @param driver
 * @param fileName
 * @param includedTags
 * @param excludedTags
 * @param screenshotFilePath
 * @throws IOException
 */
public static LayoutReport checkLayout(WebDriver driver, String fileName, String[]includedTags, String[]excludedTags,
                               Properties properties, String screenshotFilePath, JsVariable[] vars, JsPageObject[] jsPageObjects) throws IOException {

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

    TestReport report = session.getReport();

    File screenshotFile = null;

    if (screenshotFilePath != null) {
        screenshotFile = new File(screenshotFilePath);
        if (!screenshotFile.exists() || !screenshotFile.isFile()) {
            throw new IOException("Couldn't find screenshot in " + screenshotFilePath);
        }
    }

    if (fileName == null) {
        throw new IOException("Spec file name is not defined");
    }

    List<String> includedTagsList = toList(includedTags);

    Map<String, Object> jsVariables = convertJsVariables(vars);

    LayoutReport layoutReport = Galen.checkLayout(new SeleniumBrowser(driver), fileName,
            new SectionFilter(includedTagsList, toList(excludedTags)),
            properties,
            jsVariables,
            screenshotFile,
            session.getListener(), convertObjects(jsPageObjects));

    GalenUtils.attachLayoutReport(layoutReport, report, fileName, includedTagsList);
    return layoutReport;
}
 
开发者ID:galenframework,项目名称:galen,代码行数:47,代码来源:GalenJsApi.java

示例7: checkPageSpecLayout

import com.galenframework.api.Galen; //导入依赖的package包/类
/**
 * Used in GalenApi.js
 * @param driver
 * @param pageSpec
 * @param includedTags
 * @param excludedTags
 * @param screenshotFilePath
 * @return
 * @throws IOException
 */
public static LayoutReport checkPageSpecLayout(WebDriver driver, PageSpec pageSpec, String[]includedTags, String[]excludedTags,
                                       String screenshotFilePath) throws IOException {
    TestSession session = TestSession.current();
    if (session == null) {
        throw new UnregisteredTestSession("Cannot check layout as there was no TestSession created");
    }

    TestReport report = session.getReport();

    File screenshotFile = null;

    if (screenshotFilePath != null) {
        screenshotFile = new File(screenshotFilePath);
        if (!screenshotFile.exists() || !screenshotFile.isFile()) {
            throw new IOException("Couldn't find screenshot in " + screenshotFilePath);
        }
    }

    if (pageSpec == null) {
        throw new IOException("Page spec is not defined");
    }

    List<String> includedTagsList = toList(includedTags);

    LayoutReport layoutReport = Galen.checkLayout(new SeleniumBrowser(driver), pageSpec,
            new SectionFilter(includedTagsList, toList(excludedTags)),
            screenshotFile,
            session.getListener());

    GalenUtils.attachLayoutReport(layoutReport, report, "<unknown>", includedTagsList);
    return layoutReport;
}
 
开发者ID:galenframework,项目名称:galen,代码行数:43,代码来源:GalenJsApi.java

示例8: shouldTest_componentFrameSpec_andReportFailureProperly

import com.galenframework.api.Galen; //导入依赖的package包/类
@Test
public void shouldTest_componentFrameSpec_andReportFailureProperly() throws IOException {
    LayoutReport layoutReport = Galen.checkLayout(driver, findSpec("/frame-page/failed.spec"), asList("desktop"));


    assertThat(layoutReport.getValidationErrorResults().size(), is(1));
    ValidationResult validationResult = layoutReport.getValidationErrorResults().get(0);

    assertThat(validationResult.getValidationObjects().size(), is(1));
    ValidationObject validationObject = validationResult.getValidationObjects().get(0);

    assertThat(validationObject.getArea().getLeft(), is(8));
    assertThat(validationObject.getArea().getTop(), greaterThan(30));
    assertThat(validationObject.getArea().getTop(), lessThan(35));
    assertThat(validationObject.getArea().getWidth(), greaterThan(300));
    assertThat(validationObject.getArea().getWidth(), lessThan(304));
    assertThat(validationObject.getArea().getHeight(), greaterThan(150));
    assertThat(validationObject.getArea().getHeight(), lessThan(154));

    assertThat(validationResult.getError(), is(new ValidationError(asList("Child component spec contains 1 errors"))));

    List<ValidationResult> childResults = validationResult.getChildValidationResults();
    assertThat(childResults.size(), is(1));

    assertThat("validation error should match regex",
            childResults.get(0).getError().getMessages().get(0).matches("\"frame-link\" height is (20|21|22|23|24|25)px instead of 40px"),
            is(true));
}
 
开发者ID:galenframework,项目名称:galen,代码行数:29,代码来源:ComponentFrameIT.java

示例9: componentSpec_shouldAllowToProvide_arguments_fromParentSpec

import com.galenframework.api.Galen; //导入依赖的package包/类
@Test
public void componentSpec_shouldAllowToProvide_arguments_fromParentSpec() throws IOException {
    loadPage("/complex-page/index.html");
    LayoutReport layoutReport = Galen.checkLayout(driver, findSpec("/complex-page/using-component-arguments.gspec"), asList("desktop"));

    assertThat("Amount of failures should be", layoutReport.errors(), is(1));

    assertThat(layoutReport.getValidationErrorResults().get(0).getChildValidationResults().get(0).getError().getMessages().get(0),
            is("\"message\" text is \"OMG!\" but should be \"Cool!\""));
}
 
开发者ID:galenframework,项目名称:galen,代码行数:11,代码来源:ComponentBasicIT.java

示例10: componentSpec_shouldWarn_ifThereAreWarnings_inChildren

import com.galenframework.api.Galen; //导入依赖的package包/类
@Test
public void componentSpec_shouldWarn_ifThereAreWarnings_inChildren() throws IOException {
    loadPage("/complex-page/index.html");

    LayoutReport layoutReport = Galen.checkLayout(driver, findSpec("/complex-page/using-component-warnings.gspec"), asList("desktop"));

    assertThat("Amount of failures should be", layoutReport.errors(), is(0));
    assertThat("Amount of warnings should be", layoutReport.warnings(), is(1));

    assertThat(layoutReport.getValidationErrorResults().get(0).getChildValidationResults().get(0).getError().getMessages().get(0),
        is("\"message\" text is \"OMG!\" but should be \"Cool!\""));
}
 
开发者ID:galenframework,项目名称:galen,代码行数:13,代码来源:ComponentBasicIT.java

示例11: checkLayout

import com.galenframework.api.Galen; //导入依赖的package包/类
/**
 * Checks layout of the page that is currently open in current thread. Takes driver from ThreadLocal
 *
 * @param specPath     a path to galen spec file
 * @param sectionFilter a filter that is used for "@on" filtering in specs
 * @param properties   a set of properties that will be accessible in special galen spec expressions.
 * @param vars         JavaScript variables that will be available in special galen spec expressions
 * @throws IOException
 */
public void checkLayout(String specPath, SectionFilter sectionFilter,  Properties properties, Map<String, Object> vars) throws IOException {
    String title = "Check layout " + specPath;
    LayoutReport layoutReport = Galen.checkLayout(getDriver(), specPath, sectionFilter, properties, vars);
    getReport().layout(layoutReport, title);

    if (layoutReport.errors() > 0) {
        throw new LayoutValidationException(specPath, layoutReport, sectionFilter);
    }
}
 
开发者ID:galenframework,项目名称:galen,代码行数:19,代码来源:GalenJavaTestBase.java

示例12: execute

import com.galenframework.api.Galen; //导入依赖的package包/类
@Override
public void execute(TestReport report, Browser browser, GalenPageTest pageTest, ValidationListener validationListener) throws IOException {
    SectionFilter sectionFilter = new SectionFilter(getIncludedTags(), getExcludedTags());
    LayoutReport layoutReport = Galen.checkLayout(browser, specPath, sectionFilter, getCurrentProperties(), jsVariables, NO_SCREENSHOT, validationListener);
    GalenUtils.attachLayoutReport(layoutReport, report, specPath, includedTags);
}
 
开发者ID:galenframework,项目名称:galen,代码行数:7,代码来源:GalenPageActionCheck.java

示例13: shouldTest_componentFrameSpec_successfully

import com.galenframework.api.Galen; //导入依赖的package包/类
@Test
public void shouldTest_componentFrameSpec_successfully() throws IOException {
    LayoutReport layoutReport = Galen.checkLayout(driver, findSpec("/frame-page/passed.spec"), asList("desktop"));
    assertThat("Layout report should not have any errors",
            layoutReport.getValidationErrorResults(), is(emptyCollectionOf(ValidationResult.class)));
}
 
开发者ID:galenframework,项目名称:galen,代码行数:7,代码来源:ComponentFrameIT.java


注:本文中的com.galenframework.api.Galen类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。