我的功能文件目前是这样写的:
Feature: Running Cucumber with Protractor
Scenario Outline: Check logging in page
Given I go on "/login"
Then the title should equal <pageTitle>
Examples:
|pageTitle |
|Case Management|
@refresh
Scenario Outline: Check logging in as any user
Given I go on "/login"
When I enter <username> into the username field
And I enter <password> into the password field
And I click sign in
Then I should arrive on the "/landing" page
Examples:
|username |password |
|user1 |pass |
|user2 |pass |
Scenario Outline: User1 should be able to see all the Subtypes listed in this table
Given I am on the "/landing" page
When I open the Menu
And I click New
And I enter a Title
And I choose the Type <type>
Then I should see the Subtypes <subtype>
Examples:
|type |subtype |
|Case |blah blah File |
|Case |blah blah File 2 |
|Case |blah blah File 3 |
|Case |blah blah File 4 |
Scenario Outline: User2 should be able to see all the Subtypes listed in this table
Given I am on the "/landing" page
When I open the Menu
And I click New
And I enter a Title
And I choose the Type <type>
Then I should see the Subtypes <subtype>
Examples:
|type |subtype |
|Case |blah blah File |
|Case |blah blah File 2 |
Scenario Outline: User2 should not be able to see the Subtypes listed in this table
Given I am on the "/landing" page
When I open the Menu
And I click New
And I enter a Title
And I choose the Type <type>
Then I should see the Subtypes <subtype>
Examples:
|type |subtype |
|Case |blah blah File 3 |
|Case |blah blah File 4 |
我将如何添加标记的钩子以仅执行与用户相关的场景。
我想我会在登录场景中添加@user1、@user2 标签,然后在 User1 场景中添加 @user1 标签,在 User2 场景中添加 @user2 标签。
但是我需要编写什么 javaScript 来制作这样的测试流程:
- 检查登录... (user1)
- 用户 1 应该能够...
- 检查登录... (user2)
- 用户 2 应该能够...
- 用户 2 应该无法...
也许我完全错了,每个用户都需要不同的功能文件?
任何建议都会很棒。