我可以在多种情况下重复使用黄瓜步骤吗?
我面临以下问题:
1)如果在2个场景中重复相同的步骤,则执行失败。
Feature: LoginPage Cases
@smoke @regression
Scenario: Login to the website with North America credentials
And Enter the username and password
|username |password|
|natester@outlook.com|456123 |
And I click the 'SignIn' button
Then I should see 'Successfully Logged in' message
@smoke @regression
Scenario: Login to the website with Europe credentials
And Enter the username and password
|username |password|
|eutester@outlook.com|456123 |
And I click the 'SignIn' button
Then I should see 'Successfully Logged in' message
错误消息是: 在等待Protractor与页面同步时,找不到使用定位器或错误的元素。
2)无法一起执行2个不同的功能文件。我在每个场景之前从hooks文件加载网站。两个要素文件中的场景都需要在执行场景之前加载站点。
当独立运行时功能成功执行,而其中一个功能失败,如果两个功能一起运行,因为网站没有为第二个功能加载。错误信息与上述相同。
Feature: LoginPage Cases
@smoke @regression
Scenario: Login to the website with North America credentials
And Enter the username and password
|username |password|
|natester@outlook.com|456123 |
And I click the 'SignIn' button
Then I should see 'Successfully Logged in' message
Feature: To work with SignUp page
@smoke @regression
Scenario: Load Sign Up Page
And I click the 'Create a new Account' button
Then I should see the heading 'Create Account'
任何人都可以帮助我理解我是否有错误吗?