gpt4 book ai didi

ios - Calabash 中带双引号的文本的正则表达式

转载 作者:行者123 更新时间:2023-11-28 22:22:59 25 4
gpt4 key购买 nike

我在 auth.feature 文件中有一个场景:

Scenario: Authorize
Given I am on the Main View
When I touch the "ServiceButton" button

auth_steps.rb 文件中的触摸步骤:

When(/^I touch the "([^\"]*)" button$/) do |button|
touch("button marked:'#{button}'")
sleep(STEP_PAUSE)
end

当我尝试使用它时,出现错误:

You can implement step definitions for undefined steps with these snippets:

When(/^I touch the “ServiceButton” button$/) do
pending # express the regexp above with the code you wish you had
end

我使用了几个正则表达式,但没有任何效果。我找到的唯一解决方案是

When(/^I touch the (.*) button$/) do |button|

但在这种情况下,我需要写不带引号的按钮名称,这不是我想要的。

这就是我使用的:Xamarin、iPhone SDK 6.1、calabash-iOs。为了使用葫芦测试我的应用程序,我通过 Xamarin 启动应用程序,然后在控制台中键入 cucumber NO_LAUNCH=1

如果有人能帮我解决这个问题,我将不胜感激。

最佳答案

将您的步骤定义更改为:

When(/^I touch the “([^\"]*)“ button$/) do |button|
touch("button marked:'#{button}'")
sleep(STEP_PAUSE)
end

关于ios - Calabash 中带双引号的文本的正则表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19806762/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com