Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/382.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cumber正在测试Javascript倒计时_Javascript_Ruby On Rails_Cucumber_Capybara - Fatal编程技术网

Cumber正在测试Javascript倒计时

Cumber正在测试Javascript倒计时,javascript,ruby-on-rails,cucumber,capybara,Javascript,Ruby On Rails,Cucumber,Capybara,我正在构建一个Rails应用程序,它有一种彩票功能,在一段时间后,n张彩票被选为中奖者。该站点有一个javascript倒计时,当它达到零时将触发一个事件。此事件将触发浏览器与服务器检查用户是否为赢家。我有一个黄瓜特性,如下所示: Feature: Notify Winners So that I can tell if I've won As an authenticated user I want to be notified if I've won when the count

我正在构建一个Rails应用程序,它有一种彩票功能,在一段时间后,n张彩票被选为中奖者。该站点有一个javascript倒计时,当它达到零时将触发一个事件。此事件将触发浏览器与服务器检查用户是否为赢家。我有一个黄瓜特性,如下所示:

Feature: Notify Winners
  So that I can tell if I've won
  As an authenticated user
  I want to be notified if I've won when the countdown completes

  Scenario: I have a winning ticket
    Given I'm logged in
    And I have a winning ticket for today
    When I'm on the home page
    And the countdown completes
    Then I should see "congratulations"
在这一点上,我怀疑这个特性是否以合理的方式编写。据我所知,在Cucumber中,我无法验证倒计时何时实际完成(例如,通过侦听JS事件)


左图中的“倒计时完成时”步骤定义是我不确定如何定义的。有没有关于如何更好地测试此功能的建议?

您可能会觉得很有帮助。据我所知,您需要打开使用capybara/selenium测试javascript功能。它使速度减慢了一点,但它起作用了