Graphene 2.0.0.Alpha4,Selenium 的 Ajax 测试扩展

Graphene 2.0.0.Alpha4 发布了,Graphene 项目的目的是使用类型安全的 API 进行 Ajax 测试,是 Selenium 项目的扩展。

该版本值得关注的改进有:

Highlighted Changes

Guard Improvements and Fixes
Request Guards were polished, extended and hardened. (read more)

Creating Page Fragments Programatically
Page Fragments can now be instantiated not only using dependency injection, but also programatically. (read more)

PhantomJS Support
You can now fully leverage awesomness of headless testing with PhantomJS.

Guarding Programatically Retrieved Elements
Elements retrieved programatically using WebElement#findElement(...) or WebElement#findElements(...) are now guarded against StaleElementReferenceException.

Automatic Inference of Locators
You no longer need to define a locator in simple forms – you can leverage their automatic inference from a injection point name. (read more)

Dependency Injection of SessionStorage and LocalStorage
These resources are now exposed directly via @ArquillianResource.

Dependency Injection of Selenium Resource Parametrized by WebElement
Selenium resources which takes WebElement as an argument in a constructor (e.g. Select) can be injected using FindBy.

Support for FindBys and FindBy(How, String)

Improved Integration with Drone
Drone 1.2.0.Alpha2’s new Enhancer API allow us to integrate with Drone seamlessly.

Deprecations

Deprecation of Old Variant of Waiting Fluent API
Graphene.element(...) and Graphene.attribute(...) are now deprecated and they will be removed in an upcoming releases.

Deprecated guardXhr replaced by guardAjax
Not all of us are familiar with abbreviation XHR (XMLHttpRequest). In order to make the API more clear for most of Graphene users, we have deprecated guardXhr and replaced it with guardAjax. guardXhr will be removed in upcoming releases.

Guard Improvements and Fixes

waitForHttp
When an Ajax request is followed by a relocation (HTTP request), guardXhr or guardHttp can’t deterministically wait for an end of a request – in these situations you can use waitForHttp instead.

Testing delayed requests
Guards now waits for a given time interval for a request to start and once the request is started, they wait the another interval for the request to finish.

Bug Fixes
Guards had problems on Android with deterministic waiting for HTTP requests.

Creating Page Fragments Programatically

Till this release, the only option to create a page fragment was injecting it:

@FindBy(...)
      MyComponent component;

With Alpha4 we have added the possibility to create a page fragment programatically:

public  T getContent(Class clazz) {
          return PageFragmentEnricher.createPageFragment(clazz, root);
      }
@Test
      public void testTabPanelSwitching() {
          Panel tab3 = tabPanel.switchTo(2);
          ContentOfTab content = tab3.getContent(ContentOfTab.class);
          assertEquals("The tab panel was not switched to third tab correctly!", "Content of the tab 3", content.text.getText());

          Panel tab1 = tabPanel.switchTo(0);
          content = tab1.getContent(ContentOfTab.class);
          assertEquals("The tab panel was not switched to first tab correctly!", "Content of the tab 1", content.text.getText());
      }

You can find reference usage in this functional test together with an implementation of #getContent(Class).

Automatic Inference of Locators

How many times you have written:

// look for input with a name 'firstname'
      @FindBy(name = "firstname")
      private WebElement firstname;

You can now simplify your tests to just

@FindBy
      private WebElement firstname;

Graphene will automatically use the strategy How.ID_OR_NAME to locate the element by its ID or name.

Since this mechanism uses the strategy pattern, you can overwrite the default strategy for your test suite and therefore find elements by e.g. their class names or even JSF component IDs.

Roadmap

This release is a maintanance release on the way to Beta1.

What is Arquillian?

Arquillian is open source software that empowers you to test JVM-based applications more effectively. Created to defend the software galaxy from bugs, Arquillian brings your test to the runtime so you can focus on testing your application's behavior rather than managing the runtime. Using Arquillian, you can develop a comprehensive suite of tests from the convenience of your IDE and run them in any IDE, build tool or continuous integration environment.

Release details

