在我的 support/paths.rb 文件中,我的 case 子句之一是:
when /the checkout page/ then '/store/checkout'
但是,在某些流程中,到结帐页面的重定向会向 URL 添加一些参数,因此重定向不是到“/store/checkout”而是到(例如)“/store/checkout?email_confirmation=1”。
问题是这会导致 Cucumber 的一些断言失败,例如下面的第 3 行:
Given I am on the checkout page
When I proceed with a blank email address
Then I should be on the checkout page
And I should see "You must provide an email address."
第 3 步失败:
Then I should be on the checkout page # features/step_definitions/web_steps.rb:185
expected: "/store/checkout",
got: "/store/checkout?email_confirmation=1" (using ==)
如何让 Cucumber 忽略“?”之后的参数?在重定向的 URL 中?
Then I should be on the checkout page