ScalaTest:使用多个浏览器测试网络应用程序

ScalaTest: testing web apps with multiple browsers

我正在尝试对具有多个浏览器(Chrome、Firefox、InternetExplorer 等)的 Web 应用程序进行相同的集成测试。

ScalaTest plus Play 具有 AllBrowsersPerTest 和 AllBrowsersPerSuite 这些特征。有没有人写过类似但没有绑定到网络框架的东西? (我正在测试的网络应用程序是基于 Wicket,而不是 Play。)

我能够使用 PageObject 解决我的问题。

PageObject 默认使用所有可用的浏览器(即配置了 WebDriver 的浏览器)(在我的例子中是 Firefox、Chrome 和 Internet Explorer)。

这些是我的依赖项:

<dependency>
    <groupId>org.pageobject</groupId>
    <artifactId>scalatest_${scalaBinaryVersion}</artifactId>
    <version>0.1.0</version>
</dependency>
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.0.1</version>
</dependency>

我发现 PageObjectTour 的代码有助于入门。

注意:PageObject 0.1.0 使用自己的 ScalaTest 3.0.0 版本,因为 a bug 尚未在 ScalaTest 主干中修复。所以我不得不删除自己对 org.scalatest:scalatest.

的依赖