Published artifacts org.jboss.arquillian.graphene

  • org.jboss.arquillian.graphene » graphene-build-resources jar pom
  • org.jboss.arquillian.graphene » graphene-component-api jar pom
  • org.jboss.arquillian.graphene » graphene-selenium-api jar pom
  • org.jboss.arquillian.graphene » graphene-selenium-drone jar pom
  • org.jboss.arquillian.graphene » graphene-selenium-ftest-junit-container jar pom
  • org.jboss.arquillian.graphene » graphene-selenium-ftest-junit-standalone jar pom
  • org.jboss.arquillian.graphene » graphene-selenium-ftest-testng-container jar pom
  • org.jboss.arquillian.graphene » graphene-selenium-ftest-testng-standalone jar pom
  • org.jboss.arquillian.graphene » graphene-selenium-impl jar pom
  • org.jboss.arquillian.graphene » graphene-webdriver-ftest jar pom
  • org.jboss.arquillian.graphene » graphene-webdriver-impl jar pom
  • org.jboss.arquillian.graphene » graphene-webdriver-spi jar pom

Release notes and resolved issues 20

Q1/13: PhantomJS

Bug

  • ARQGRA-257 - Guards are not working with AndroidDriver
  • ARQGRA-262 - Element click with HTTP guard causes WebDriverException: ReferenceError: Graphene is not defined
  • ARQGRA-266 - Waiting for presence of element defined by jQuery selector sometimes causes "IllegalStateException: JQueryPageExtension can't be installed"
  • ARQGRA-272 - Introduced waitForHttp (guardXhr does not work for redirected pages)
  • ARQGRA-274 - The request guard does timeout for delayed requests
  • ARQGRA-289 - JavaScript interfaces fails on Chrome and PhantomJS
  • ARQGRA-290 - testAttributeIsPresent fails on Chrome and PhantomJS

Enhancement

  • ARQGRA-199 - Provide a way to create Page Fragments dynamically
  • ARQGRA-235 - Automatically infer ID locator from field name annotated just by @FindBy
  • ARQGRA-250 - Shortcut for waiting on element's attribute value

Feature Request

  • ARQGRA-220 - Locating elements with @FindBy(how = How.ID, using = "foobar") not working
  • ARQGRA-247 - Add support for enriching @FindBys annotations
  • ARQGRA-254 - Expose LocalStorage and SessionStorage enrichments directly
  • ARQGRA-258 - Provide injecting classes requiring WebElement in their constructors via @FindBy annotation
  • ARQGRA-259 - Provide timeout setting in fluent API
  • ARQGRA-273 - Intercept WebDriver to return proxies in findElement()/findElements() methods

Story

  • ARQGRA-286 - Support PhantomJSDriver in Graphene

Task

  • ARQGRA-168 - Create QUnit tests for Graphene.Page.RequestGuard.js
  • ARQGRA-284 - Rename guardXhr to guardAjax
  • ARQGRA-287 - Deprecate Graphene.element and attribute methods
时间: 2024-11-02 23:02:07

Graphene 2.0.0.Alpha4,Selenium 的 Ajax 测试扩展的相关文章

AJAX/XUL Web框架ZK 1.0.0 Final 发布

ajax|web AJAX框架ZK近日宣布,ZK 1.0.0 Final 正式发布. ZK 是一个基于XUL嵌入AJAX事件驱动的Java 框架,用于丰富用户网络应用程序界面.利用该工具,你可以设置你的网络应用程序包含功能丰富的XUL与HTML组件,并且通过监听用户触发事件来轻松的操作这些组件,最大的好处是,可以在服务期端轻松简便的操作就像操作桌面程序一样.ZK是基于GPL发布的. 该新版本中包括,拖放功能,增加了getUserPrincipal用于指定page ID,等等. http://so

Magicodes.NET框架之路——V0.0.0.5 Beta版发布

最近写代码的时间实在不多,而且今年又打算业余学习下Unity3D以及NodeJs(用于开发游戏后台),因此完善框架的时间更不多了.不过我会一直坚持下去的,同时我也希望有兴趣的同学可以加入Push你的代码. 获取地址:https://github.com/magicodes/Magicodes.NET/releases/tag/V1.0.0.5Beta 文档地址:https://worktile.com/project/4a961c1c28cf4b07bdb4a07f661c7fcf/folder

