Testing with Playwright
本文档概述了使用 Playwright 测试 webforJ 应用程序的过程,特别关注 webforj-archetype-hello-world 中的 HelloWorldView。
应用基础
要了解有关 webforj-archetype-hello-world 的更多信息,请参阅 应用基础介绍 部分。
前提条件
在编写和运行 Playwright 测试之前,请确保以下事项:
- webforJ 应用程序已正确设置并在本地服务器上运行。
- 您已安装:
- Playwright Java 绑定。
- 兼容的浏览器(Playwright 可以在设置过程中自动安装浏览器)。
- 用于项目依赖的 Maven。
Maven 配置
在您的 pom.xml 中添加 Playwright 所需的依赖项:
pom.xml
<dependencies>
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>playwright</artifactId>
<version>1.49.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>