第一次尝试:--- 当我运行功能设置为
的behat时=CStr(Nz([myNumber], "")) & " °"
第一种情况有效,但第二种情况失败,回复: -
Feature: Authentication
Checking Application Authentication Functionality.
@javascript
Scenario: Admin Redirect Page
Given I am on "/admin/dashboard"
Then I should be on "/admin/login"
Scenario: Admin Login Failure
When I go to "/admin/login"
And I fill in "email" with "testaccount@gmail.com"
And I fill in "password" with "wrongpassword"
And I press "Login"
Then I should see "Login Failure"
第二次尝试:--- 我尝试删除第一个方案来测试我的功能是否已损坏并且运行成功。
Scenario: Admin Redirect Page # app/tests/behat/features/auth.feature:5
Given I am on "/admin/dashboard" # FeatureContext::visit()
Then I should be on "/admin/login" # FeatureContext::assertPageAddress()
Scenario: Admin Login Failure # app/tests/behat/features/auth.feature:9
When I go to "/admin/login" # FeatureContext::visit()
Target [Illuminate\Contracts\Http\Kernel] is not instantiable. (Illuminate\Contracts\Container\BindingResolutionException)
我不确定为什么在实施2场景时失败了。
第三次尝试:---
Scenario: Admin Login Failure # app/tests/behat/features/auth.feature:9
When I go to "/admin/login" # FeatureContext::visit()
And I fill in "email" with "testaccount@gmail.com" # FeatureContext::fillField()
And I fill in "password" with "wrongpassword" # FeatureContext::fillField()
And I press "Login" # FeatureContext::pressButton()
Then I should see "Login Failure" # FeatureContext::assertPageContainsText()
1 scenario (1 passed)
5 steps (5 passed)
0m3.70s (23.80Mb)
结果: -
Feature: Authentication
Checking Application Authentication Functionality.
@javascript
Scenario: Admin Redirect Page
Given I am on "/admin/dashboard"
Then I should be on "/admin/login"
Scenario: Admin Redirect Page
Given I am on "/admin/dashboard"
Then I should be on "/admin/login"
Scenario: Admin Redirect Page
Given I am on "/admin/dashboard"
Then I should be on "/admin/login"
答案 0 :(得分:0)
刚想出来,你需要为所有场景添加这两个。如果有人有同样的问题,这可能是任何帮助。
@javascript @mink:selenium_session
默认情况下,我的配置是由behat.yml在cmd行上运行的
sessions:
default_session:
laravel: ~
goutte_session:
goutte: ~
selenium_session:
selenium2:
wd_host: http://127.0.0.1:4444/wd/hub
因此,在浏览器上添加@javascript运行测试,并指定使用selenium的mink会话,您可以访问应用的所有JavaScript功能。