madbob/dusk-utils

一些用于Laravel Dusk单元测试的实用工具。

0.1.0 2021-11-14 09:39 UTC

This package is auto-updated.

Last update: 2024-09-14 15:07:42 UTC


README

一些用于 Laravel Dusk 的单元测试实用工具。

  • typeAtXPath($expression, $value):类似于原生的 type,但使用XPath表达式作为目标
  • assertInputValueAtXPath($expression, $value):类似于原生的 assertInputValue,但使用XPath表达式作为目标
  • assertSeeAtXPath($expression, $value):类似于原生的 assertSee,但使用XPath表达式作为目标
  • scrollView($selector):类似于原生的 scrollIntoView,但滚动到视口末尾的元素,而不是开始位置
  • scrollTop():滚动视口到顶部
  • scrollBottom():滚动视口到底部
  • mainScreenshot($filename):类似于原生的 screenshot,但在拍照前将视口滚动到顶部

安装

composer require madbob/dusk-utils

然后在您首选的服务提供者(AppServiceProvider?)的 boot() 函数中添加以下行

\MadBob\DuskUtils\Utils::init();

以初始化额外的宏。