Announcing YUI Test 1.0.0 Beta 2发布

YUI测试是一款基于浏览器,提供解决方案的测试框架.使用YUI,您可以方便地添加单元测试,寻求http://www.aliyun.com/zixun/aggregation/33906.html">JavaScript解决方案.它是由Yahoo! UI Library开发的一个JavaScriptMVC测试插件,能够让你模范大部分DOM动作,比如写,拖拽,比如模范AJAX响应,并且能够使用断言 (assertions).它能够象函数一样运行,并且能够在不同的console窗口进行集成测试.

Andorid 关于PTRACE ptrace(PTRACE_TRACEME,0 ,0 ,0);

通过对App进行加固保护,梆梆可以有效防止移动应用在运营推广过程中被破解.盗版.二次打包.注入.反编译等破坏,保障程序的安全性.稳定性,对移动应用的整体逻辑结构进行保护,保证了移动应用的用户体验. 一.梆梆加固逆向分析过程 首先我们通过对APK加固前后文件结构的比较,来了解梆梆加固对APK文件所做的处理.为了使分析过程足够简单,我新建一个最简单的测试程序,并上传到梆梆加固,整个加固过程大概需要4天的时间才可以完成,这是一个漫长的等待过程. 该测试程序包含了Activity.Service.Con

为什么有时PHP程序会在开头显示:X-Powered-By: PHP/4.0.0之类的字符呢?

程序|显示 这是因为PHP.INI中有一些设置不对,最有可能是就是有无效的DLL文件在内.但为什么会出现这些呢?我在WIN32下,建了一个空的test.php文件.然后执行c:\php4\php.exe test.php,此时我的php.ini的配置是正确的.屏幕输出为:X-Powered-By: PHP/4.0.0Content-type: text/html咦,这不是显示在屏幕上的东西吗?是的.但这时这两行是作HTTP信息头的.是不会显示在浏览器中的. 现在我在php.ini中加载了php_

PHP 4.0.0中session.save

session PHP 4.0.0中session.save_path的bug 作者/ 这里向大家汇报我发现的一个4.0.0版的一个bug,只限于windows版本.那就是:在4.0.0版下,session.save_path如果使用绝对目录,即加上盘符的话,盘符不起作用.如session.save_path设为c: emp,此时存在c: emp目录.但是当php程序文件在其它盘上时,如在f盘上,c:不起作用.而是在处理session时寻找f盘上的 emp目录.如果f盘上无 emp目录,则会报如

Eclipse插件之WebLogic Plugin 2.0.0

web 本文介绍如何利用Eclipse插件WebLogic Plugin在Eclipse中的使用. Eclipse是目前非常流行的开发平台,开放扩展的架构让很多程序员找到了自己个性化的工作环境. 问题提出: WebLogic目前是使用比较多的应用服务器之一,Eclipse是流行的IDE,如何集成起来开发使用呢? 解决方法: 采用BEA提供的WebLogic Plugin来进行集成开发. 安装 JDK:1.4.2或1.5.0 从http://java.sun.com上去下载安装,如果是WebLog

XCache 2.0.0 发布,提升 PHP 运行性能

  XCache 2.0.0 发布,该版本支持 PHP 5.4.硬链接文件以及 __FILE__ __DIR__. XCache 是一个开源的 opcode 缓存器/优化器, 这意味着他能够提高您服务器上的 PHP 性能. 他通过把编译 PHP 后的数据缓冲到共享内存从而避免重复的编译过程, 能够直接使用缓冲区已编译的代码从而提高速度. 通常能够提高您的页面生成速率 2 到5 倍, 降低服务器负载.

Zend Studio-8.0.0中文汉化教程

之前一直使用Zend Studio7调试PHP,最近打算开始使用Zend Studio8,昨天装了Zend Studio 8后打算使用Zend Studio中文版,网上找了下在线的Zend Studio 8 汉化包对Zend Studio8进行汉化,感觉非常方便,这对于喜欢使用Zend Studio中文版的朋友来说真是福音,现分享下Zend Studio 8 汉化的具体过程. Zend Studio 8 汉化第一步:安装Zend Studio 8 在进行Zend Studio 8 汉化之前,当然